Basic COM Port functions. More...
Go to the source code of this file.
Defines | |
#define | BCS_COM_GPS_MOUSE "/dev/ttyS2" |
Constant for opening the com port with gps mouse connected. | |
#define | BCS_COM_GPS_SPEED BCS_COM_B4800 |
Constant for configuring speed for the "gps com port". | |
#define | BCS_COM_TELEMETRY "/dev/ttyS0" |
Constant for opening the com port the telemetry client is listening to. | |
Enumerations | |
enum | BCS_COM_speeds |
use this enum to configure speed of a com port | |
Functions | |
void | BCS_COM_closePort (BCS_comport *filedescriptor) |
Closes given COM port. | |
void | BCS_COM_configSpeed (BCS_comport *filedescriptor, BCS_COM_speeds baudrate) |
Configures COM port with given speed and 8n1 bitmask. | |
BCS_ERROR | BCS_COM_openPort (BCS_comport *fd, const char *port) |
Opens given COM port for input and output. | |
Int32 | BCS_COM_read (BCS_comport *filedescriptor, char *data, size_t bytes) |
Reads available data from a COM port. | |
BCS_ERROR | BCS_COM_write (BCS_comport *filedescriptor, char *data, size_t bytes) |
Writes given data to a COM port. |
void BCS_COM_configSpeed | ( | BCS_comport * | filedescriptor, |
BCS_COM_speeds | baudrate | ||
) |
filedescriptor | |
baudrate | selected baudrate |
BCS_ERROR BCS_COM_openPort | ( | BCS_comport * | fd, |
const char * | port | ||
) |
fd | Pointer to an unused BCS filedescriptor |
port | string describing port to open |
Int32 BCS_COM_read | ( | BCS_comport * | filedescriptor, |
char * | data, | ||
size_t | bytes | ||
) |
If no data is available, it will wait until data is received.
filedescriptor | |
data | pointer to a char/data array |
bytes | number of bytes you want to read max |
BCS_ERROR BCS_COM_write | ( | BCS_comport * | filedescriptor, |
char * | data, | ||
size_t | bytes | ||
) |
filedescriptor | |
data | pointer to a char/data array |
bytes | number of bytes you want to write |