22 this->
stop_bit_ = data_bits + (parity ? 1 : 0);
44 if (level == last_level)
56 const bool pushed = this->
consume_run_(bits, last_level);
57 this->last_edge_ = now;
65 const uint8_t bit = this->
bit_;
76 const uint8_t bit = this->
bit_;
79 cur |= ((1U << this->
data_bits_) - 1) & ~((1U << bit) - 1);
85 bool ESPHOME_ALWAYS_INLINE
push_byte(uint8_t data) {
127 uint8_t bit = this->
bit_;
139 uint8_t n = this->data_bits_ - bit;
143 cur |= ((1U << n) - 1) << bit;
Software serial RX decoder: on_edge() counts bits from the time between edges; finalize() completes a...
bool ESPHOME_ALWAYS_INLINE consume_run_(uint32_t bits, bool level)
volatile uint8_t bit_
Next frame bit (data, parity, then stop at stop_bit_) or RX_IDLE.
bool finalize_due(uint32_t now) const
void finalize(uint32_t now)
Call with the ISR masked.
uint32_t tail_ticks_(uint8_t bit) const
volatile uint32_t last_edge_
size_t buffer_size() const
void setup(uint32_t bit_ticks, uint8_t data_bits, bool parity, uint8_t stop_bits, uint8_t *buffer, size_t buffer_size)
Configure framing and buffer; drops all state. Follow with reset().
volatile uint8_t cur_byte_
bool ESPHOME_ALWAYS_INLINE on_edge(uint32_t now, bool level)
ISR.
static constexpr uint8_t RX_IDLE
uint8_t peek_byte() const
void reset(uint32_t now, bool level)
Forget any partial frame; level is the current line level.
volatile bool last_level_
bool ESPHOME_ALWAYS_INLINE push_byte(uint8_t data)
Drops the byte when full; holds buffer_size - 1 bytes.