AFBR-S50 API Reference Manual v1.5.6
AFBR-S50 Time-of-Flight Sensor SDK for Embedded Software
|
SCI Data Link Layer. More...
Macros | |
#define | SCI_ALLOW_NEWLINE 1 |
Whether to allow newline ( ) in print / log messages. | |
#define | SCI_CMD_IS_EXTENDED_CMD(cmd) ((cmd) & 0x80) |
Checks whether the command byte is an extended command (= MSB set). | |
Functions | |
status_t | SCI_DataLink_Init (void) |
Initialize the data link module. | |
status_t | SCI_DataLink_CheckRxFrame (sci_frame_t *frame) |
Checks the CRC checksum for a RX frame. | |
void | SCI_DataLink_ReleaseFrames (sci_frame_t *frame) |
Releases the frame queue. | |
void | SCI_DataLink_ResetRxFrames (sci_frame_t *frame) |
Resets the frame read pointer to the very first byte (= command byte). | |
bool | SCI_DataLink_IsTxBusy (void) |
Returns whether the TX line is currently busy and data is being sent. | |
status_t | SCI_DataLink_SendTxFrame (sci_frame_t *frame, bool high_priority) |
Trigger the data transfer and releases the TX buffers. | |
sci_frame_t * | SCI_DataLink_RequestTxFrame (bool queueStartByte) |
Find an unused TX buffer from the queue and prepare it with a start byte. | |
SCI Data Link Layer.
Implements the data link layer protocol for systems communication interface that connects to an external device. It takes care of sending and receiving data frames and thus byte stuffing and CRC check.
Remarks:
#define SCI_ALLOW_NEWLINE 1 |
Whether to allow newline (
) in print / log messages.
#define SCI_CMD_IS_EXTENDED_CMD | ( | cmd | ) | ((cmd) & 0x80) |
Checks whether the command byte is an extended command (= MSB set).
status_t SCI_DataLink_CheckRxFrame | ( | sci_frame_t * | frame | ) |
Checks the CRC checksum for a RX frame.
frame | The RX frame which requires CRC checking. |
status_t SCI_DataLink_Init | ( | void | ) |
bool SCI_DataLink_IsTxBusy | ( | void | ) |
Returns whether the TX line is currently busy and data is being sent.
void SCI_DataLink_ReleaseFrames | ( | sci_frame_t * | frame | ) |
Releases the frame queue.
frame | The frame queue to be released. |
sci_frame_t * SCI_DataLink_RequestTxFrame | ( | bool | queueStartByte | ) |
Find an unused TX buffer from the queue and prepare it with a start byte.
If sending data over the SCI, an new and empty TX frame needs to be claimed for usage of the command. This functions finds one and prepares it with an start byte. A pointer to the frame is returned if one is found. Otherwise null, so checking for null pointer is recommended!
queueStartByte | Whether to queue a start byte into the buffer. |
void SCI_DataLink_ResetRxFrames | ( | sci_frame_t * | frame | ) |
Resets the frame read pointer to the very first byte (= command byte).
frame | The frame queue to reset. |
status_t SCI_DataLink_SendTxFrame | ( | sci_frame_t * | frame, |
bool | high_priority | ||
) |
Trigger the data transfer and releases the TX buffers.
Before the frame is transferred, a stop byte is added to the end of the data buffer.
frame | The frame to be sent. |
high_priority | If set, the frame is queued right after the current frame. If not set, the frame is queued at the very end of the frame queue. |