AFBR-S50 API Reference Manual v1.5.6
AFBR-S50 Time-of-Flight Sensor SDK for Embedded Software
Loading...
Searching...
No Matches

SCI Data Frames. More...

Collaboration diagram for SCI: Data Frames:

Functions

int32_t SCI_Frame_TotalFrameLength (sci_frame_t const *frame)
 Returns the total number of bytes within a specified frame.
 
uint8_t SCI_Frame_IsStartFrame (sci_frame_t const *frame)
 Determines whether the frame is a start frame.
 
uint32_t SCI_Frame_BytesToRead (sci_frame_t const *frame)
 Returns the bytes that have been written from the buffer and not read yet.
 
void SCI_Frame_PutChar (char c, void *frame)
 Inserts a char into the TX buffer.
 
void SCI_Frame_SetByte (sci_frame_t *frame, uint8_t byte)
 Function for inserting a byte in a SCI frame.
 
void SCI_Frame_Queue08s (sci_frame_t *frame, int8_t data)
 Inserts a signed byte (8-bit) into the TX buffer.
 
void SCI_Frame_Queue16s (sci_frame_t *frame, int16_t data)
 Inserts a signed halfword (16-bit) into the TX buffer.
 
void SCI_Frame_Queue24s (sci_frame_t *frame, int32_t data)
 Inserts a signed 3/4-word (24-bit) into the TX buffer.
 
void SCI_Frame_Queue32s (sci_frame_t *frame, int32_t data)
 Inserts a signed word (32-bit) into the TX buffer.
 
void SCI_Frame_Queue_Time (sci_frame_t *frame, ltc_t const *t)
 Inserts a ltc_t time stamp type into the TX buffer.
 
void SCI_Frame_Queue08u (sci_frame_t *frame, uint8_t data)
 Inserts a unsigned byte (8-bit) into the TX buffer.
 
void SCI_Frame_Queue16u (sci_frame_t *frame, uint16_t data)
 Inserts a unsigned halfword (16-bit) into the TX buffer.
 
void SCI_Frame_Queue24u (sci_frame_t *frame, uint32_t data)
 Inserts a unsigned 3/4-word (24-bit) into the TX buffer.
 
void SCI_Frame_Queue32u (sci_frame_t *frame, uint32_t data)
 Inserts a unsigned word (32-bit) into the TX buffer.
 
int8_t SCI_Frame_Dequeue08s (sci_frame_t *frame)
 Takes a signed byte (8-bit) from the RX buffer.
 
int16_t SCI_Frame_Dequeue16s (sci_frame_t *frame)
 Takes a signed halfword (16-bit) from the RX buffer.
 
int32_t SCI_Frame_Dequeue24s (sci_frame_t *frame)
 Takes a signed 3/4-word (24-bit) from the RX buffer.
 
int32_t SCI_Frame_Dequeue32s (sci_frame_t *frame)
 Takes a signed word (32-bit) from the RX buffer.
 
uint8_t SCI_Frame_Dequeue08u (sci_frame_t *frame)
 Takes a unsigned byte (8-bit) from the RX buffer.
 
uint16_t SCI_Frame_Dequeue16u (sci_frame_t *frame)
 Takes a unsigned halfword (16-bit) from the RX buffer.
 
uint32_t SCI_Frame_Dequeue24u (sci_frame_t *frame)
 Takes a unsigned 3/4-word (24-bit) from the RX buffer.
 
uint32_t SCI_Frame_Dequeue32u (sci_frame_t *frame)
 Takes a unsigned word (32-bit) from the RX buffer.
 

Detailed Description

SCI Data Frames.


The SCI Data Frame Interface. Contains functionality to enqueue/dequeue different data types to/from an specified sci_frame_t object. This is mainly used to define the SCI commands and implement the data serialization.

Function Documentation

◆ SCI_Frame_BytesToRead()

uint32_t SCI_Frame_BytesToRead ( sci_frame_t const *  frame)

Returns the bytes that have been written from the buffer and not read yet.


Does calculate the total number of bytes to be read in the buffer. Especially it does not heed the byte stuffing and counts escape bytes as well as normal bytes.

Parameters
frameThe frame to count the data bytes.
Returns
The number of bytes to read.

◆ SCI_Frame_Dequeue08s()

int8_t SCI_Frame_Dequeue08s ( sci_frame_t frame)

Takes a signed byte (8-bit) from the RX buffer.


Parameters
frameThe frame to take the data from.
Returns
Signed byte.

◆ SCI_Frame_Dequeue08u()

uint8_t SCI_Frame_Dequeue08u ( sci_frame_t frame)

Takes a unsigned byte (8-bit) from the RX buffer.


Parameters
frameThe frame to take the data from.
Returns
Unsigned byte.

◆ SCI_Frame_Dequeue16s()

int16_t SCI_Frame_Dequeue16s ( sci_frame_t frame)

Takes a signed halfword (16-bit) from the RX buffer.


Parameters
frameThe frame to take the data from.
Returns
Signed 32-bit halfword.

◆ SCI_Frame_Dequeue16u()

uint16_t SCI_Frame_Dequeue16u ( sci_frame_t frame)

Takes a unsigned halfword (16-bit) from the RX buffer.


Parameters
frameThe frame to take the data from.
Returns
Unsigned 16-bit halfword.

◆ SCI_Frame_Dequeue24s()

int32_t SCI_Frame_Dequeue24s ( sci_frame_t frame)

Takes a signed 3/4-word (24-bit) from the RX buffer.


Parameters
frameThe frame to take the data from.
Returns
Signed 24-bit data.

◆ SCI_Frame_Dequeue24u()

