Trident IoT SDK
 
Loading...
Searching...
No Matches
+ Collaboration diagram for UART:

Functions

tr_hal_status_t tr_hal_uart_init (tr_hal_uart_id_t uart_id, tr_hal_uart_settings_t *uart_settings)
 
tr_hal_status_t tr_hal_uart_uninit (tr_hal_uart_id_t uart_id)
 
tr_hal_status_t tr_hal_uart_set_power_mode (tr_hal_uart_id_t uart_id, tr_hal_power_mode_t power_mode)
 
tr_hal_status_t tr_hal_uart_raw_rx_one_byte (tr_hal_uart_id_t uart_id, char *byte)
 
tr_hal_status_t tr_hal_uart_raw_rx_available_bytes (tr_hal_uart_id_t uart_id, char *bytes, uint16_t buffer_size, uint16_t *num_returned_bytes)
 
tr_hal_status_t tr_hal_uart_raw_tx_one_byte (tr_hal_uart_id_t uart_id, const char byte_to_send)
 
tr_hal_status_t tr_hal_uart_raw_tx_buffer (tr_hal_uart_id_t uart_id, const char *bytes_to_send, uint16_t num_bytes_to_send)
 
tr_hal_status_t tr_hal_uart_tx_active (tr_hal_uart_id_t uart_id, bool *tx_active)
 
tr_hal_status_t tr_hal_uart_dma_tx_bytes_in_buffer (tr_hal_uart_id_t uart_id, char *bytes_to_send, uint16_t num_bytes_to_send)
 
tr_hal_status_t tr_hal_uart_dma_receive_buffer_num_bytes_left (tr_hal_uart_id_t uart_id, uint32_t *bytes_left)
 
tr_hal_status_t tr_hal_uart_dma_change_rx_buffer (tr_hal_uart_id_t uart_id, uint8_t *new_receive_buffer, uint16_t new_buffer_length)
 
tr_hal_baud_rate_t tr_hal_get_baud_rate_enum_from_value (uint32_t baud_rate_value)
 
tr_hal_data_bits_t tr_hal_get_data_bits_enum_from_value (uint8_t data_bits_value)
 
tr_hal_stop_bits_t tr_hal_get_stop_bits_enum_from_value (uint8_t stop_bits_value)
 
tr_hal_status_t tr_hal_uart_power_off (tr_hal_uart_id_t uart_id)
 
tr_hal_status_t tr_hal_uart_power_on (tr_hal_uart_id_t uart_id)
 
tr_hal_status_t tr_hal_uart_set_tx_rx_pins (tr_hal_uart_id_t uart_id, tr_hal_gpio_pin_t tx_pin, tr_hal_gpio_pin_t rx_pin)
 
tr_hal_status_t tr_hal_uart_set_rts_cts_pins (tr_hal_uart_id_t uart_id, tr_hal_gpio_pin_t rts_pin, tr_hal_gpio_pin_t cts_pin)
 
bool tr_hal_uart_check_pins_valid (tr_hal_uart_id_t uart_id, tr_hal_gpio_pin_t new_tx_pin, tr_hal_gpio_pin_t new_rx_pin)
 

Detailed Description



Function Documentation

◆ tr_hal_get_baud_rate_enum_from_value()

tr_hal_baud_rate_t tr_hal_get_baud_rate_enum_from_value ( uint32_t baud_rate_value)

takes a baud rate as an int (like 115200) and returns an enum of like TR_HAL_UART_BAUD_RATE_xxx

◆ tr_hal_get_data_bits_enum_from_value()

tr_hal_data_bits_t tr_hal_get_data_bits_enum_from_value ( uint8_t data_bits_value)

takes a data bits value as an int (like 8) and returns an enum like LCR_DATA_BITS_xxx_VALUE

◆ tr_hal_get_stop_bits_enum_from_value()

tr_hal_stop_bits_t tr_hal_get_stop_bits_enum_from_value ( uint8_t stop_bits_value)

takes a stop bits value as an int (like 1) and returns an enum like LCR_STOP_BITS_xxx_VALUE

◆ tr_hal_uart_check_pins_valid()

bool tr_hal_uart_check_pins_valid ( tr_hal_uart_id_t uart_id,
tr_hal_gpio_pin_t new_tx_pin,
tr_hal_gpio_pin_t new_rx_pin )

checking if pins are valid on any of the 3 UARTs, passing in the uart_id

◆ tr_hal_uart_dma_change_rx_buffer()

tr_hal_status_t tr_hal_uart_dma_change_rx_buffer ( tr_hal_uart_id_t uart_id,
uint8_t * new_receive_buffer,
uint16_t new_buffer_length )

