Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
radio_soft_phy.h File Reference

Software PHY for radios without IoHomeOn hardware framing. More...

#include "radio_interface.h"
#include <cstdint>
Include dependency graph for radio_soft_phy.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  esphome::home_io_control::UartProbeResult
 Result of the UART probe: best candidate frame within a raw capture. More...

Namespaces

namespace  esphome
namespace  esphome::home_io_control

Functions

uint8_t esphome::home_io_control::decode_uart_probe (const uint8_t *raw, uint8_t raw_len, uint8_t bit_offset, uint8_t *decoded, uint8_t decoded_max_len)
 Decode a raw UART‑encoded bitstream into bytes.
UartProbeResult esphome::home_io_control::find_uart_probe (const uint8_t *raw, uint8_t raw_len)
 Search raw RX buffer for the best CRC-validated IO-Homecontrol frame.
bool esphome::home_io_control::is_known_io_command (uint8_t cmd)
 This list missing CMD_GET_GENERAL_INFO3_RESP (0x59) is exactly what turned a real Q2 probe reply into a false "no reply" timeout on real hardware (2026-08-16); the same audit also found CMD_IDENTIFY and CMD_WRITE_PRIVATE/CMD_WRITE_PRIVATE_ACK missing, unrelated to that probe but affecting the already-shipped identify_device() action (and climate writes) on SX1262/LR1121.
uint8_t esphome::home_io_control::soft_phy_raw_bytes_for_frame (uint8_t frame_len)
 Raw on-air bytes needed to carry a whole frame: frame_len protocol bytes plus the two trailing CRC bytes, each UART-packed into a 10-bit cell.
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.
uint32_t esphome::home_io_control::io868_tx_air_time_us (uint16_t preamble_len, uint8_t frame_len)
 Time on air of one 868 MHz transmission: preamble, sync word, and the frame plus its CRC, each byte of the latter a 10-bit UART cell, at the protocol's line rate.
uint8_t esphome::home_io_control::soft_phy_peek_frame_length (const uint8_t *raw, uint8_t raw_len)
 Recover a frame's total length from the very first UART cell of a reception.
uint8_t esphome::home_io_control::uart_encode_packet (const uint8_t *data, uint8_t len, uint8_t *encoded, uint8_t encoded_max_len)
 UART-encode a buffer of bytes (start bit 0, 8 data bits LSB-first, stop bit 1).

Variables

static constexpr uint8_t esphome::home_io_control::UART_CELL_BITS = 10
 Bits an on-air UART cell spends per protocol byte: start(1) + data(8) + stop(1).
static constexpr uint8_t esphome::home_io_control::UART_PROBE_MAX_BIT_OFFSET = 10
 Number of leading bit alignments the UART probe tries when locating a frame start.
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::IO868_SYNC_WORD_BYTES = 3
 Sync word bytes on air after the preamble (55 FF 33 on the SX1276, the UART-coded equivalent on the software PHY): three on every 868 MHz chip.

Detailed Description

Software PHY for radios without IoHomeOn hardware framing.

Chips such as the SX1262 and LR1121 have no hardware mode equivalent to the SX1276's IoHomeOn: they provide generic GFSK framing only. This header declares the chip-agnostic pieces such a driver needs to reproduce IO-Homecontrol framing in software — UART bit-encoding for TX, and a UART-decode probe (with CRC validation) to recover frame boundaries from an unaligned raw RX bitstream.

Definition in file radio_soft_phy.h.