Spacecraft Control Framework 1.0
Spacecraft Control Library
Functions
binary_gray_code.h File Reference

Converts binary and gray code back and forth. More...

Go to the source code of this file.

Functions

unsigned short GrayToBinary (unsigned short x)
 Converts gray code to binary. More...
 
unsigned short BinaryToGray (unsigned short x)
 Converts binary to gray code. More...
 

Detailed Description

Converts binary and gray code back and forth.

Both gray and binary are represented by unsigned short.

Function Documentation

◆ GrayToBinary()

unsigned short GrayToBinary ( unsigned short  x)

Converts gray code to binary.

Parameters
xgray code.
Returns
binary.

◆ BinaryToGray()

unsigned short BinaryToGray ( unsigned short  x)

Converts binary to gray code.

Converts binary to gray code.

Parameters
xbinary.
Returns
gray code.