This functions allows the caller to change the DMA buffer used for receive. This should be done when the buffer is getting full (low on bytes remaining)

◆ tr_hal_uart_dma_receive_buffer_num_bytes_left()

tr_hal_status_t tr_hal_uart_dma_receive_buffer_num_bytes_left ( tr_hal_uart_id_t uart_id,
uint32_t * bytes_left )

This function checks the number of bytes available in the DMA RX buffer. There is an event that notifies the user of a low condition: UART_EVENT_DMA_RX_BUFFER_LOW

◆ tr_hal_uart_dma_tx_bytes_in_buffer()

tr_hal_status_t tr_hal_uart_dma_tx_bytes_in_buffer ( tr_hal_uart_id_t uart_id,
char * bytes_to_send,
uint16_t num_bytes_to_send )

This function transmits the bytes in the bytes_to_send buffer using DMA for transmit.

◆ tr_hal_uart_init()

tr_hal_status_t tr_hal_uart_init ( tr_hal_uart_id_t uart_id,
tr_hal_uart_settings_t * uart_settings )

this initializes one of the 3 UARTs.
this takes the uart_id and a tr_hal_uart_settings_t config struct. the config struct is used to set up all aspects of the UART. if a configuration needs to be changed, uninit the UART, change the settings in the tr_hal_uart_settings_t and then re-init the UART.

◆ tr_hal_uart_power_off()

tr_hal_status_t tr_hal_uart_power_off ( tr_hal_uart_id_t uart_id)

called from init. the app should not need to call this. disables and clears interrupts

◆ tr_hal_uart_power_on()

tr_hal_status_t tr_hal_uart_power_on ( tr_hal_uart_id_t uart_id)

called from uninit. the app should not need to call this. enables and interrupts

◆ tr_hal_uart_raw_rx_available_bytes()

tr_hal_status_t tr_hal_uart_raw_rx_available_bytes ( tr_hal_uart_id_t uart_id,
char * bytes,
uint16_t buffer_size,
uint16_t * num_returned_bytes )

This function attempts to read bytes off of the chip registers. The app will not need this function if the receive_fx is enabled and used.

◆ tr_hal_uart_raw_rx_one_byte()

tr_hal_status_t tr_hal_uart_raw_rx_one_byte ( tr_hal_uart_id_t uart_id,
char * byte )

This function attempts to read one byte off of the chip registers. The app will not need this function if the receive_fx is enabled and used.

◆ tr_hal_uart_raw_tx_buffer()

tr_hal_status_t tr_hal_uart_raw_tx_buffer ( tr_hal_uart_id_t uart_id,
const char * bytes_to_send,
uint16_t num_bytes_to_send )

This function transmits the bytes in the bytes_to_send buffer using raw (non DMA) for transmit.

◆ tr_hal_uart_raw_tx_one_byte()

tr_hal_status_t tr_hal_uart_raw_tx_one_byte ( tr_hal_uart_id_t uart_id,
const char byte_to_send )

This function transmits the byte in the variable byte_to_send using raw (non DMA) for transmit.

◆ tr_hal_uart_set_power_mode()

tr_hal_status_t tr_hal_uart_set_power_mode ( tr_hal_uart_id_t uart_id,
tr_hal_power_mode_t power_mode )

if set to a LITE_SLEEP mode, this will change the clock and set the baud rate to the values in the UART settings for sleep. If set to WAKE mode then this will set the clock and baud rate to the values in the UART settings for normal mode.

◆ tr_hal_uart_set_rts_cts_pins()

tr_hal_status_t tr_hal_uart_set_rts_cts_pins ( tr_hal_uart_id_t uart_id,
tr_hal_gpio_pin_t rts_pin,
tr_hal_gpio_pin_t cts_pin )

function for setting the RTS and CTS pins for a particular UART. this also checks that the pin choices are VALID for that particular UART.

◆ tr_hal_uart_set_tx_rx_pins()

tr_hal_status_t tr_hal_uart_set_tx_rx_pins ( tr_hal_uart_id_t uart_id,
tr_hal_gpio_pin_t tx_pin,
tr_hal_gpio_pin_t rx_pin )

function for setting the TX and RX pins for a particular UART. this also checks that the pin choices are VALID for that particular UART.

◆ tr_hal_uart_tx_active()

tr_hal_status_t tr_hal_uart_tx_active ( tr_hal_uart_id_t uart_id,
bool * tx_active )

◆ tr_hal_uart_uninit()

tr_hal_status_t tr_hal_uart_uninit ( tr_hal_uart_id_t uart_id)

this un-initializes one of the 3 UARTs. clears all interrupts, empties FIFOs, sets pins back to GPIO mode.