RBControl
Library for the RB3201-RBControl board with the ESP32 by RoboticsBrno.
Namespaces | Functions
half_duplex_uart.h File Reference
#include "soc/uart_reg.h"
#include "soc/uart_struct.h"
#include "esp_err.h"
#include "esp_intr_alloc.h"
#include "driver/periph_ctrl.h"
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include "freertos/xtensa_api.h"
#include "freertos/task.h"
#include "freertos/queue.h"
#include "freertos/ringbuf.h"
#include <esp_types.h>
#include "soc/uart_channel.h"
#include "driver/uart.h"

Go to the source code of this file.

Namespaces

 rb
 The base namespace. Contains some logging functions, too.
 
 rb::half_duplex
 

Functions

esp_err_t rb::half_duplex::uart_set_word_length (uart_port_t uart_num, uart_word_length_t data_bit)
 Set UART data bits. More...
 
esp_err_t rb::half_duplex::uart_get_word_length (uart_port_t uart_num, uart_word_length_t *data_bit)
 Get UART data bits. More...
 
esp_err_t rb::half_duplex::uart_set_stop_bits (uart_port_t uart_num, uart_stop_bits_t stop_bits)
 Set UART stop bits. More...
 
esp_err_t rb::half_duplex::uart_get_stop_bits (uart_port_t uart_num, uart_stop_bits_t *stop_bits)
 Get UART stop bits. More...
 
esp_err_t rb::half_duplex::uart_set_parity (uart_port_t uart_num, uart_parity_t parity_mode)
 Set UART parity mode. More...
 
esp_err_t rb::half_duplex::uart_get_parity (uart_port_t uart_num, uart_parity_t *parity_mode)
 Get UART parity mode. More...
 
esp_err_t rb::half_duplex::uart_set_baudrate (uart_port_t uart_num, uint32_t baudrate)
 Set UART baud rate. More...
 
esp_err_t rb::half_duplex::uart_get_baudrate (uart_port_t uart_num, uint32_t *baudrate)
 Get UART baud rate. More...
 
esp_err_t rb::half_duplex::uart_set_line_inverse (uart_port_t uart_num, uint32_t inverse_mask)
 Set UART line inverse mode. More...
 
esp_err_t rb::half_duplex::uart_set_hw_flow_ctrl (uart_port_t uart_num, uart_hw_flowcontrol_t flow_ctrl, uint8_t rx_thresh)
 Set hardware flow control. More...
 
esp_err_t rb::half_duplex::uart_set_sw_flow_ctrl (uart_port_t uart_num, bool enable, uint8_t rx_thresh_xon, uint8_t rx_thresh_xoff)
 Set software flow control. More...
 
esp_err_t rb::half_duplex::uart_get_hw_flow_ctrl (uart_port_t uart_num, uart_hw_flowcontrol_t *flow_ctrl)
 Get hardware flow control mode. More...
 
esp_err_t IRAM_ATTR rb::half_duplex::uart_clear_intr_status (uart_port_t uart_num, uint32_t clr_mask)
 Clear UART interrupt status. More...
 
esp_err_t rb::half_duplex::uart_enable_intr_mask (uart_port_t uart_num, uint32_t enable_mask)
 Set UART interrupt enable. More...
 
esp_err_t rb::half_duplex::uart_disable_intr_mask (uart_port_t uart_num, uint32_t disable_mask)
 Clear UART interrupt enable bits. More...
 
esp_err_t rb::half_duplex::uart_enable_rx_intr (uart_port_t uart_num)
 Enable UART RX interrupt (RX_FULL & RX_TIMEOUT INTERRUPT) More...
 
esp_err_t rb::half_duplex::uart_disable_rx_intr (uart_port_t uart_num)
 Disable UART RX interrupt (RX_FULL & RX_TIMEOUT INTERRUPT) More...
 
esp_err_t rb::half_duplex::uart_disable_tx_intr (uart_port_t uart_num)
 Disable UART TX interrupt (TX_FULL & TX_TIMEOUT INTERRUPT) More...
 
esp_err_t rb::half_duplex::uart_enable_tx_intr (uart_port_t uart_num, int enable, int thresh)
 Enable UART TX interrupt (TX_FULL & TX_TIMEOUT INTERRUPT) More...
 
esp_err_t rb::half_duplex::uart_isr_register (uart_port_t uart_num, void(*fn)(void *), void *arg, int intr_alloc_flags, uart_isr_handle_t *handle)
 Register UART interrupt handler (ISR). More...
 
esp_err_t rb::half_duplex::uart_isr_free (uart_port_t uart_num)
 Free UART interrupt handler registered by uart_isr_register. Must be called on the same core as uart_isr_register was called. More...
 
esp_err_t rb::half_duplex::uart_set_pin (uart_port_t uart_num, int tx_io_num, int rx_io_num, int rts_io_num, int cts_io_num)
 Set UART pin number. More...
 
esp_err_t rb::half_duplex::uart_set_rts (uart_port_t uart_num, int level)
 Manually set the UART RTS pin level. More...
 
esp_err_t rb::half_duplex::uart_set_dtr (uart_port_t uart_num, int level)
 Manually set the UART DTR pin level. More...
 
esp_err_t rb::half_duplex::uart_set_tx_idle_num (uart_port_t uart_num, uint16_t idle_num)
 Set UART idle interval after tx FIFO is empty. More...
 
esp_err_t rb::half_duplex::uart_param_config (uart_port_t uart_num, const uart_config_t *uart_config)
 Set UART configuration parameters. More...
 
esp_err_t rb::half_duplex::uart_intr_config (uart_port_t uart_num, const uart_intr_config_t *intr_conf)
 Configure UART interrupts. More...
 
esp_err_t rb::half_duplex::uart_driver_install (uart_port_t uart_num, int rx_buffer_size, int tx_buffer_size, int queue_size, QueueHandle_t *uart_queue, int intr_alloc_flags)
 Install UART driver. More...
 
esp_err_t rb::half_duplex::uart_driver_delete (uart_port_t uart_num)
 Uninstall UART driver. More...
 
esp_err_t rb::half_duplex::uart_wait_tx_done (uart_port_t uart_num, TickType_t ticks_to_wait)
 Wait until UART TX FIFO is empty. More...
 
int rb::half_duplex::uart_tx_chars (uart_port_t uart_num, const char *buffer, uint32_t len)
 Send data to the UART port from a given buffer and length. More...
 
int rb::half_duplex::uart_write_bytes (uart_port_t uart_num, const char *src, size_t size)
 Send data to the UART port from a given buffer and length,. More...
 
int rb::half_duplex::uart_write_bytes_with_break (uart_port_t uart_num, const char *src, size_t size, int brk_len)
 Send data to the UART port from a given buffer and length,. More...
 
int rb::half_duplex::uart_read_bytes (uart_port_t uart_num, uint8_t *buf, uint32_t length, TickType_t ticks_to_wait)
 UART read bytes from UART buffer. More...
 
esp_err_t rb::half_duplex::uart_flush (uart_port_t uart_num)
 Alias of uart_flush_input. UART ring buffer flush. This will discard all data in the UART RX buffer. More...
 
esp_err_t rb::half_duplex::uart_flush_input (uart_port_t uart_num)
 Clear input buffer, discard all the data is in the ring-buffer. More...
 
esp_err_t rb::half_duplex::uart_get_buffered_data_len (uart_port_t uart_num, size_t *size)
 UART get RX ring buffer cached data length. More...
 
esp_err_t rb::half_duplex::uart_disable_pattern_det_intr (uart_port_t uart_num)
 UART disable pattern detect function. Designed for applications like 'AT commands'. When the hardware detects a series of one same character, the interrupt will be triggered. More...
 
esp_err_t rb::half_duplex::uart_enable_pattern_det_intr (uart_port_t uart_num, char pattern_chr, uint8_t chr_num, int chr_tout, int post_idle, int pre_idle)
 UART enable pattern detect function. Designed for applications like 'AT commands'. When the hardware detect a series of one same character, the interrupt will be triggered. More...
 
int rb::half_duplex::uart_pattern_pop_pos (uart_port_t uart_num)
 Return the nearest detected pattern position in buffer. The positions of the detected pattern are saved in a queue, this function will dequeue the first pattern position and move the pointer to next pattern position. More...
 
int rb::half_duplex::uart_pattern_get_pos (uart_port_t uart_num)
 Return the nearest detected pattern position in buffer. The positions of the detected pattern are saved in a queue, This function do nothing to the queue. More...
 
esp_err_t rb::half_duplex::uart_pattern_queue_reset (uart_port_t uart_num, int queue_length)
 Allocate a new memory with the given length to save record the detected pattern position in rx buffer. More...
 
esp_err_t rb::half_duplex::uart_set_mode (uart_port_t uart_num, uart_mode_t mode)
 UART set communication mode. More...
 
esp_err_t rb::half_duplex::uart_set_rx_timeout (uart_port_t uart_num, const uint8_t tout_thresh)
 UART set threshold timeout for TOUT feature. More...
 
esp_err_t rb::half_duplex::uart_get_collision_flag (uart_port_t uart_num, bool *collision_flag)
 Returns collision detection flag for RS485 mode Function returns the collision detection flag into variable pointed by collision_flag. *collision_flag = true, if collision detected else it is equal to false. This function should be executed when actual transmission is completed (after uart_write_bytes()). More...
 
esp_err_t rb::half_duplex::uart_set_wakeup_threshold (uart_port_t uart_num, int wakeup_threshold)
 Set the number of RX pin signal edges for light sleep wakeup. More...
 
esp_err_t rb::half_duplex::uart_get_wakeup_threshold (uart_port_t uart_num, int *out_wakeup_threshold)
 Get the number of RX pin signal edges for light sleep wakeup. More...
 
void rb::half_duplex::uart_set_half_duplex_pin (uart_port_t uart_num, gpio_num_t pin)