ESPHome  2023.11.6
Public Member Functions | Protected Member Functions | Protected Attributes
esphome::uart::UARTComponent Class Referenceabstract

#include <uart_component.h>

Inheritance diagram for esphome::uart::UARTComponent:
esphome::uart::ESP32ArduinoUARTComponent esphome::uart::ESP8266UartComponent esphome::uart::IDFUARTComponent esphome::uart::LibreTinyUARTComponent esphome::uart::RP2040UartComponent

Public Member Functions

void write_array (const std::vector< uint8_t > &data)
 
void write_byte (uint8_t data)
 
void write_str (const char *str)
 
virtual void write_array (const uint8_t *data, size_t len)=0
 
bool read_byte (uint8_t *data)
 
virtual bool peek_byte (uint8_t *data)=0
 
virtual bool read_array (uint8_t *data, size_t len)=0
 
virtual int available ()=0
 Return available number of bytes. More...
 
virtual void flush ()=0
 Block until all bytes have been written to the UART bus. More...
 
void set_tx_pin (InternalGPIOPin *tx_pin)
 
void set_rx_pin (InternalGPIOPin *rx_pin)
 
void set_rx_buffer_size (size_t rx_buffer_size)
 
size_t get_rx_buffer_size ()
 
void set_stop_bits (uint8_t stop_bits)
 
uint8_t get_stop_bits () const
 
void set_data_bits (uint8_t data_bits)
 
uint8_t get_data_bits () const
 
void set_parity (UARTParityOptions parity)
 
UARTParityOptions get_parity () const
 
void set_baud_rate (uint32_t baud_rate)
 
uint32_t get_baud_rate () const
 
void add_debug_callback (std::function< void(UARTDirection, uint8_t)> &&callback)
 

Protected Member Functions

virtual void check_logger_conflict ()=0
 
bool check_read_timeout_ (size_t len=1)
 

Protected Attributes

InternalGPIOPintx_pin_
 
InternalGPIOPinrx_pin_
 
size_t rx_buffer_size_
 
uint32_t baud_rate_
 
uint8_t stop_bits_
 
uint8_t data_bits_
 
UARTParityOptions parity_
 
CallbackManager< void(UARTDirection, uint8_t)> debug_callback_ {}
 

Detailed Description

Definition at line 32 of file uart_component.h.

Member Function Documentation

◆ add_debug_callback()

void esphome::uart::UARTComponent::add_debug_callback ( std::function< void(UARTDirection, uint8_t)> &&  callback)
inline

Definition at line 67 of file uart_component.h.

◆ available()

virtual int esphome::uart::UARTComponent::available ( )
pure virtual

◆ check_logger_conflict()

virtual void esphome::uart::UARTComponent::check_logger_conflict ( )
protectedpure virtual

◆ check_read_timeout_()

bool esphome::uart::UARTComponent::check_read_timeout_ ( size_t  len = 1)
protected

Definition at line 8 of file uart_component.cpp.

◆ flush()

virtual void esphome::uart::UARTComponent::flush ( )
pure virtual

◆ get_baud_rate()

uint32_t esphome::uart::UARTComponent::get_baud_rate ( ) const
inline

Definition at line 64 of file uart_component.h.

◆ get_data_bits()

uint8_t esphome::uart::UARTComponent::get_data_bits ( ) const
inline

Definition at line 60 of file uart_component.h.

◆ get_parity()

UARTParityOptions esphome::uart::UARTComponent::get_parity ( ) const
inline

Definition at line 62 of file uart_component.h.

◆ get_rx_buffer_size()

size_t esphome::uart::UARTComponent::get_rx_buffer_size ( )
inline

Definition at line 55 of file uart_component.h.

◆ get_stop_bits()

uint8_t esphome::uart::UARTComponent::get_stop_bits ( ) const
inline

Definition at line 58 of file uart_component.h.

◆ peek_byte()

virtual bool esphome::uart::UARTComponent::peek_byte ( uint8_t *  data)
pure virtual

◆ read_array()

virtual bool esphome::uart::UARTComponent::read_array ( uint8_t *  data,
size_t  len 
)
pure virtual

◆ read_byte()

bool esphome::uart::UARTComponent::read_byte ( uint8_t *  data)
inline

Definition at line 43 of file uart_component.h.

◆ set_baud_rate()

void esphome::uart::UARTComponent::set_baud_rate ( uint32_t  baud_rate)
inline

Definition at line 63 of file uart_component.h.

◆ set_data_bits()

void esphome::uart::UARTComponent::set_data_bits ( uint8_t  data_bits)
inline

Definition at line 59 of file uart_component.h.

◆ set_parity()

void esphome::uart::UARTComponent::set_parity ( UARTParityOptions  parity)
inline

Definition at line 61 of file uart_component.h.

◆ set_rx_buffer_size()

void esphome::uart::UARTComponent::set_rx_buffer_size ( size_t  rx_buffer_size)
inline

Definition at line 54 of file uart_component.h.

◆ set_rx_pin()

void esphome::uart::UARTComponent::set_rx_pin ( InternalGPIOPin rx_pin)
inline

Definition at line 53 of file uart_component.h.

◆ set_stop_bits()

void esphome::uart::UARTComponent::set_stop_bits ( uint8_t  stop_bits)
inline

Definition at line 57 of file uart_component.h.

◆ set_tx_pin()

void esphome::uart::UARTComponent::set_tx_pin ( InternalGPIOPin tx_pin)
inline

Definition at line 52 of file uart_component.h.

◆ write_array() [1/2]

void esphome::uart::UARTComponent::write_array ( const std::vector< uint8_t > &  data)
inline

Definition at line 34 of file uart_component.h.

◆ write_array() [2/2]

virtual void esphome::uart::UARTComponent::write_array ( const uint8_t *  data,
size_t  len 
)
pure virtual

◆ write_byte()

void esphome::uart::UARTComponent::write_byte ( uint8_t  data)
inline

Definition at line 35 of file uart_component.h.

◆ write_str()

void esphome::uart::UARTComponent::write_str ( const char *  str)
inline

Definition at line 36 of file uart_component.h.

Field Documentation

◆ baud_rate_

uint32_t esphome::uart::UARTComponent::baud_rate_
protected

Definition at line 79 of file uart_component.h.

◆ data_bits_

uint8_t esphome::uart::UARTComponent::data_bits_
protected

Definition at line 81 of file uart_component.h.

◆ debug_callback_

CallbackManager<void(UARTDirection, uint8_t)> esphome::uart::UARTComponent::debug_callback_ {}
protected

Definition at line 84 of file uart_component.h.

◆ parity_

UARTParityOptions esphome::uart::UARTComponent::parity_
protected

Definition at line 82 of file uart_component.h.

◆ rx_buffer_size_

size_t esphome::uart::UARTComponent::rx_buffer_size_
protected

Definition at line 78 of file uart_component.h.

◆ rx_pin_

InternalGPIOPin* esphome::uart::UARTComponent::rx_pin_
protected

Definition at line 77 of file uart_component.h.

◆ stop_bits_

uint8_t esphome::uart::UARTComponent::stop_bits_
protected

Definition at line 80 of file uart_component.h.

◆ tx_pin_

InternalGPIOPin* esphome::uart::UARTComponent::tx_pin_
protected

Definition at line 76 of file uart_component.h.


The documentation for this class was generated from the following files: