ModusToolbox Safety Test Library
Loading...
Searching...
No Matches

General Description

Functions

void UartMesSlave_Init (CySCB_Type *uart_base, uint8_t address)
 Initializes the UART slave protocol unit.
void UartMesSlave_DeInit (void)
 De-initializes the UART slave protocol unit.
uint8_t UartMesSlave_Respond (uint8_t *txd, uint8_t tlen)
 Starts the background sending of the respond.
uint8_t UartMesSlave_State (void)
 Returns the state of the current slave unit.
uint8_t UartMesSlave_GetDataSize (void)
 Returns the received data size.
volatile uint8_t * UartMesSlave_GetDataPtr (void)
 Returns a pointer to the received data buffer.
void UartMesSlave_Msg_ISR (void)
 Interrupt handler for UART to receive/transmit.

Function Documentation

◆ UartMesSlave_Init()

void UartMesSlave_Init ( CySCB_Type * uart_base,
uint8_t address )

Initializes the UART slave protocol unit.

This function starts the required components and initializes the control status structure.

Note
This function enables the UART peripheral, clears TX/RX FIFOs, and sets the interrupt masks used by the message protocol. Use a UART instance dedicated to this protocol or reinitialize the application UART configuration after calling UartMesSlave_DeInit.
Parameters
uart_baseThe pointer to the slave UART SCB instance.
addressSlave bus address

◆ UartMesSlave_DeInit()

void UartMesSlave_DeInit ( void )

De-initializes the UART slave protocol unit.

Disables all TX/RX interrupts, flushes the FIFOs, disables the UART peripheral, and resets the internal control status structure.

◆ UartMesSlave_Respond()

uint8_t UartMesSlave_Respond ( uint8_t * txd,
uint8_t tlen )

Starts the background sending of the respond.

Parameters
txdThe pointer to the sent data.
tlenThe size of sent data in bytes.
Note
This function starts interrupt-driven background transmission. Call it only when UartMesSlave_State reports that a response is expected, and do not start another response while the state is UM_RESPOND. The txd buffer must remain valid and unmodified until the response completes.
Returns
UART_SLAVE_RESPOND_STARTED_STATUS (0) - The unit started a response process
UART_SLAVE_RESPOND_NOT_STARTED_STATUS (1) - The unit did not start a response process
Note
Use UartMesSlave_State() to check this condition

◆ UartMesSlave_State()

uint8_t UartMesSlave_State ( void )

Returns the state of the current slave unit.

Returns
UM_IDLE - The unit to wait for the packet from master.
UM_PACKREADY - The unit to receive the packet. A respond must be sent.
UM_RESPOND - The unit send responce.

◆ UartMesSlave_GetDataSize()

uint8_t UartMesSlave_GetDataSize ( void )

Returns the received data size.

Returns
The size of the received data in the buffer.
Note
The result is valid only if the unit state is UM_PACKREADY.. Use UartMesSlave_State() to check this condition.

◆ UartMesSlave_GetDataPtr()

volatile uint8_t * UartMesSlave_GetDataPtr ( void )

Returns a pointer to the received data buffer.

Returns
The pointer to the received data buffer.