ESPHome  2024.4.1
Public Member Functions | Protected Attributes
esphome::uart::UARTDevice Class Reference

#include <uart.h>

Inheritance diagram for esphome::uart::UARTDevice:
esphome::a01nyub::A01nyubComponent esphome::a02yyuw::A02yyuwComponent esphome::adalight::AdalightLightEffect esphome::bl0939::BL0939 esphome::bl0940::BL0940 esphome::bl0942::BL0942 esphome::cse7761::CSE7761Component esphome::cse7766::CSE7766Component esphome::daly_bms::DalyBmsComponent esphome::dfplayer::DFPlayer esphome::dfrobot_sen0395::DfrobotSen0395Component esphome::dsmr::Dsmr esphome::fingerprint_grow::FingerprintGrowComponent esphome::gcja5::GCJA5Component esphome::gps::GPS esphome::haier::HaierClimateBase esphome::he60r::HE60rCover esphome::hrxl_maxsonar_wr::HrxlMaxsonarWrComponent esphome::hydreon_rgxx::HydreonRGxxComponent esphome::jsn_sr04t::Jsnsr04tComponent esphome::kamstrup_kmp::KamstrupKMPComponent esphome::ld2410::LD2410Component esphome::ld2420::LD2420Component esphome::mhz19::MHZ19Component esphome::micronova::MicroNova esphome::modbus::Modbus esphome::nextion::Nextion esphome::pipsolar::Pipsolar esphome::pm1006::PM1006Component esphome::pmsx003::PMSX003Component esphome::pylontech::PylontechComponent esphome::pzem004t::PZEM004T esphome::rdm6300::RDM6300Component esphome::rf_bridge::RFBridgeComponent esphome::sds011::SDS011Component esphome::seeed_mr24hpc1::MR24HPC1Component esphome::senseair::SenseAirComponent esphome::shelly_dimmer::ShellyDimmer esphome::sim800l::Sim800LComponent esphome::sm300d2::SM300D2Sensor esphome::sml::Sml esphome::smt100::SMT100Component esphome::sonoff_d1::SonoffD1Output esphome::sun_gtil2::SunGTIL2 esphome::t6615::T6615Component esphome::teleinfo::TeleInfo esphome::tuya::Tuya esphome::uart::UARTButton esphome::uart::UARTDummyReceiver esphome::uart::UARTSwitch esphome::uponor_smatrix::UponorSmatrixComponent esphome::vbus::VBus esphome::wl_134::Wl134Component

Public Member Functions

 UARTDevice ()=default
 
 UARTDevice (UARTComponent *parent)
 
void set_uart_parent (UARTComponent *parent)
 
void write_byte (uint8_t data)
 
void write_array (const uint8_t *data, size_t len)
 
void write_array (const std::vector< uint8_t > &data)
 
template<size_t N>
void write_array (const std::array< uint8_t, N > &data)
 
void write_str (const char *str)
 
bool read_byte (uint8_t *data)
 
bool peek_byte (uint8_t *data)
 
bool read_array (uint8_t *data, size_t len)
 
template<size_t N>
optional< std::array< uint8_t, N > > read_array ()
 
int available ()
 
void flush ()
 
int read ()
 
size_t write (uint8_t data)
 
int peek ()
 
void check_uart_settings (uint32_t baud_rate, uint8_t stop_bits=1, UARTParityOptions parity=UART_CONFIG_PARITY_NONE, uint8_t data_bits=8)
 Check that the configuration of the UART bus matches the provided values and otherwise print a warning. More...
 

Protected Attributes

UARTComponentparent_ {nullptr}
 

Detailed Description

Definition at line 12 of file uart.h.

Constructor & Destructor Documentation

◆ UARTDevice() [1/2]

esphome::uart::UARTDevice::UARTDevice ( )
default

◆ UARTDevice() [2/2]

esphome::uart::UARTDevice::UARTDevice ( UARTComponent parent)
inline

Definition at line 15 of file uart.h.

Member Function Documentation

◆ available()

int esphome::uart::UARTDevice::available ( )
inline

Definition at line 41 of file uart.h.

◆ check_uart_settings()

void esphome::uart::UARTDevice::check_uart_settings ( uint32_t  baud_rate,
uint8_t  stop_bits = 1,
UARTParityOptions  parity = UART_CONFIG_PARITY_NONE,
uint8_t  data_bits = 8 
)

Check that the configuration of the UART bus matches the provided values and otherwise print a warning.

Definition at line 13 of file uart.cpp.

◆ flush()

void esphome::uart::UARTDevice::flush ( )
inline

Definition at line 43 of file uart.h.

◆ peek()

int esphome::uart::UARTDevice::peek ( )
inline

Definition at line 56 of file uart.h.

◆ peek_byte()

bool esphome::uart::UARTDevice::peek_byte ( uint8_t *  data)
inline

Definition at line 30 of file uart.h.

◆ read()

int esphome::uart::UARTDevice::read ( )
inline

Definition at line 46 of file uart.h.

◆ read_array() [1/2]

bool esphome::uart::UARTDevice::read_array ( uint8_t *  data,
size_t  len 
)
inline

Definition at line 32 of file uart.h.

◆ read_array() [2/2]

template<size_t N>
optional<std::array<uint8_t, N> > esphome::uart::UARTDevice::read_array ( )
inline

Definition at line 33 of file uart.h.

◆ read_byte()

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

Definition at line 29 of file uart.h.

◆ set_uart_parent()

void esphome::uart::UARTDevice::set_uart_parent ( UARTComponent parent)
inline

Definition at line 17 of file uart.h.

◆ write()

size_t esphome::uart::UARTDevice::write ( uint8_t  data)
inline

Definition at line 52 of file uart.h.

◆ write_array() [1/3]

void esphome::uart::UARTDevice::write_array ( const uint8_t *  data,
size_t  len 
)
inline

Definition at line 21 of file uart.h.

◆ write_array() [2/3]

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

Definition at line 22 of file uart.h.

◆ write_array() [3/3]

template<size_t N>
void esphome::uart::UARTDevice::write_array ( const std::array< uint8_t, N > &  data)
inline

Definition at line 23 of file uart.h.

◆ write_byte()

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

Definition at line 19 of file uart.h.

◆ write_str()

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

Definition at line 27 of file uart.h.

Field Documentation

◆ parent_

UARTComponent* esphome::uart::UARTDevice::parent_ {nullptr}
protected

Definition at line 68 of file uart.h.


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