Simple Communication Interface (UART)#

Component that provides simple communication interface using UART. This component is mainly used in NCP communication cases. This is a No-Code component if used together with NCP Interface or NCP Host Communication Interface components.

Modules#

sl_simple_com_robust_result_t

Functions#

void
sl_simple_com_transmit(uint32_t len, const uint8_t *data)
void
sl_simple_com_transmit_cb(sl_status_t status)
void
sl_simple_com_receive_cb(sl_status_t status, uint32_t len, uint8_t *data)
size_t
sl_simple_com_robust_pack_data(uint8_t *packed_data_ptr, const uint8_t *data, uint16_t len)

Macros#

#define
SL_SIMPLE_COM_RX_BUF_SIZE (260)
#define
SL_SIMPLE_COM_TX_BUF_SIZE (260)
#define
SL_SIMPLE_COM_ROBUST 0
#define
SL_SIMPLE_COM_ROBUST_CRC 1
#define
SL_SIMPLE_COM_TASK_PRIO 4
#define
SL_SIMPLE_COM_TASK_STACK 1024
#define
SL_SIMPLE_COM_TASK_NAME "simple_com_task"
#define
SL_SIMPLE_COM_TASK_PRIO 4
#define
SL_SIMPLE_COM_TASK_STACK 1024
#define
SL_SIMPLE_COM_TASK_NAME "simple_com_task"
#define
SL_SIMPLE_COM_SEMAPHORE_NAME "simple_com_semaphore"
#define
SL_SIMPLE_COM_ROBUST_HEADER_SIZE 3
#define
sl_simple_com_robust_get_pack_buffer_size (len)

Function Documentation#

sl_simple_com_init#

void sl_simple_com_init (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Simple Comm Init.


Definition at line 45 of file common/simple_com/sl_simple_com.h

sl_simple_com_step#

void sl_simple_com_step (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Step function (used in CPC mode)


Definition at line 50 of file common/simple_com/sl_simple_com.h

sl_simple_com_transmit#

void sl_simple_com_transmit (uint32_t len, const uint8_t * data)
Parameters
TypeDirectionArgument NameDescription
uint32_tN/Alen
const uint8_t *N/Adata

Transmit function


Definition at line 55 of file common/simple_com/sl_simple_com.h

sl_simple_com_transmit_cb#

void sl_simple_com_transmit_cb (sl_status_t status)
Parameters
TypeDirectionArgument NameDescription
sl_status_tN/Astatus

Transmit completed callback


Definition at line 60 of file common/simple_com/sl_simple_com.h

sl_simple_com_receive#

void sl_simple_com_receive (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Receive function (used in UART mode)


Definition at line 65 of file common/simple_com/sl_simple_com.h

sl_simple_com_receive_cb#

void sl_simple_com_receive_cb (sl_status_t status, uint32_t len, uint8_t * data)
Parameters
TypeDirectionArgument NameDescription
sl_status_tN/Astatus
uint32_tN/Alen
uint8_t *N/Adata

Receive completed callback


Definition at line 70 of file common/simple_com/sl_simple_com.h

sl_simple_com_os_task_init#

void sl_simple_com_os_task_init (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

OS initialization function - if the OS is present


Definition at line 75 of file common/simple_com/sl_simple_com.h

sl_simple_com_os_task_proceed#

void sl_simple_com_os_task_proceed (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Function to trigger the OS task to proceed - if the OS is present


Definition at line 80 of file common/simple_com/sl_simple_com.h

sl_simple_com_robust_pack_data#

size_t sl_simple_com_robust_pack_data (uint8_t * packed_data_ptr, const uint8_t * data, uint16_t len)
Parameters
TypeDirectionArgument NameDescription
uint8_t *[out]packed_data_ptr

pointer where the packed data should be loaded

const uint8_t *[in]data

pointer to the data to be packed

uint16_t[in]len

size of the data to be packed

Pack data between preamble byte and (if turned on) CRC checksum This function adds a 3 byte header containing preamble byte, payload length, CRC flag and CRC value to the header. If CRC is required an 8 bit CRC value will be calculated for the payload and added to the end of packet.

Returns

  • the size of packed data


Definition at line 78 of file common/simple_com/sl_simple_com_robust.h

sl_simple_com_robust_unpack_data#

sl_simple_com_robust_result_t sl_simple_com_robust_unpack_data (uint8_t * data, size_t len)
Parameters
TypeDirectionArgument NameDescription
uint8_t *[in]data

pointer to the data to be unpacked

size_t[in]len

size of the data to be unpacked

Unpack packets from byte stream looking for valid headers. This function searches valid headers and extracts payload after the header into destination buffer. Header is validated by 4 bit header CRC and payload can be also validated by optional CRC check.

Returns

  • the result of the action


Definition at line 92 of file common/simple_com/sl_simple_com_robust.h