1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//! SX126x Radio Driver
//!
//! This crate provides a type-safe interface for the Semtech SX1261/2 sub-GHz radio transceivers.
//! The SX1261/2 are highly integrated, long range, low power radio transceivers designed for use
//! in ISM band applications.
//!
//! # Features
//! - Frequency range: 150-960 MHz
//! - Modulation support:
//! - LoRa: SF5-12, BW 7.8-500kHz
//! - (G)FSK: BR 0.6-300kbps
//! - Output power:
//! - SX1261: -17 to +15 dBm
//! - SX1262: -9 to +22 dBm
//! - Receive sensitivity down to -148 dBm
//! - Integrated voltage regulation (DC-DC or LDO)
//! - Programmable DIO pins for interrupts and control
//!
//! # Architecture
//! The driver is organized into several modules:
//!
//! - [`device`]: Main device interface for hardware interaction
//! - Provides high-level API for register access and command execution
//! - Manages SPI communication with the radio
//!
//! - [`registers`]: Register definitions for direct hardware access
//! - [`registers::rf`]: RF-related registers (frequency, power, etc)
//! - [`registers::packet`]: Packet handling registers
//! - [`registers::dio`]: Digital I/O configuration registers
//! - [`registers::system`]: System configuration registers
//!
//! - [`commands`]: Command interface for radio control
//! - [`commands::rf`]: RF and modulation configuration
//! - [`commands::dio`]: DIO and interrupt control
//! - [`commands::operational`]: Operating mode control
//! - [`commands::status`]: Status monitoring and statistics
//!
//! # Usage
//! The driver uses the `regiface` crate to provide a type-safe interface
//! for register access and command execution. The main entry point is the
//! [`Device`] struct which wraps an SPI interface and provides methods for
//! interacting with the radio.
//!
//! Configuration follows a specific sequence:
//!
//! 1. Create a new [`Device`] instance with your SPI interface
//! 2. Set operating mode (STDBY_RC for configuration)
//! 3. Configure packet type (LoRa/FSK)
//! 4. Set RF frequency and modulation parameters
//! 5. Configure packet format and processing
//! 6. Set up DIO pins and interrupts
//! 7. Enter RX/TX mode for operation
//!
//! # Important Notes
//! - Most configuration must be done in STDBY_RC mode
//! - Packet type must be set before other RF configuration
//! - PA configuration depends on device type (SX1261/2)
//! - TCXO configuration requires special handling
//! - Some registers have interdependencies
//!
//! # Example
//! ```no_run
//! use embedded_hal::spi::SpiDevice;
//! use sx1262::{Device, commands::{SetStandby, StandbyConfig}, Error};
//!
//! fn configure_radio<SPI: SpiDevice>(spi: SPI) -> Result<Device<SPI>, Error> {
//! let mut device = Device::new(spi);
//!
//! // Set to STDBY_RC mode for configuration
//! device.execute_command( SetStandby { config: StandbyConfig::Rc})?;
//!
//! Ok(device)
//! }
//! ```
pub use Error;
use *;
pub use *;
pub use Device;
pub use *;