uint32_t SCI_Frame_Dequeue24u ( sci_frame_t frame)

Takes a unsigned 3/4-word (24-bit) from the RX buffer.


Parameters
frameThe frame to take the data from.
Returns
Unsigned 24-bit 3/4-word.

◆ SCI_Frame_Dequeue32s()

int32_t SCI_Frame_Dequeue32s ( sci_frame_t frame)

Takes a signed word (32-bit) from the RX buffer.


Parameters
frameThe frame to take the data from.
Returns
Signed 32-bit word.

◆ SCI_Frame_Dequeue32u()

uint32_t SCI_Frame_Dequeue32u ( sci_frame_t frame)

Takes a unsigned word (32-bit) from the RX buffer.


Parameters
frameThe frame to take the data from.
Returns
Unsigned 32-bit word.

◆ SCI_Frame_IsStartFrame()

uint8_t SCI_Frame_IsStartFrame ( sci_frame_t const *  frame)

Determines whether the frame is a start frame.


If the specified frame is a start frame, i.e. the first frame of a sequence of multiple frames that starts with a start byte, the function returns true. False elsewise.

Parameters
frameThe frame to check for the start byte.
Returns
True if the frame is a start frame.

◆ SCI_Frame_PutChar()

void SCI_Frame_PutChar ( char  c,
void *  frame 
)

Inserts a char into the TX buffer.


The char is checked for byte stuffing and thus it might additionally add an escape byte to the buffer.

Note
No new line / carriage return chars are added to the buffer. They will be removed/ignored.
Parameters
cThe char to append.
frameThe frame to put the data.

◆ SCI_Frame_Queue08s()

void SCI_Frame_Queue08s ( sci_frame_t frame,
int8_t  data 
)

Inserts a signed byte (8-bit) into the TX buffer.


The byte is checked for byte stuffing and thus it might additionally add an escape byte to the buffer.

Parameters
frameThe frame to put the data.
dataThe byte to append.

◆ SCI_Frame_Queue08u()

void SCI_Frame_Queue08u ( sci_frame_t frame,
uint8_t  data 
)

Inserts a unsigned byte (8-bit) into the TX buffer.


The byte is checked for byte stuffing and thus it might additionally add an escape byte to the buffer.

Parameters
frameThe frame to put the data.
dataThe byte to append.

◆ SCI_Frame_Queue16s()

void SCI_Frame_Queue16s ( sci_frame_t frame,
int16_t  data 
)

Inserts a signed halfword (16-bit) into the TX buffer.


The two bytes are checked for byte stuffing and thus it might additionally add escape bytes to the buffer.

Parameters
frameThe frame to put the data.
dataThe data to append.

◆ SCI_Frame_Queue16u()

void SCI_Frame_Queue16u ( sci_frame_t frame,
uint16_t  data 
)

Inserts a unsigned halfword (16-bit) into the TX buffer.


The two bytes are checked for byte stuffing and thus it might additionally add escape bytes to the buffer.

Parameters
frameThe frame to put the data.
dataThe data to append.

◆ SCI_Frame_Queue24s()

void SCI_Frame_Queue24s ( sci_frame_t frame,
int32_t  data 
)

Inserts a signed 3/4-word (24-bit) into the TX buffer.


The three least significant bytes are added to the buffer. They are checked for byte stuffing and thus it might additionally add escape bytes to the buffer.

Parameters
frameThe frame to put the data.
dataThe data to append.

◆ SCI_Frame_Queue24u()

void SCI_Frame_Queue24u ( sci_frame_t frame,
uint32_t  data 
)

Inserts a unsigned 3/4-word (24-bit) into the TX buffer.


The three least significant bytes are added to the buffer. They are checked for byte stuffing and thus it might additionally add escape bytes to the buffer.

Parameters
frameThe frame to put the data.
dataThe data to append.

◆ SCI_Frame_Queue32s()

void SCI_Frame_Queue32s ( sci_frame_t frame,
int32_t  data 
)

Inserts a signed word (32-bit) into the TX buffer.


The four bytes are checked for byte stuffing and thus it might additionally add escape bytes to the buffer.

Parameters
frameThe frame to put the data.
dataThe data to append.

◆ SCI_Frame_Queue32u()

void SCI_Frame_Queue32u ( sci_frame_t frame,
uint32_t  data 
)

Inserts a unsigned word (32-bit) into the TX buffer.


The four bytes are checked for byte stuffing and thus it might additionally add escape bytes to the buffer.

Parameters
frameThe frame to put the data.
dataThe data to append.

◆ SCI_Frame_Queue_Time()

void SCI_Frame_Queue_Time ( sci_frame_t frame,
ltc_t const *  t 
)

Inserts a ltc_t time stamp type into the TX buffer.


The time stamp is added as 6 byte wide value, i.e.

  1. The seconds are added as uint32_t
  2. The microseconds / 16 are added as uint16_t

The four bytes are checked for byte stuffing and thus it might additionally add escape bytes to the buffer.

Parameters
frameThe frame to put the data.
tThe time stamp data to append.

◆ SCI_Frame_SetByte()

void SCI_Frame_SetByte ( sci_frame_t frame,
uint8_t  byte 
)

Function for inserting a byte in a SCI frame.


Parameters
frameThe frame to insert the byte.
byteThe byte to insert.

◆ SCI_Frame_TotalFrameLength()

int32_t SCI_Frame_TotalFrameLength ( sci_frame_t const *  frame)

Returns the total number of bytes within a specified frame.


Does calculate the total number of bytes that have been written into the buffer. Especially it does not heed the byte stuffing and counts escape bytes as well as normal bytes.

Parameters
frameThe frame to count the data bytes.
Returns
The number of bytes to read.