ESPHome 2026.12.0-dev
Loading...
Searching...
No Matches
esphome::rs485_frame Namespace Reference

Data Structures

class  RS485FrameHub
 Hub for a DLE-framed RS485 bus: RX framer, CRC engine, gated TX queue and on_frame callbacks. More...
 

Enumerations

enum  CrcVariant : uint8_t { CRC_HEADER_INCLUSIVE , CRC_PAYLOAD_ONLY }
 
enum  CrcType : uint8_t {
  CRC_TYPE_NONE , CRC_TYPE_SUM8 , CRC_TYPE_SUM16_BIG_ENDIAN , CRC_TYPE_SUM16_LITTLE_ENDIAN ,
  CRC_TYPE_XOR8 , CRC_TYPE_CRC16_MODBUS
}
 
enum  QueuePolicy : uint8_t { QUEUE_REPLACE_LATEST , QUEUE_FIFO }
 
enum  TxGateMode : uint8_t { TX_GATE_FRAME_TRIGGER , TX_GATE_IDLE_GAP , TX_GATE_FIXED_DELAY }
 
enum  RxState : uint8_t { RX_STATE_IDLE , RX_STATE_IDLE_DLE , RX_STATE_FRAME , RX_STATE_FRAME_DLE }
 The _DLE states mean the last byte was a DLE. More...
 

Functions

 ESPHOME_LOG_TAG (TAG, "rs485_frame")
 
 PROGMEM_STRING_TABLE (CrcTypeStrings, "none", "sum8", "sum16_big_endian", "sum16_little_endian", "xor8", "crc16_modbus")
 
 PROGMEM_STRING_TABLE (CrcVariantStrings, "header_inclusive", "payload_only")
 
 PROGMEM_STRING_TABLE (GateModeStrings, "frame_trigger", "idle_gap", "fixed_delay")
 
 PROGMEM_STRING_TABLE (QueuePolicyStrings, "replace_latest", "fifo")
 
constexpr uint8_t crc_length (CrcType type)
 
bool frame_has_prefix (std::span< const uint8_t > payload, const uint8_t *prefix, size_t len)
 True when payload starts with the len-byte prefix, which may live in PROGMEM.
 

Enumeration Type Documentation

◆ CrcType

Enumerator
CRC_TYPE_NONE 
CRC_TYPE_SUM8 
CRC_TYPE_SUM16_BIG_ENDIAN 
CRC_TYPE_SUM16_LITTLE_ENDIAN 
CRC_TYPE_XOR8 
CRC_TYPE_CRC16_MODBUS 

Definition at line 19 of file rs485_frame.h.

◆ CrcVariant

Enumerator
CRC_HEADER_INCLUSIVE 
CRC_PAYLOAD_ONLY 

Definition at line 18 of file rs485_frame.h.

◆ QueuePolicy

Enumerator
QUEUE_REPLACE_LATEST 
QUEUE_FIFO 

Definition at line 30 of file rs485_frame.h.

◆ RxState

The _DLE states mean the last byte was a DLE.

Enumerator
RX_STATE_IDLE 
RX_STATE_IDLE_DLE 
RX_STATE_FRAME 
RX_STATE_FRAME_DLE 

Definition at line 33 of file rs485_frame.h.

◆ TxGateMode

Enumerator
TX_GATE_FRAME_TRIGGER 
TX_GATE_IDLE_GAP 
TX_GATE_FIXED_DELAY 

Definition at line 31 of file rs485_frame.h.

Function Documentation

◆ crc_length()

uint8_t esphome::rs485_frame::crc_length ( CrcType type)
constexpr

Definition at line 27 of file rs485_frame.h.

◆ ESPHOME_LOG_TAG()

esphome::rs485_frame::ESPHOME_LOG_TAG ( TAG ,
"rs485_frame"  )

◆ frame_has_prefix()

bool esphome::rs485_frame::frame_has_prefix ( std::span< const uint8_t > payload,
const uint8_t * prefix,
size_t len )
inline

True when payload starts with the len-byte prefix, which may live in PROGMEM.

Definition at line 36 of file rs485_frame.h.

◆ PROGMEM_STRING_TABLE() [1/4]

esphome::rs485_frame::PROGMEM_STRING_TABLE ( CrcTypeStrings ,
"none" ,
"sum8" ,
"sum16_big_endian" ,
"sum16_little_endian" ,
"xor8" ,
"crc16_modbus"  )

◆ PROGMEM_STRING_TABLE() [2/4]

esphome::rs485_frame::PROGMEM_STRING_TABLE ( CrcVariantStrings ,
"header_inclusive" ,
"payload_only"  )

◆ PROGMEM_STRING_TABLE() [3/4]

esphome::rs485_frame::PROGMEM_STRING_TABLE ( GateModeStrings ,
"frame_trigger" ,
"idle_gap" ,
"fixed_delay"  )

◆ PROGMEM_STRING_TABLE() [4/4]

esphome::rs485_frame::PROGMEM_STRING_TABLE ( QueuePolicyStrings ,
"replace_latest" ,
"fifo"  )