UART

API

The part “signal_name” in the described functions will be replaced by the name of the signal. E.g. if your signal is called “debug_uart” then the API function “signal_name_send_bytes” will become “debug_uart_send_bytes”.

send

void signal_name_send_bytes(const uint8_t *data, const uint32_t length)

Will send “length” bytes from the buffer “data” out on the TX line of the UART.

void signal_name_send_String(char* str)

Will send out the bytes of the sting on the TX line of the UART.

void signal_name_putc(void* p, char c)

Will send out the byte “c” on the TX line of the UART. The pointer “p” will not be used. This function is provided to be compatible with printf().

receive

uint32_t signal_name_get_num_received_bytes(void)

Returns the number of bytes that have been received on the RX line of the UART and have not been read.

uint8_t signal_name_get_next_received_byte(void)

Returns the next byte that has been received on the RX line of the UART.

bool signal_name_get_received_bytes(uint8_t *buf, const uint32_t length)

copies the “length” received bytes into the buffer “buf”. If less than “length” bytes have been received then this function returns false.