|
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 | |
| struct | esphome::home_io_control::DeviceErrorBit |
| One named bit of a chip's device-error word. More... | |
| class | esphome::home_io_control::SoftPhyDriverBase |
| Shared RX/TX driver flow for the software-PHY radios (SX1262, LR1121). More... | |
| struct | esphome::home_io_control::SoftPhyDriverBase::SoftPhyPacketParams |
| The GFSK SetPacketParams fields both software-PHY chips program identically. More... | |
Namespaces | |
| namespace | esphome |
| namespace | esphome::home_io_control |
Typedefs | |
| using | esphome::home_io_control::DeviceErrorFormatter = void (*)(uint16_t errors, char *buf, size_t buf_size) |
| A chip's own decoder, as passed to SoftPhyDriverBase::dump_init_device_errors_(). | |
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. | |
| void | esphome::home_io_control::format_device_error_bits (uint16_t errors, const DeviceErrorBit *bits, size_t bit_count, char *buf, size_t buf_size) |
| Expand a device-error word into a human-readable NAME|NAME|... string. | |
| template<size_t N> | |
| void | esphome::home_io_control::format_device_error_bits (uint16_t errors, const DeviceErrorBit(&bits)[N], char *buf, size_t buf_size) |
| Expand a device-error word into a human-readable NAME|NAME|... string. | |
Variables | |
| static constexpr uint8_t | esphome::home_io_control::SOFT_PHY_RX_PROBE_PACKET_LEN = 48 |
| Fixed raw-RX probe length. | |
| 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. | |
| 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_IDLE_RX_COMPLETION_BUDGET_MS = 20 |
| Blocking budget SoftPhyDriverBase::check_for_packet gives a length-driven receive, in milliseconds — the timeout_ms passed to try_early_completion_() from the non-blocking idle-loop RX path (issue #81). | |
| 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. | |
| static constexpr uint16_t | esphome::home_io_control::SOFT_PHY_MAX_WIRE_FRAME_BYTES |
| Largest real IO-Homecontrol frame the fixed-length RX probe has to recover intact: a 1W CMD 0x30 "add controller". | |
| static constexpr uint16_t | esphome::home_io_control::SOFT_PHY_MAX_WIRE_FRAME_RAW_BYTES |
| Raw on-air bytes that frame occupies once its 2-byte CRC is appended and the whole thing is UART-packed into 10-bit cells (start + 8 data + stop), rounded up to whole bytes — the same arithmetic as soft_phy_raw_bytes_for_frame(), spelled out here because that helper is not constexpr. | |
| static constexpr size_t | esphome::home_io_control::DEVICE_ERROR_STR_SIZE = 160 |
| Buffer size that always fits format_device_error_bits()'s longest output for either chip (every named bit, |-joined, plus an UNKNOWN_0x%04X tail). | |
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.