Trident IoT SDK
Loading...
Searching...
No Matches
tr_hal_uart.h File Reference

This is the common include file for the Trident HAL UART Driver. More...

#include "tr_hal_platform.h"
Include dependency graph for tr_hal_uart.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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, uint8_t *byte)
tr_hal_status_t tr_hal_uart_raw_rx_available_bytes (tr_hal_uart_id_t uart_id, uint8_t *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 uint8_t byte_to_send)
tr_hal_status_t tr_hal_uart_raw_tx_buffer (tr_hal_uart_id_t uart_id, const uint8_t *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, const uint8_t *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

This is the common include file for the Trident HAL UART Driver.


SPDX-License-Identifier: LicenseRef-TridentMSLA SPDX-FileCopyrightText: 2025 Trident IoT, LLC https://www.tridentiot.com


how to RX and TX in different modes with the UART:


------— transmit ------—

  1. transmit using the raw TX APIs => set tr_hal_uart_settings_t.tx_dma_enabled=0 => use API: tr_hal_uart_raw_tx_buffer
  2. transmit using DMA TX APIs => set tr_hal_uart_settings_t.tx_dma_enabled=1 => use API: tr_hal_uart_dma_tx_bytes_in_buffer

------— receive ------—

  1. receive automatically in the user defined receive function (recommended) => set tr_hal_uart_settings_t.rx_handler_function to an app function => set tr_hal_uart_settings_t.rx_dma_enabled=0 => handle bytes in the app function
  2. receive using DMA RX, where the app manages the DMA RX buffer
  3. receive using the raw API calls => set tr_hal_uart_settings_t.rx_dma_enabled=0 => call tr_hal_uart_raw_rx_available_bytes