PortableSerialLib
v0.4
a portable serial port lib
|
This functions receive data.
All receive functions are blocking. Hence there is no need for polling the port → let the operating system handle the waiting for data. As a drawback you cannot do things while waiting for input. But that is no really drawback since it is better to split up the two things and use threads.
One thread waiting for data and one thread doing the rest.
Functions | |
PSL_ErrorCodes_e | PSerLib_readBinaryData (PSerLibHandle_t io_port, uint8_t *o_data, int i_dataToRead, int *o_bytesRead) |
reads data from the port | |
PSL_ErrorCodes_e | PSerLib_readLine (PSerLibHandle_t io_port, char *o_string, int i_bufferLength, const char *i_endLineChars) |
reads data from the port |
PSL_ErrorCodes_e PSerLib_readBinaryData | ( | PSerLibHandle_t | io_port, |
uint8_t * | o_data, | ||
int | i_dataToRead, | ||
int * | o_bytesRead | ||
) |
reads data from the port
io_port | handle of port to read from |
o_data | pointer to buffer where the data should be stored. Ensure that the buffer can take at least i_dataToRead bytes. |
i_dataToRead | number of bytes to read |
o_bytesRead | number of bytes actual read (May differ because of time out or error) Can be NULL if not required. |
PSL_ErrorCodes_e PSerLib_readLine | ( | PSerLibHandle_t | io_port, |
char * | o_string, | ||
int | i_bufferLength, | ||
const char * | i_endLineChars | ||
) |
reads data from the port
io_port | handle of port to read from |
o_string | pointer to buffer where the data should be stored. |
i_bufferLength | number of bytes the buffer can take. Remember that the buffer also have to take the end character and terminating \0 character |
i_endLineChars | \0 terminated string, that contains characters that indicates line end. The line end character will also be copied into output buffer. |