HAL  v0.6.1
Hardware Abstraction Layer
Loading...
Searching...
No Matches
hal_uart.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include "hal_gpio.h"
Include dependency graph for hal_uart.h:

Data Structures

struct  uart_bus_status_t
 
struct  uart_channel_attr_t
 
struct  uart_handle_t
 

Enumerations

enum  uart_result_t {
  UART_RESULT_OK ,
  UART_RESULT_INVALID ,
  UART_RESULT_UNSUPPORTED ,
  UART_RESULT_OVERRUN_ERROR ,
  UART_RESULT_UNDERRUN_ERROR ,
  UART_RESULT_FRAMING_ERROR ,
  UART_RESULT_PARITY_ERROR ,
  UART_RESULT_TIMEOUT ,
  UART_RESULT_IDLE ,
  UART_RESULT_BUSY ,
  UART_RESULT_ERR ,
  TOTAL_UART_RESULT
}
 
enum  uart_status_t {
  UART_STATUS_UNKNOWN ,
  UART_STATUS_OK ,
  UART_STATUS_BUSY ,
  UART_STATUS_STOP ,
  UART_STATUS_SENDING ,
  UART_STATUS_RECEIVING ,
  UART_STATUS_ERR ,
  TOTAL_UART_STATUS
}
 
enum  uart_mode_t {
  UART_MODE_ASYNCHRONOUS ,
  UART_MODE_SYNCHRONOUS ,
  TOTAL_UART_MODE
}
 
enum  uart_baudrate_t {
  UART_BAUDRATE_9600 = 9600U ,
  UART_BAUDRATE_19200 = 19200U ,
  UART_BAUDRATE_38400 = 38400U ,
  UART_BAUDRATE_57600 = 57600U ,
  UART_BAUDRATE_115200 = 115200U ,
  UART_BAUDRATE_576000 = 576000U ,
  UART_BAUDRATE_921600 = 921600U ,
  TOTAL_UART_BAUDRATE
}
 
enum  uart_baudrate_type_t {
  UART_BAUDRATE_TYPE_MANUAL ,
  UART_BAUDRATE_TYPE_AUTO ,
  TOTAL_UART_BAUDRATE_TYPE
}
 
enum  uart_data_bits_t {
  UART_DATA_BITS_8 ,
  UART_DATA_BITS_9 ,
  TOTAL_UART_DATA_BITS
}
 
enum  uart_stop_bits_t {
  UART_STOP_BITS_1 ,
  UART_STOP_BITS_2 ,
  TOTAL_UART_STOP_BITS
}
 
enum  uart_parity_t {
  UART_PARITY_EVEN ,
  UART_PARITY_ODD ,
  UART_PARITY_NONE ,
  TOTAL_UART_PARITY
}
 

Functions

uart_result_t hal_uart_init (uart_handle_t *handle, const uart_channel_attr_t attr)
 Configure UART channel with specific attributes.
 
uart_result_t hal_uart_write (uart_handle_t *handle, const uint8_t *tx_buffer, const size_t len)
 Write data to UART channel.
 
uart_result_t hal_uart_read (uart_handle_t *handle, uint8_t *rx_buffer, const size_t len)
 Read data from UART channel.
 
uart_result_t hal_uart_stop (uart_handle_t *handle)
 Stop UART operation.
 
uart_bus_status_t hal_uart_get_status (uart_handle_t *handle)
 Get UART bus status.
 
uart_result_t hal_uart_mutex_take (const uint8_t channel, const uint32_t timeout_ms)
 Try acquire RTOS mutex for specified channel.
 
uart_result_t hal_uart_mutex_give (const uint8_t channel)
 Release RTOS mutex for specified channel.