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

SX1262 radio driver implementation for IO-Homecontrol. More...

#include "radio_sx1262.h"
#include "log_frame.h"
#include "esphome/core/log.h"
#include "esphome/core/application.h"
Include dependency graph for radio_sx1262.cpp:

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

static uint8_t esphome::home_io_control::get_bit_msb (const uint8_t *data, uint16_t bit_pos)
 Extract a single bit (MSB‑first) from a byte buffer.
static 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.
static bool esphome::home_io_control::is_known_io_command (uint8_t cmd)
 Check if a command ID is one of the known IO‑Homecontrol commands.
static bool esphome::home_io_control::is_plausible_uart_frame (const IoFrame &frame, uint8_t candidate_len)
static UartProbeResult esphome::home_io_control::find_uart_probe (const uint8_t *raw, uint8_t raw_len)
 Search a raw capture for the most plausible IoFrame using UART decoding.

Variables

static const char *const esphome::home_io_control::TAG = "home_io_control.sx1262"
static const uint8_t esphome::home_io_control::SX1262_SYNC_WORD_PARAM_24_BITS = 0x18
static const uint8_t esphome::home_io_control::SX1262_RX_PROBE_PACKET_LEN = 32
static const uint8_t esphome::home_io_control::UART_PROBE_MAX_BIT_OFFSET = 10
 Maximum bit offset to search for valid UART decode start position.

Detailed Description

SX1262 radio driver implementation for IO-Homecontrol.

Unlike the SX1276, the SX1262 does not provide Semtech's IoHomeOn mode for IO-Homecontrol. On SX1276 that mode handles key protocol details in hardware: CRC generation and checking, packet boundary handling, and delivery of already-decoded protocol bytes in the FIFO. On SX1262 those pieces have to be reproduced in software on top of generic GFSK support.

Concretely, this driver has to:

  • append and verify the IO-Homecontrol CRC in software,
  • UART-pack frames for TX and recover UART-packed on-air bytes on RX,
  • detect plausible frame boundaries before handing bytes to the parser,
  • preserve raw capture data and metadata for debugging against the SX1276 baseline capture path.

The chip interface itself is also different: SX1262 uses opcode-based SPI instead of the SX1276 register model, and every transaction must respect the BUSY line. For experiment builds, the RX path prioritizes preserving the chip-reported bytes and metadata verbatim.

Definition in file radio_sx1262.cpp.