Skip to main content

pamoja_radios/
sx126x.rs

1//! Semtech SX1261, SX1262, and LLCC68 transceivers.
2//!
3//! These radios are run by commands. The host sends an opcode and its parameters in one
4//! SPI transaction framed by NSS, and the chip holds its BUSY line high while it is still
5//! processing, so the host waits for BUSY to fall before every command. Chapter 11 of the
6//! SX1261/2 datasheet (Rev 2.2) lists the commands and chapter 13 details them. This
7//! module carries them as data:
8//!
9//! - [`command`] - the opcodes and the bytes each command sends.
10//! - [`irq`] - the interrupt bits of the IRQ register.
11//! - [`status`] - the status byte, the device errors, the receive buffer, and the LoRa
12//!   packet status, decoded with the datasheet's formulas.
13//! - [`config`] - the frequency word, timeouts, image calibration, the LoRa modulation
14//!   and packet parameters a [`LinkSettings`](pamoja_lora::LinkSettings) turns into, the
15//!   power amplifier settings, and the registers the chapter 15 workarounds touch.
16//!
17//! The SX1261 has a low power amplifier for up to +15 dBm, and the SX1262 and the LLCC68
18//! a high power one for up to +22 dBm; the SPI interface cannot tell them apart, so the
19//! caller names the amplifier. With the `embedded-hal` feature, the [`Sx126x`] driver puts
20//! the commands in the order chapter 14 gives for a transmission and a reception, with
21//! the chapter 15 workarounds applied.
22
23pub mod command;
24pub mod config;
25pub mod irq;
26pub mod status;
27
28#[cfg(feature = "embedded-hal")]
29mod driver;
30
31#[cfg(feature = "embedded-hal")]
32pub use driver::{
33    Board, RadioConfig, RadioError, Reception, Sx126x, BUSY_LIMIT_US, BUSY_POLL_US,
34    DEFAULT_TCXO_SETTLE_US, IRQ_POLL_US, RESET_HOLD_US, RESET_SETTLE_US, SLEEP_ENTRY_US,
35    TIMEOUT_MARGIN_US, WAKE_SETUP_NS,
36};