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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//! # API related to FSK operations
//!
//! This module provides an API for configuring and operating the LR2021 chip for FSK (Frequency Shift Keying) modulation.
//! This API is for a generic FSK modulation using a packet structure compatible with previous Semtech chips
//! (SX126x, SX127x, LR11xx). It supports fixed or dynamic length packets up to 511 bytes, with configurable
//! CRC, address filtering, and whitening.
//!
//! ## Quick Start
//!
//! Here's a typical sequence to initialize the chip for FSK operations:
//!
//! ```rust,no_run
//! use lr2021::radio::PacketType;
//! use lr2021::fsk::{PblLenDetect, PldLenUnit, AddrComp, FskPktFormat, Crc, BitOrder};
//! use lr2021::{PulseShape, RxBw};
//!
//! // Set packet type to FSK Legacy (compatible with SX126x/SX127x/LR11xx)
//! lr2021.set_packet_type(PacketType::FskLegacy).await.expect("Setting packet type");
//!
//! // Configure FSK modulation (250kbps, BT=0.5 pulse shaping, 444kHz bandwidth, 62.5kHz deviation)
//! lr2021.set_fsk_modulation(
//! 250_000, // Bitrate: 250 kbps
//! PulseShape::Bt0p5, // Pulse shaping: BT=0.5 Gaussian filter
//! RxBw::Bw444, // RX bandwidth: 444 kHz
//! 62500 // Frequency deviation: 62.5 kHz
//! ).await.expect("Setting FSK modulation");
//!
//! // Configure syncword (32-bit, LSB first)
//! lr2021.set_fsk_syncword(
//! 0xCD05DEAD, // Syncword value
//! BitOrder::LsbFirst, // Bit order: LSB first
//! 32 // Syncword length: 32 bits
//! ).await.expect("Setting syncword");
//!
//! // Configure packet parameters
//! lr2021.set_fsk_packet(
//! 8, // TX preamble length: 8 bits
//! PblLenDetect::None, // No specific preamble detection length
//! false, // No long preamble
//! PldLenUnit::Bytes, // Payload length unit: bytes
//! AddrComp::Off, // No address filtering
//! FskPktFormat::Variable8bit, // Variable length with 8-bit length field
//! 10, // Maximum payload length: 10 bytes
//! Crc::Crc2Byte, // 2-byte CRC
//! true // DC-free encoding enabled (whitening)
//! ).await.expect("Setting packet parameters");
//! ```
//!
//! ## Available Methods
//!
//! ### Core Configuration
//! - [`set_fsk_modulation`](Lr2021::set_fsk_modulation) - Configure bitrate, pulse shaping, bandwidth, and frequency deviation
//! - [`set_fsk_packet`](Lr2021::set_fsk_packet) - Set packet parameters (preamble, length format, CRC, addressing, whitening)
//! - [`set_fsk_syncword`](Lr2021::set_fsk_syncword) - Configure synchronization word (value, bit order, length)
//! - [`set_fsk_long_prmb_support`](Lr2021::set_fsk_long_prmb_support) - Enable long preamble support in FSK (more than 2048 symbols)
//!
//! ### Status and Statistics
//! - [`get_fsk_packet_status`](Lr2021::get_fsk_packet_status) - Get packet status information (length, RSSI, LQI)
//! - [`get_fsk_rx_stats`](Lr2021::get_fsk_rx_stats) - Get reception statistics (packets received, errors, sync failures)
use OutputPin;
use SpiBus;
pub use *;
use ;