|
Home IO Control
ESPHome add-on for IO-Homecontrol devices
|
Shared driver flow for radios using the software PHY (SX1262, LR1121). More...
Go to the source code of this file.
Classes | |
| class | esphome::home_io_control::SoftPhyDriverBase |
| Shared RX/TX driver flow for the software-PHY radios (SX1262, LR1121). More... | |
Namespaces | |
| namespace | esphome |
| namespace | esphome::home_io_control |
Functions | |
| constexpr uint32_t | esphome::home_io_control::soft_phy_air_time_us (uint32_t raw_bytes) |
| On-air time in microseconds for raw_bytes bytes at the protocol's line rate. | |
Variables | |
| static constexpr uint8_t | esphome::home_io_control::SOFT_PHY_RX_PROBE_PACKET_LEN = 48 |
| Fixed raw-RX probe length: chosen from captures of 23-25 byte protocol frames after UART packing and CRC appending — the longest frame (25 bytes + 2 CRC) UART-packs to 34 raw bytes, so 48 bytes preserves complete traffic (with margin for leading noise before the frame start) without relying on either chip's variable-length engine. | |
| static constexpr uint32_t | esphome::home_io_control::SOFT_PHY_ALL_IRQ_BITS = 0xFFFFFFFF |
| Sentinel meaning "every IRQ bit counts as activity" — the default for SoftPhyDriverBase::activity_irq_mask, correct for chips (SX1262) whose hardware-level IRQ mask already excludes the one bit (PreambleDetected) that would need special handling. | |
| static constexpr uint8_t | esphome::home_io_control::SOFT_PHY_EARLY_HEADER_RAW_BYTES = 3 |
| Raw bytes read in the first stage of a length-driven receive — enough to hold CTRL0's UART cell (10 bits) at any of the probe's bit alignments (up to 9 bits of slack). | |
| static constexpr uint8_t | esphome::home_io_control::SOFT_PHY_EARLY_READ_MARGIN_BYTES = 2 |
| Air-time margin added before every mid-reception buffer read, in raw bytes. | |
| static constexpr uint32_t | esphome::home_io_control::SOFT_PHY_EARLY_POLL_US = 100 |
| Poll interval while waiting out a frame's remaining air time, in microseconds. | |
| static constexpr uint32_t | esphome::home_io_control::SOFT_PHY_EARLY_MIN_WINDOW_MS = 12 |
| Smallest receive window a length-driven receive will be attempted in, in milliseconds. | |
| static constexpr uint32_t | esphome::home_io_control::SOFT_PHY_LINE_RATE_BPS = 38400 |
| Protocol line rate. The same 38400 bps every driver programs into its own bitrate register. | |
| static constexpr uint32_t | esphome::home_io_control::SOFT_PHY_US_PER_SECOND = 1000000 |
| Microseconds in a second, for the air-time arithmetic below. | |
Shared driver flow for radios using the software PHY (SX1262, LR1121).
RadioSX1262 and RadioLR1121 both lack the SX1276's IoHomeOn hardware framing, so both reproduce IO-Homecontrol framing in software on top of generic GFSK support (radio_soft_phy.h's UART bit-encode/probe). Beyond that shared bit-level codec, the two drivers' IRQ-driven RX state machine and TX orchestration are identical in every detail that isn't chip-specific transport or register encoding, so this class holds that shared flow once instead of each driver maintaining its own copy.
This class holds everything the two drivers do identically: wait_for_packet()/ check_for_packet()'s IRQ polling and sync/RX-done race resolution, read_rx_packet()'s buffer-read and UART-probe recovery, send_packet()'s TX orchestration, read_rssi()'s formula, and the response-preamble/post-TX-settle tuning fields. What genuinely differs between the two chips — SPI opcode encoding/transport, IRQ bit values and word width, register-level packet/modulation parameter encoding, and the handful of one-off steps one chip needs that the other doesn't (SX1262's buffer-base-address write, LR1121's high-ACP pre-TX workaround and preamble-tolerant activity check) — stays behind virtual primitives and hooks implemented by RadioSX1262/RadioLR1121.
Definition in file radio_soft_phy_driver_base.h.