fh101rf/
registers.rs

1#![allow(clippy::unnecessary_cast)]
2#![allow(clippy::module_name_repetitions)]
3#![allow(unused_imports)]
4//! # `FH101RF` Registers.
5//!
6//! ## Infos
7//!
8//! Generated using reginald from `../../fh101rf.yaml`.
9//! 
10//! Listing file author: Jonah Imfeld, Silvano Cortesi
11//!
12//! Listing file notice:
13//!   Licensed under LGPL-3.0
14//!   File Version: 1.0.1
15//!
16//! ## Register Overview
17//! | Address | Name                 | Brief                                                                                                                                                                                          |
18//! | ------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
19//! | 0x00    | [`Nfa433Slow`]       | Set the sample-rate for preamble-listening (LDR-mode with FDD/IDM enabled) or single-sequence wake-up (FDD disabled) in the 433-MHz band.                                                      |
20//! | 0x01    | [`Nfa433Fast`]       | Set the sample-rate for FDD-mode data reception in the 433-MHz band.                                                                                                                           |
21//! | 0x02    | [`Nfa868Slow`]       | Set the sample-rate for preamble-listening (LDR-mode with FDD/IDM enabled) or single-sequence wake-up (FDD disabled) in the 868-MHz band.                                                      |
22//! | 0x03    | [`Nfa868Fast`]       | Set the sample-rate for FDD-mode data reception in the 868-MHz band.                                                                                                                           |
23//! | 0x04    | [`Nfa2g4Slow`]       | Set the sample-rate for preamble-listening (LDR-mode with FDD/IDM enabled) or single-sequence wake-up (FDD disabled) in the 2.4-GHz band.                                                      |
24//! | 0x05    | [`Nfa2g4Fast`]       | Set the sample-rate for FDD-mode data reception in the 2.4-GHz band.                                                                                                                           |
25//! | 0x06    | [`CalibStatus`]      | Indicates status of all calibration processes.                                                                                                                                                 |
26//! | 0x07    | [`CalibCtrl`]        | Control register for starting calibration processes.                                                                                                                                           |
27//! | 0x09    | [`NSpgTarget`]       | Target register for the Signal Processing Gain setting. Set to 0x46 during SPG calibration.                                                                                                    |
28//! | 0x0B    | [`NLcoTarget433Hi`]  | Sets the high byte (15:8) target freqency for the 433-MHz band. N_LCO_TARGET_<band> × 4 × 32,768 Hz; Values between 3304 and 3891. (According to register table in DS v1.3b, only 12:8).       |
29//! | 0x0C    | [`NLcoTarget433Lo`]  | Sets the low byte (7:0) target freqency for the 433-MHz band. N_LCO_TARGET_<band> × 4 × 32,768 Hz; Values between 3304 and 3891.                                                               |
30//! | 0x0D    | [`NLcoTarget868Hi`]  | Sets the high byte (15:8) target freqency for the 868/915-MHz band. N_LCO_TARGET_<band> × 8 × 32,768 Hz; Values between 3281 and 3738. (According to register table in DS v1.3b, only 12:8).   |
31//! | 0x0E    | [`NLcoTarget868Lo`]  | Sets the low byte (7:0) target freqency for the 868/915-MHz band. N_LCO_TARGET_<band> × 8 × 32,768 Hz; Values between 3281 and 3738.                                                           |
32//! | 0x0F    | [`NLcoTarget2g4Hi`]  | Sets the high byte (15:8) target freqency for the 2.4-GHz band. N_LCO_TARGET_<band> × 16 × 32,768 Hz; Values between 4482 and 4833. (According to register table in DS v1.3b, only 12:8).      |
33//! | 0x10    | [`NLcoTarget2g4Lo`]  | Sets the low byte (7:0) target freqency for the 2.4-GHz band. N_LCO_TARGET_<band> × 16 × 32,768 Hz; Values between 4482 and 4833.                                                              |
34//! | 0x14    | [`LcoFreq433Hi`]     | Holds the current frequency of the 433-MHz band, high byte (15:8). Read the registers in the given order from 0x14 to 0x19. (According to register table in DS v1.3b, only 12:8).              |
35//! | 0x15    | [`LcoFreq433Lo`]     | Holds the current frequency of the 433-MHz band, low byte (7:0). Read the registers in the given order from 0x14 to 0x19.                                                                      |
36//! | 0x16    | [`LcoFreq868Hi`]     | Holds the current frequency of the 868/915-MHz band, high byte (15:8). Read the registers in the given order from 0x14 to 0x19. (According to register table in DS v1.3b, only 12:8).          |
37//! | 0x17    | [`LcoFreq868Lo`]     | Holds the current frequency of the 868/915-MHz band, low byte (7:0). Read the registers in the given order from 0x14 to 0x19.                                                                  |
38//! | 0x18    | [`LcoFreq2g4Hi`]     | Holds the current frequency of the 2.4-GHz band, high byte (15:8). Read the registers in the given order from 0x14 to 0x19. (According to register table in DS v1.3b, only 12:8).              |
39//! | 0x19    | [`LcoFreq2g4Lo`]     | Holds the current frequency of the 2.4-GHz band, low byte (7:0). Read the registers in the given order from 0x14 to 0x19.                                                                      |
40//! | 0x23    | [`DCornerCtrl`]      | Set to 0x02 at power-up.                                                                                                                                                                       |
41//! | 0x24    | [`BandBranchCtrl`]   | Selects the active bands and branches (RF-sensitivity).                                                                                                                                        |
42//! | 0x28    | [`CodeSelect`]       | Selects the correlation patterns for code A and B.                                                                                                                                             |
43//! | 0x29    | [`KorrelThreshA`]    | Sets the threshold for a code A match. Useful values are between 0x19 and 0x1E. Lower values correspond to more tolerated bit errors (can lead to false wake-up detections).                   |
44//! | 0x2A    | [`KorrelThreshB`]    | Sets the threshold for a code B match. Useful values are between 0x19 and 0x1E. Lower values correspond to more tolerated bit errors (can lead to false wake-up detections).                   |
45//! | 0x2B    | [`KorrelState`]      |                                                                                                                                                                                                |
46//! | 0x2C    | [`KorrelVal`]        | Indicates the match level for code A and B. A value of 15 indicates no bit errors, a value of 0 indicates 15 bit errors.                                                                       |
47//! | 0x2D    | [`FddEnable`]        | Enable the fast data decoder for a given band.                                                                                                                                                 |
48//! | 0x2E    | [`FddActive`]        | Reads the FDD mode for each band.                                                                                                                                                              |
49//! | 0x2F    | [`FoQuit`]           | Forces the specified band to quit fast mode immediately.                                                                                                                                       |
50//! | 0x30    | [`FddExitCond`]      | Holds the FDD exit condition for all the bands.                                                                                                                                                |
51//! | 0x31    | [`IrqSelect`]        | Selects the interrupt sources.                                                                                                                                                                 |
52//! | 0x32    | [`IrqStatus`]        | Holds the status of the IRQ events.                                                                                                                                                            |
53//! | 0x33    | [`IrqClr`]           | Resets the corresponding IRQ event bit.                                                                                                                                                        |
54//! | 0x34    | [`IrqSet`]           | Sets the corresponding IRQ event bit (triggers IRQ events for debugging).                                                                                                                      |
55//! | 0x35    | [`IdHi`]             | Sets the high byte of the match ID. 4-MSB form the group ID.                                                                                                                                   |
56//! | 0x36    | [`IdLo`]             | Sets the low byte of the match ID.                                                                                                                                                             |
57//! | 0x37    | [`IdmEnable`]        | Enables the ID match for a given band.                                                                                                                                                         |
58//! | 0x38    | [`IdmCtrl`]          | Slect the type of ID's accepted by the receiver.                                                                                                                                               |
59//! | 0x39    | [`IdmClr`]           | Clear the FDD_EXIT_COND register.                                                                                                                                                              |
60//! | 0x3A    | [`IdmBand`]          | Indicates the frequency band of the ID match event.                                                                                                                                            |
61//! | 0x3B    | [`IdmReason`]        | Indicates the type of ID match event.                                                                                                                                                          |
62//! | 0x3C    | [`RtcSelect`]        | Allows for selection of the desired timer modes.                                                                                                                                               |
63//! | 0x3D    | [`RtcStatus`]        | Indicates occurence of RTC events.                                                                                                                                                             |
64//! | 0x3E    | [`RtcClr`]           | Clears the respective event entries in RTC_STATUS.                                                                                                                                             |
65//! | 0x3F    | [`Rtcsh0ThreshHi`]   | Upper (Bits 15:8) byte of the RTCSH0 threshold.                                                                                                                                                |
66//! | 0x40    | [`Rtcsh0ThreshLo`]   | Lower (Bits 7:0) byte of the RTCSH0 threshold.                                                                                                                                                 |
67//! | 0x41    | [`Rtcsh1ThreshHi`]   | Upper (Bits 15:8) byte of the RTCSH1 threshold.                                                                                                                                                |
68//! | 0x42    | [`Rtcsh1ThreshLo`]   | Lower (Bits 7:0) byte of the RTCSH1 threshold.                                                                                                                                                 |
69//! | 0x43    | [`Rtclg0Thresh4`]    | Bits 39:32 of the RTCLG0 threshold.                                                                                                                                                            |
70//! | 0x44    | [`Rtclg0Thresh3`]    | Bits 31:24 of the RTCLG0 threshold.                                                                                                                                                            |
71//! | 0x45    | [`Rtclg0Thresh2`]    | Bits 23:16 of the RTCLG0 threshold.                                                                                                                                                            |
72//! | 0x46    | [`Rtclg0Thresh1`]    | Bits 15:8 of the RTCLG0 threshold.                                                                                                                                                             |
73//! | 0x47    | [`Rtclg0Thresh0`]    | Bits 7:0 of the RTCLG0 threshold.                                                                                                                                                              |
74//! | 0x48    | [`Rtclg1Thresh4`]    | Bits 39:32 of the RTCLG1 threshold.                                                                                                                                                            |
75//! | 0x49    | [`Rtclg1Thresh3`]    | Bits 31:24 of the RTCLG1 threshold.                                                                                                                                                            |
76//! | 0x4A    | [`Rtclg1Thresh2`]    | Bits 23:16 of the RTCLG1 threshold.                                                                                                                                                            |
77//! | 0x4B    | [`Rtclg1Thresh1`]    | Bits 15:8 of the RTCLG1 threshold.                                                                                                                                                             |
78//! | 0x4C    | [`Rtclg1Thresh0`]    | Bits 7:0 of the RTCLG1 threshold.                                                                                                                                                              |
79//! | 0x4D    | [`Cyclpresc`]        | Cycle prescaler for cyclic counter, system clock divided by prescaler (therefore max 8:29.9922 minutes).                                                                                       |
80//! | 0x4E    | [`CycltopHi`]        | Bits 15:8 defining the maximal cyclic counter value CYCLTOP before being reset to zero.                                                                                                        |
81//! | 0x4F    | [`CycltopLo`]        | Bits 7:0 defining the maximal cyclic counter value CYCLTOP before being reset to zero.                                                                                                         |
82//! | 0x50    | [`Cntr404`]          | Bits 39:32 of the system clock counter CNTR40.                                                                                                                                                 |
83//! | 0x51    | [`Cntr403`]          | Bits 31:24 of the system clock counter CNTR40.                                                                                                                                                 |
84//! | 0x52    | [`Cntr402`]          | Bits 23:16 of the system clock counter CNTR40.                                                                                                                                                 |
85//! | 0x53    | [`Cntr401`]          | Bits 15:8 of the system clock counter CNTR40.                                                                                                                                                  |
86//! | 0x54    | [`Cntr400`]          | Bits 7:0 of the system clock counter CNTR40.                                                                                                                                                   |
87//! | 0x55    | [`Cntr40Clr`]        | Clear the system clock counter CNTR40 by setting this to true. Manually setting the register to false afterwards is mandatory!                                                                 |
88//! | 0x56    | [`FifoLength`]       | Selects the FIFO length for each band.                                                                                                                                                         |
89//! | 0x57    | [`FifoCount433`]     | Number of bits in the FIFO buffer for the 433MHz band. Can be cleared by writing 0.                                                                                                            |
90//! | 0x58    | [`FifoCount868`]     | Number of bits in the FIFO buffer for the 868/915MHz band. Can be cleared by writing 0.                                                                                                        |
91//! | 0x59    | [`FifoCount2g4`]     | Number of bits in the FIFO buffer for the 2.4GHz band. Can be cleared by writing 0.                                                                                                            |
92//! | 0x5A    | [`RxFifo5433`]       | The FIFO byte 5 for the 433MHz band, _5 is filled first.                                                                                                                                       |
93//! | 0x5B    | [`RxFifo4433`]       | The FIFO byte 4 for the 433MHz band, _5 is filled first.                                                                                                                                       |
94//! | 0x5C    | [`RxFifo3433`]       | The FIFO byte 3 for the 433MHz band, _5 is filled first.                                                                                                                                       |
95//! | 0x5D    | [`RxFifo2433`]       | The FIFO byte 2 for the 433MHz band, _5 is filled first.                                                                                                                                       |
96//! | 0x5E    | [`RxFifo1433`]       | The FIFO byte 1 for the 433MHz band, _5 is filled first.                                                                                                                                       |
97//! | 0x5F    | [`RxFifo0433`]       | The FIFO byte 0 for the 433MHz band, _5 is filled first.                                                                                                                                       |
98//! | 0x60    | [`RxFifo5868`]       | The FIFO byte 5 for the 868MHz band, _5 is filled first.                                                                                                                                       |
99//! | 0x61    | [`RxFifo4868`]       | The FIFO byte 4 for the 868MHz band, _5 is filled first.                                                                                                                                       |
100//! | 0x62    | [`RxFifo3868`]       | The FIFO byte 3 for the 868MHz band, _5 is filled first.                                                                                                                                       |
101//! | 0x63    | [`RxFifo2868`]       | The FIFO byte 2 for the 868MHz band, _5 is filled first.                                                                                                                                       |
102//! | 0x64    | [`RxFifo1868`]       | The FIFO byte 1 for the 868MHz band, _5 is filled first.                                                                                                                                       |
103//! | 0x65    | [`RxFifo0868`]       | The FIFO byte 0 for the 868MHz band, _5 is filled first.                                                                                                                                       |
104//! | 0x66    | [`RxFifo52g4`]       | The FIFO byte 5 for the 2.4GHz band, _5 is filled first.                                                                                                                                       |
105//! | 0x67    | [`RxFifo42g4`]       | The FIFO byte 4 for the 2.4GHz band, _5 is filled first.                                                                                                                                       |
106//! | 0x68    | [`RxFifo32g4`]       | The FIFO byte 3 for the 2.4GHz band, _5 is filled first.                                                                                                                                       |
107//! | 0x69    | [`RxFifo22g4`]       | The FIFO byte 2 for the 2.4GHz band, _5 is filled first.                                                                                                                                       |
108//! | 0x6A    | [`RxFifo12g4`]       | The FIFO byte 1 for the 2.4GHz band, _5 is filled first.                                                                                                                                       |
109//! | 0x6B    | [`RxFifo02g4`]       | The FIFO byte 0 for the 2.4GHz band, _5 is filled first.                                                                                                                                       |
110//! | 0x6C    | [`ActualNfa433`]     | This register contains the actual NFA (sampling rate) value that is currently valid for 433MHz data reception.                                                                                 |
111//! | 0x6D    | [`ActualNfa868`]     | This register contains the actual NFA (sampling rate) value that is currently valid for 868MHz data reception.                                                                                 |
112//! | 0x6E    | [`ActualNfa2g4`]     | This register contains the actual NFA (sampling rate) value that is currently valid for 2.4GHz data reception.                                                                                 |
113//! | 0x6F    | [`ActualBandselect`] | This 3 bit register contains the actual selected frequency bands that are currently used.                                                                                                      |
114//! | 0x71    | [`Genpurp1`]         | 8 bits free to use for read/write. (Register table says only write).                                                                                                                           |
115//! | 0x73    | [`XtalOscCtrl`]      | Enables the built-in crystal oscillator driving a 2-pin crystal device.                                                                                                                        |
116//! | 0x74    | [`LdoXtalCtrl`]      | Controls the LDO and the crystal oscillator.                                                                                                                                                   |
117//! | 0x75    | [`MuxDOutSel`]       | Selects the signal routed to the GPO1 and GPO2 pins.                                                                                                                                           |
118//! | 0x76    | [`LcTgEna`]          | Set to 0x00 during power-up.                                                                                                                                                                   |
119//! | 0x77    | [`XtalGood`]         | Reads as true if the clock source is stable.                                                                                                                                                   |
120//! | 0x78    | [`CompThreshW`]      | Set this register to 0xA before executing the comparator calibration.                                                                                                                          |
121//! | 0x7C    | [`KorrelSvClear`]    | Set true to clear the KORREL_STATE and KORREL_VAL registers.                                                                                                                                   |
122//! | 0x7F    | [`Version`]          | Holds the version number of the IC, currently 0x41.                                                                                                                                            |
123
124// ==== Traits =================================================================
125
126use core::convert::Infallible;
127use core::fmt::{Debug, Display};
128
129// Struct to bytes converstion:
130pub trait ToBytes<const N: usize>: Sized {
131    fn to_le_bytes(&self) -> [u8; N];
132
133    #[inline(always)]
134    fn to_be_bytes(&self) -> [u8; N] {
135        let mut val = self.to_le_bytes();
136        val.reverse();
137        val
138    }
139}
140
141// Bytes to struct conversion (fallible):
142pub trait TryFromBytes<const N: usize>: Sized {
143    type Error;
144
145    fn try_from_le_bytes(val: &[u8; N]) -> Result<Self, Self::Error>;
146
147    #[inline(always)]
148    fn try_from_be_bytes(val: &[u8; N]) -> Result<Self, Self::Error> {
149        let mut val = *val;
150        val.reverse();
151        Self::try_from_le_bytes(&val)
152    }
153}
154
155// Bytes to struct conversion (infallible):
156pub trait FromBytes<const N: usize>: Sized {
157    fn from_le_bytes(val: &[u8; N]) -> Self;
158
159    #[inline(always)]
160    fn from_be_bytes(val: &[u8; N]) -> Self {
161        let mut val = *val;
162        val.reverse();
163        Self::from_le_bytes(&val)
164    }
165}
166
167// Implement fallible conversion for infallible conversion:
168impl<const N: usize, T> TryFromBytes<N> for T
169where
170    T: FromBytes<N>,
171{
172    type Error = Infallible;
173
174    #[inline(always)]
175    fn try_from_le_bytes(val: &[u8; N]) -> Result<Self, Self::Error> {
176        Ok(Self::from_le_bytes(val))
177    }
178
179    #[inline(always)]
180    fn try_from_be_bytes(val: &[u8; N]) -> Result<Self, Self::Error> {
181        Ok(Self::from_be_bytes(val))
182    }
183}
184
185// Bytes to struct conversion (infallible, but possibly lossy):
186pub trait FromMaskedBytes<const N: usize>: Sized {
187    fn from_masked_le_bytes(val: &[u8; N]) -> Self;
188
189    #[inline(always)]
190    fn from_masked_be_bytes(val: &[u8; N]) -> Self {
191        let mut val = *val;
192        val.reverse();
193        Self::from_masked_le_bytes(&val)
194    }
195}
196
197// Implement possibly conversion for infallible conversion:
198impl<const N: usize, T> FromMaskedBytes<N> for T
199where
200    T: FromBytes<N>,
201{
202    fn from_masked_le_bytes(val: &[u8; N]) -> Self {
203        Self::from_le_bytes(val)
204    }
205
206    #[inline(always)]
207    fn from_masked_be_bytes(val: &[u8; N]) -> Self {
208        Self::from_be_bytes(val)
209    }
210}
211
212// Errors:
213#[derive(Debug, PartialEq, Clone)]
214pub struct FromBytesError {
215    pub pos: usize,
216}
217
218impl Display for FromBytesError {
219    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
220        write!(f, "Failed to unpack field at bit {}", self.pos)
221    }
222}
223
224// Register properties:
225pub enum ResetVal<const N: usize> {
226    BigEndian([u8; N]),
227    LittleEndian([u8; N]),
228}
229
230pub trait Register<const N: usize, A> {
231    const ADDRESS: A;
232    const RESET_VAL: Option<ResetVal<N>>;
233
234    fn reset_val_le() -> Option<[u8; N]> {
235        match Self::RESET_VAL {
236            None => None,
237            Some(ResetVal::LittleEndian(val_le)) => Some(val_le),
238            Some(ResetVal::BigEndian(val)) => {
239                let mut val = val;
240                val.reverse();
241                Some(val)
242            }
243        }
244    }
245
246    fn reset_val_be() -> Option<[u8; N]> {
247        match Self::RESET_VAL {
248            None => None,
249            Some(ResetVal::LittleEndian(val)) => {
250                let mut val = val;
251                val.reverse();
252                Some(val)
253            }
254            Some(ResetVal::BigEndian(val_be)) => Some(val_be),
255        }
256    }
257}
258
259// ==== `NFA433_SLOW` Register =================================================
260
261/// `NFA433_SLOW` Register
262///
263/// Address: 0x0
264///
265/// Reset Value: 0x5
266///
267/// Set the sample-rate for preamble-listening (LDR-mode with FDD/IDM enabled) or single-sequence wake-up (FDD disabled) in the 433-MHz band.
268#[derive(Debug, PartialEq)]
269pub struct Nfa433Slow {
270    /// Bits: `[2:0]`
271    pub data: SampleRate,
272}
273
274/// Register Properties
275impl Register<1, u8> for Nfa433Slow {
276    const ADDRESS: u8 = 0x0;
277    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x5]));
278}
279
280/// Reset Value
281impl Default for Nfa433Slow {
282    fn default() -> Self {
283        Self {
284            data: SampleRate::Sr1024,
285        }
286    }
287}
288
289// ==== `NFA433_FAST` Register =================================================
290
291/// `NFA433_FAST` Register
292///
293/// Address: 0x1
294///
295/// Reset Value: 0x0
296///
297/// Set the sample-rate for FDD-mode data reception in the 433-MHz band.
298#[derive(Debug, PartialEq)]
299pub struct Nfa433Fast {
300    /// Bits: `[2:0]`
301    pub data: SampleRate,
302}
303
304/// Register Properties
305impl Register<1, u8> for Nfa433Fast {
306    const ADDRESS: u8 = 0x1;
307    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
308}
309
310/// Reset Value
311impl Default for Nfa433Fast {
312    fn default() -> Self {
313        Self {
314            data: SampleRate::Sr32768,
315        }
316    }
317}
318
319// ==== `NFA868_SLOW` Register =================================================
320
321/// `NFA868_SLOW` Register
322///
323/// Address: 0x2
324///
325/// Reset Value: 0x5
326///
327/// Set the sample-rate for preamble-listening (LDR-mode with FDD/IDM enabled) or single-sequence wake-up (FDD disabled) in the 868-MHz band.
328#[derive(Debug, PartialEq)]
329pub struct Nfa868Slow {
330    /// Bits: `[2:0]`
331    pub data: SampleRate,
332}
333
334/// Register Properties
335impl Register<1, u8> for Nfa868Slow {
336    const ADDRESS: u8 = 0x2;
337    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x5]));
338}
339
340/// Reset Value
341impl Default for Nfa868Slow {
342    fn default() -> Self {
343        Self {
344            data: SampleRate::Sr1024,
345        }
346    }
347}
348
349// ==== `NFA868_FAST` Register =================================================
350
351/// `NFA868_FAST` Register
352///
353/// Address: 0x3
354///
355/// Reset Value: 0x0
356///
357/// Set the sample-rate for FDD-mode data reception in the 868-MHz band.
358#[derive(Debug, PartialEq)]
359pub struct Nfa868Fast {
360    /// Bits: `[2:0]`
361    pub data: SampleRate,
362}
363
364/// Register Properties
365impl Register<1, u8> for Nfa868Fast {
366    const ADDRESS: u8 = 0x3;
367    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
368}
369
370/// Reset Value
371impl Default for Nfa868Fast {
372    fn default() -> Self {
373        Self {
374            data: SampleRate::Sr32768,
375        }
376    }
377}
378
379// ==== `NFA2G4_SLOW` Register =================================================
380
381/// `NFA2G4_SLOW` Register
382///
383/// Address: 0x4
384///
385/// Reset Value: 0x5
386///
387/// Set the sample-rate for preamble-listening (LDR-mode with FDD/IDM enabled) or single-sequence wake-up (FDD disabled) in the 2.4-GHz band.
388#[derive(Debug, PartialEq)]
389pub struct Nfa2g4Slow {
390    /// Bits: `[2:0]`
391    pub data: SampleRate,
392}
393
394/// Register Properties
395impl Register<1, u8> for Nfa2g4Slow {
396    const ADDRESS: u8 = 0x4;
397    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x5]));
398}
399
400/// Reset Value
401impl Default for Nfa2g4Slow {
402    fn default() -> Self {
403        Self {
404            data: SampleRate::Sr1024,
405        }
406    }
407}
408
409// ==== `NFA2G4_FAST` Register =================================================
410
411/// `NFA2G4_FAST` Register
412///
413/// Address: 0x5
414///
415/// Reset Value: 0x0
416///
417/// Set the sample-rate for FDD-mode data reception in the 2.4-GHz band.
418#[derive(Debug, PartialEq)]
419pub struct Nfa2g4Fast {
420    /// Bits: `[2:0]`
421    pub data: SampleRate,
422}
423
424/// Register Properties
425impl Register<1, u8> for Nfa2g4Fast {
426    const ADDRESS: u8 = 0x5;
427    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
428}
429
430/// Reset Value
431impl Default for Nfa2g4Fast {
432    fn default() -> Self {
433        Self {
434            data: SampleRate::Sr32768,
435        }
436    }
437}
438
439// ==== `CALIB_STATUS` Register ================================================
440
441/// `CALIB_STATUS` Register
442///
443/// Address: 0x6
444///
445/// Reset Value: 0x0
446///
447/// Indicates status of all calibration processes.
448#[derive(Debug, PartialEq)]
449pub struct CalibStatus {
450    /// Indicates general calibration process in progress.
451    ///
452    /// Bits: `[0]`
453    pub cal_in_prog: bool,
454    /// Indicates LCO calibration in progress.
455    ///
456    /// Bits: `[1]`
457    pub lco_cal_in_prog: bool,
458    /// Indicates Offset calubration in progress.
459    ///
460    /// Bits: `[3]`
461    pub offset_cal_in_prog: bool,
462    /// Indicates SPG calibration in progress.
463    ///
464    /// Bits: `[2]`
465    pub spg_cal_in_prog: bool,
466}
467
468/// Register Properties
469impl Register<1, u8> for CalibStatus {
470    const ADDRESS: u8 = 0x6;
471    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
472}
473
474/// Reset Value
475impl Default for CalibStatus {
476    fn default() -> Self {
477        Self {
478            cal_in_prog: false,
479            lco_cal_in_prog: false,
480            offset_cal_in_prog: false,
481            spg_cal_in_prog: false,
482        }
483    }
484}
485
486// ==== `CALIB_CTRL` Register ==================================================
487
488/// `CALIB_CTRL` Register
489///
490/// Address: 0x7
491///
492/// Reset Value: 0xE
493///
494/// Control register for starting calibration processes.
495#[derive(Debug, PartialEq)]
496pub struct CalibCtrl {
497    /// Starts the calibration process.
498    ///
499    /// Bits: `[0]`
500    pub cal_start: bool,
501    /// Control bit for initiating LCO calibration.
502    ///
503    /// Bits: `[1]`
504    pub lco_cal: bool,
505    /// Control bit for initiating offset calibration.
506    ///
507    /// Bits: `[3]`
508    pub offset_cal: bool,
509    /// Control bit for initiating SPG calibration.
510    ///
511    /// Bits: `[2]`
512    pub spg_cal: bool,
513}
514
515/// Register Properties
516impl Register<1, u8> for CalibCtrl {
517    const ADDRESS: u8 = 0x7;
518    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0xE]));
519}
520
521/// Reset Value
522impl Default for CalibCtrl {
523    fn default() -> Self {
524        Self {
525            cal_start: false,
526            lco_cal: true,
527            offset_cal: true,
528            spg_cal: true,
529        }
530    }
531}
532
533// ==== `N_SPG_TARGET` Register ================================================
534
535/// `N_SPG_TARGET` Register
536///
537/// Address: 0x9
538///
539/// Reset Value: 0x31
540///
541/// Target register for the Signal Processing Gain setting. Set to 0x46 during SPG calibration.
542#[derive(Debug, PartialEq)]
543pub struct NSpgTarget {
544    /// Bits: `[7:0]`
545    pub data: u8,
546}
547
548/// Register Properties
549impl Register<1, u8> for NSpgTarget {
550    const ADDRESS: u8 = 0x9;
551    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x31]));
552}
553
554/// Reset Value
555impl Default for NSpgTarget {
556    fn default() -> Self {
557        Self {
558            data: 0x31,
559        }
560    }
561}
562
563// ==== `N_LCO_TARGET_433_HI` Register =========================================
564
565/// `N_LCO_TARGET_433_HI` Register
566///
567/// Address: 0xB
568///
569/// Reset Value: 0xE
570///
571/// Sets the high byte (15:8) target freqency for the 433-MHz band. N_LCO_TARGET_<band> × 4 × 32,768 Hz; Values between 3304 and 3891. (According to register table in DS v1.3b, only 12:8).
572#[derive(Debug, PartialEq)]
573pub struct NLcoTarget433Hi {
574    /// Bits: `[7:0]`
575    pub data: u8,
576}
577
578/// Register Properties
579impl Register<1, u8> for NLcoTarget433Hi {
580    const ADDRESS: u8 = 0xB;
581    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0xE]));
582}
583
584/// Reset Value
585impl Default for NLcoTarget433Hi {
586    fn default() -> Self {
587        Self {
588            data: 0xE,
589        }
590    }
591}
592
593// ==== `N_LCO_TARGET_433_LO` Register =========================================
594
595/// `N_LCO_TARGET_433_LO` Register
596///
597/// Address: 0xC
598///
599/// Reset Value: 0x20
600///
601/// Sets the low byte (7:0) target freqency for the 433-MHz band. N_LCO_TARGET_<band> × 4 × 32,768 Hz; Values between 3304 and 3891.
602#[derive(Debug, PartialEq)]
603pub struct NLcoTarget433Lo {
604    /// Bits: `[7:0]`
605    pub data: u8,
606}
607
608/// Register Properties
609impl Register<1, u8> for NLcoTarget433Lo {
610    const ADDRESS: u8 = 0xC;
611    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x20]));
612}
613
614/// Reset Value
615impl Default for NLcoTarget433Lo {
616    fn default() -> Self {
617        Self {
618            data: 0x20,
619        }
620    }
621}
622
623// ==== `N_LCO_TARGET_868_HI` Register =========================================
624
625/// `N_LCO_TARGET_868_HI` Register
626///
627/// Address: 0xD
628///
629/// Reset Value: 0xD
630///
631/// Sets the high byte (15:8) target freqency for the 868/915-MHz band. N_LCO_TARGET_<band> × 8 × 32,768 Hz; Values between 3281 and 3738. (According to register table in DS v1.3b, only 12:8).
632#[derive(Debug, PartialEq)]
633pub struct NLcoTarget868Hi {
634    /// Bits: `[7:0]`
635    pub data: u8,
636}
637
638/// Register Properties
639impl Register<1, u8> for NLcoTarget868Hi {
640    const ADDRESS: u8 = 0xD;
641    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0xD]));
642}
643
644/// Reset Value
645impl Default for NLcoTarget868Hi {
646    fn default() -> Self {
647        Self {
648            data: 0xD,
649        }
650    }
651}
652
653// ==== `N_LCO_TARGET_868_LO` Register =========================================
654
655/// `N_LCO_TARGET_868_LO` Register
656///
657/// Address: 0xE
658///
659/// Reset Value: 0x87
660///
661/// Sets the low byte (7:0) target freqency for the 868/915-MHz band. N_LCO_TARGET_<band> × 8 × 32,768 Hz; Values between 3281 and 3738.
662#[derive(Debug, PartialEq)]
663pub struct NLcoTarget868Lo {
664    /// Bits: `[7:0]`
665    pub data: u8,
666}
667
668/// Register Properties
669impl Register<1, u8> for NLcoTarget868Lo {
670    const ADDRESS: u8 = 0xE;
671    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x87]));
672}
673
674/// Reset Value
675impl Default for NLcoTarget868Lo {
676    fn default() -> Self {
677        Self {
678            data: 0x87,
679        }
680    }
681}
682
683// ==== `N_LCO_TARGET_2G4_HI` Register =========================================
684
685/// `N_LCO_TARGET_2G4_HI` Register
686///
687/// Address: 0xF
688///
689/// Reset Value: 0x12
690///
691/// Sets the high byte (15:8) target freqency for the 2.4-GHz band. N_LCO_TARGET_<band> × 16 × 32,768 Hz; Values between 4482 and 4833. (According to register table in DS v1.3b, only 12:8).
692#[derive(Debug, PartialEq)]
693pub struct NLcoTarget2g4Hi {
694    /// Bits: `[7:0]`
695    pub data: u8,
696}
697
698/// Register Properties
699impl Register<1, u8> for NLcoTarget2g4Hi {
700    const ADDRESS: u8 = 0xF;
701    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x12]));
702}
703
704/// Reset Value
705impl Default for NLcoTarget2g4Hi {
706    fn default() -> Self {
707        Self {
708            data: 0x12,
709        }
710    }
711}
712
713// ==== `N_LCO_TARGET_2G4_LO` Register =========================================
714
715/// `N_LCO_TARGET_2G4_LO` Register
716///
717/// Address: 0x10
718///
719/// Reset Value: 0xCE
720///
721/// Sets the low byte (7:0) target freqency for the 2.4-GHz band. N_LCO_TARGET_<band> × 16 × 32,768 Hz; Values between 4482 and 4833.
722#[derive(Debug, PartialEq)]
723pub struct NLcoTarget2g4Lo {
724    /// Bits: `[7:0]`
725    pub data: u8,
726}
727
728/// Register Properties
729impl Register<1, u8> for NLcoTarget2g4Lo {
730    const ADDRESS: u8 = 0x10;
731    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0xCE]));
732}
733
734/// Reset Value
735impl Default for NLcoTarget2g4Lo {
736    fn default() -> Self {
737        Self {
738            data: 0xCE,
739        }
740    }
741}
742
743// ==== `LCO_FREQ_433_HI` Register =============================================
744
745/// `LCO_FREQ_433_HI` Register
746///
747/// Address: 0x14
748///
749/// Reset Value: 0x0
750///
751/// Holds the current frequency of the 433-MHz band, high byte (15:8). Read the registers in the given order from 0x14 to 0x19. (According to register table in DS v1.3b, only 12:8).
752#[derive(Debug, PartialEq)]
753pub struct LcoFreq433Hi {
754    /// Bits: `[7:0]`
755    pub data: u8,
756}
757
758/// Register Properties
759impl Register<1, u8> for LcoFreq433Hi {
760    const ADDRESS: u8 = 0x14;
761    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
762}
763
764/// Reset Value
765impl Default for LcoFreq433Hi {
766    fn default() -> Self {
767        Self {
768            data: 0x0,
769        }
770    }
771}
772
773// ==== `LCO_FREQ_433_LO` Register =============================================
774
775/// `LCO_FREQ_433_LO` Register
776///
777/// Address: 0x15
778///
779/// Reset Value: 0x0
780///
781/// Holds the current frequency of the 433-MHz band, low byte (7:0). Read the registers in the given order from 0x14 to 0x19.
782#[derive(Debug, PartialEq)]
783pub struct LcoFreq433Lo {
784    /// Bits: `[7:0]`
785    pub data: u8,
786}
787
788/// Register Properties
789impl Register<1, u8> for LcoFreq433Lo {
790    const ADDRESS: u8 = 0x15;
791    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
792}
793
794/// Reset Value
795impl Default for LcoFreq433Lo {
796    fn default() -> Self {
797        Self {
798            data: 0x0,
799        }
800    }
801}
802
803// ==== `LCO_FREQ_868_HI` Register =============================================
804
805/// `LCO_FREQ_868_HI` Register
806///
807/// Address: 0x16
808///
809/// Reset Value: 0x0
810///
811/// Holds the current frequency of the 868/915-MHz band, high byte (15:8). Read the registers in the given order from 0x14 to 0x19. (According to register table in DS v1.3b, only 12:8).
812#[derive(Debug, PartialEq)]
813pub struct LcoFreq868Hi {
814    /// Bits: `[7:0]`
815    pub data: u8,
816}
817
818/// Register Properties
819impl Register<1, u8> for LcoFreq868Hi {
820    const ADDRESS: u8 = 0x16;
821    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
822}
823
824/// Reset Value
825impl Default for LcoFreq868Hi {
826    fn default() -> Self {
827        Self {
828            data: 0x0,
829        }
830    }
831}
832
833// ==== `LCO_FREQ_868_LO` Register =============================================
834
835/// `LCO_FREQ_868_LO` Register
836///
837/// Address: 0x17
838///
839/// Reset Value: 0x0
840///
841/// Holds the current frequency of the 868/915-MHz band, low byte (7:0). Read the registers in the given order from 0x14 to 0x19.
842#[derive(Debug, PartialEq)]
843pub struct LcoFreq868Lo {
844    /// Bits: `[7:0]`
845    pub data: u8,
846}
847
848/// Register Properties
849impl Register<1, u8> for LcoFreq868Lo {
850    const ADDRESS: u8 = 0x17;
851    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
852}
853
854/// Reset Value
855impl Default for LcoFreq868Lo {
856    fn default() -> Self {
857        Self {
858            data: 0x0,
859        }
860    }
861}
862
863// ==== `LCO_FREQ_2G4_HI` Register =============================================
864
865/// `LCO_FREQ_2G4_HI` Register
866///
867/// Address: 0x18
868///
869/// Reset Value: 0x0
870///
871/// Holds the current frequency of the 2.4-GHz band, high byte (15:8). Read the registers in the given order from 0x14 to 0x19. (According to register table in DS v1.3b, only 12:8).
872#[derive(Debug, PartialEq)]
873pub struct LcoFreq2g4Hi {
874    /// Bits: `[7:0]`
875    pub data: u8,
876}
877
878/// Register Properties
879impl Register<1, u8> for LcoFreq2g4Hi {
880    const ADDRESS: u8 = 0x18;
881    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
882}
883
884/// Reset Value
885impl Default for LcoFreq2g4Hi {
886    fn default() -> Self {
887        Self {
888            data: 0x0,
889        }
890    }
891}
892
893// ==== `LCO_FREQ_2G4_LO` Register =============================================
894
895/// `LCO_FREQ_2G4_LO` Register
896///
897/// Address: 0x19
898///
899/// Reset Value: 0x0
900///
901/// Holds the current frequency of the 2.4-GHz band, low byte (7:0). Read the registers in the given order from 0x14 to 0x19.
902#[derive(Debug, PartialEq)]
903pub struct LcoFreq2g4Lo {
904    /// Bits: `[7:0]`
905    pub data: u8,
906}
907
908/// Register Properties
909impl Register<1, u8> for LcoFreq2g4Lo {
910    const ADDRESS: u8 = 0x19;
911    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
912}
913
914/// Reset Value
915impl Default for LcoFreq2g4Lo {
916    fn default() -> Self {
917        Self {
918            data: 0x0,
919        }
920    }
921}
922
923// ==== `D_CORNER_CTRL` Register ===============================================
924
925/// `D_CORNER_CTRL` Register
926///
927/// Address: 0x23
928///
929/// Reset Value: 0x0
930///
931/// Set to 0x02 at power-up.
932#[derive(Debug, PartialEq)]
933pub struct DCornerCtrl {
934    /// Bits: `[7:0]`
935    pub data: u8,
936}
937
938/// Register Properties
939impl Register<1, u8> for DCornerCtrl {
940    const ADDRESS: u8 = 0x23;
941    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
942}
943
944/// Reset Value
945impl Default for DCornerCtrl {
946    fn default() -> Self {
947        Self {
948            data: 0x0,
949        }
950    }
951}
952
953// ==== `BAND_BRANCH_CTRL` Register ============================================
954
955/// `BAND_BRANCH_CTRL` Register
956///
957/// Address: 0x24
958///
959/// Reset Value: 0x77
960///
961/// Selects the active bands and branches (RF-sensitivity).
962#[derive(Debug, PartialEq)]
963pub struct BandBranchCtrl {
964    /// Selects the active bands.
965    ///
966    /// Bits: `[6:4]`
967    pub active_bands: Bands,
968    /// Selects the active detection branches.
969    ///
970    /// Bits: `[2:0]`
971    pub active_branches: Branches,
972}
973
974/// Register Properties
975impl Register<1, u8> for BandBranchCtrl {
976    const ADDRESS: u8 = 0x24;
977    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x77]));
978}
979
980/// Reset Value
981impl Default for BandBranchCtrl {
982    fn default() -> Self {
983        Self {
984            active_bands: Bands {
985                band_2g4: true,
986                band_433: true,
987                band_868: true,
988            },
989            active_branches: Branches {
990                medium: true,
991                strong: true,
992                weak: true,
993            },
994        }
995    }
996}
997
998// ==== `CODE_SELECT` Register =================================================
999
1000/// `CODE_SELECT` Register
1001///
1002/// Address: 0x28
1003///
1004/// Reset Value: 0x10
1005///
1006/// Selects the correlation patterns for code A and B.
1007#[derive(Debug, PartialEq)]
1008pub struct CodeSelect {
1009    /// Selects the correlation pattern for code A.
1010    ///
1011    /// Bits: `[3:0]`
1012    pub a: BinCode,
1013    /// Selects the correlation pattern for code B.
1014    ///
1015    /// Bits: `[7:4]`
1016    pub b: BinCode,
1017}
1018
1019/// Register Properties
1020impl Register<1, u8> for CodeSelect {
1021    const ADDRESS: u8 = 0x28;
1022    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x10]));
1023}
1024
1025/// Reset Value
1026impl Default for CodeSelect {
1027    fn default() -> Self {
1028        Self {
1029            a: BinCode::A,
1030            b: BinCode::B,
1031        }
1032    }
1033}
1034
1035// ==== `KORREL_THRESH_A` Register =============================================
1036
1037/// `KORREL_THRESH_A` Register
1038///
1039/// Address: 0x29
1040///
1041/// Reset Value: 0x1A
1042///
1043/// Sets the threshold for a code A match. Useful values are between 0x19 and 0x1E. Lower values correspond to more tolerated bit errors (can lead to false wake-up detections).
1044#[derive(Debug, PartialEq)]
1045pub struct KorrelThreshA {
1046    /// Bits: `[4:0]`
1047    pub data: u8,
1048}
1049
1050/// Register Properties
1051impl Register<1, u8> for KorrelThreshA {
1052    const ADDRESS: u8 = 0x29;
1053    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x1A]));
1054}
1055
1056/// Reset Value
1057impl Default for KorrelThreshA {
1058    fn default() -> Self {
1059        Self {
1060            data: 0x1A,
1061        }
1062    }
1063}
1064
1065// ==== `KORREL_THRESH_B` Register =============================================
1066
1067/// `KORREL_THRESH_B` Register
1068///
1069/// Address: 0x2A
1070///
1071/// Reset Value: 0x1A
1072///
1073/// Sets the threshold for a code B match. Useful values are between 0x19 and 0x1E. Lower values correspond to more tolerated bit errors (can lead to false wake-up detections).
1074#[derive(Debug, PartialEq)]
1075pub struct KorrelThreshB {
1076    /// Bits: `[4:0]`
1077    pub data: u8,
1078}
1079
1080/// Register Properties
1081impl Register<1, u8> for KorrelThreshB {
1082    const ADDRESS: u8 = 0x2A;
1083    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x1A]));
1084}
1085
1086/// Reset Value
1087impl Default for KorrelThreshB {
1088    fn default() -> Self {
1089        Self {
1090            data: 0x1A,
1091        }
1092    }
1093}
1094
1095// ==== `KORREL_STATE` Register ================================================
1096
1097/// `KORREL_STATE` Register
1098///
1099/// Address: 0x2B
1100///
1101/// Reset Value: 0xC0
1102#[derive(Debug, PartialEq)]
1103pub struct KorrelState {
1104    /// Indicates receiver branch that had contributed for Code A recognition
1105    ///
1106    /// Bits: `[2:0]`
1107    pub korrel_branches_a: Branches,
1108    /// Indicates receiver branch that had contributed for Code B recognition
1109    ///
1110    /// Bits: `[5:3]`
1111    pub korrel_branches_b: Branches,
1112    /// Indicates frequency band for latest correlator
1113    ///
1114    /// Bits: `[7:6]`
1115    pub korrel_branches_latest: KorrelBranchesLatest,
1116}
1117
1118// Register-specific sub-layouts:
1119/// Indicates frequency band for latest correlator
1120#[derive(Clone, Copy, Debug, PartialEq)]
1121pub enum KorrelBranchesLatest {
1122    /// Band 2.4GHz matched.
1123    Band2g4, // 0x2
1124    /// Band 433MHz matched.
1125    Band433, // 0x0
1126    /// Band 868/915MHz matched.
1127    Band868, // 0x1
1128}
1129
1130/// Register Properties
1131impl Register<1, u8> for KorrelState {
1132    const ADDRESS: u8 = 0x2B;
1133    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0xC0]));
1134}
1135
1136// ==== `KORREL_VAL` Register ==================================================
1137
1138/// `KORREL_VAL` Register
1139///
1140/// Address: 0x2C
1141///
1142/// Reset Value: 0x0
1143///
1144/// Indicates the match level for code A and B. A value of 15 indicates no bit errors, a value of 0 indicates 15 bit errors.
1145#[derive(Debug, PartialEq)]
1146pub struct KorrelVal {
1147    /// Indicates the match level for code A. Refreshed after a positive Code A match. Typically >5
1148    ///
1149    /// Bits: `[3:0]`
1150    pub a: u8,
1151    /// Indicates the match level for code B. Refreshed after a positive Code B match. Typically >5
1152    ///
1153    /// Bits: `[7:4]`
1154    pub b: u8,
1155}
1156
1157/// Register Properties
1158impl Register<1, u8> for KorrelVal {
1159    const ADDRESS: u8 = 0x2C;
1160    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1161}
1162
1163/// Reset Value
1164impl Default for KorrelVal {
1165    fn default() -> Self {
1166        Self {
1167            a: 0x0,
1168            b: 0x0,
1169        }
1170    }
1171}
1172
1173// ==== `FDD_ENABLE` Register ==================================================
1174
1175/// `FDD_ENABLE` Register
1176///
1177/// Address: 0x2D
1178///
1179/// Reset Value: 0x7
1180///
1181/// Enable the fast data decoder for a given band.
1182#[derive(Debug, PartialEq)]
1183pub struct FddEnable {
1184    /// Bits: `[2:0]`
1185    pub fdd_bands: Bands,
1186}
1187
1188/// Register Properties
1189impl Register<1, u8> for FddEnable {
1190    const ADDRESS: u8 = 0x2D;
1191    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x7]));
1192}
1193
1194/// Reset Value
1195impl Default for FddEnable {
1196    fn default() -> Self {
1197        Self {
1198            fdd_bands: Bands {
1199                band_2g4: true,
1200                band_433: true,
1201                band_868: true,
1202            },
1203        }
1204    }
1205}
1206
1207// ==== `FDD_ACTIVE` Register ==================================================
1208
1209/// `FDD_ACTIVE` Register
1210///
1211/// Address: 0x2E
1212///
1213/// Reset Value: 0x0
1214///
1215/// Reads the FDD mode for each band.
1216#[derive(Debug, PartialEq)]
1217pub struct FddActive {
1218    /// Bits: `[0]`
1219    pub band_2g4: FddMode,
1220    /// Bits: `[2]`
1221    pub band_433: FddMode,
1222    /// Bits: `[1]`
1223    pub band_868: FddMode,
1224}
1225
1226/// Register Properties
1227impl Register<1, u8> for FddActive {
1228    const ADDRESS: u8 = 0x2E;
1229    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1230}
1231
1232/// Reset Value
1233impl Default for FddActive {
1234    fn default() -> Self {
1235        Self {
1236            band_2g4: FddMode::Slow,
1237            band_433: FddMode::Slow,
1238            band_868: FddMode::Slow,
1239        }
1240    }
1241}
1242
1243// ==== `FO_QUIT` Register =====================================================
1244
1245/// `FO_QUIT` Register
1246///
1247/// Address: 0x2F
1248///
1249/// Reset Value: 0x0
1250///
1251/// Forces the specified band to quit fast mode immediately.
1252#[derive(Debug, PartialEq)]
1253pub struct FoQuit {
1254    /// Bits: `[2:0]`
1255    pub quit_bands: Bands,
1256}
1257
1258/// Register Properties
1259impl Register<1, u8> for FoQuit {
1260    const ADDRESS: u8 = 0x2F;
1261    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1262}
1263
1264/// Reset Value
1265impl Default for FoQuit {
1266    fn default() -> Self {
1267        Self {
1268            quit_bands: Bands {
1269                band_2g4: false,
1270                band_433: false,
1271                band_868: false,
1272            },
1273        }
1274    }
1275}
1276
1277// ==== `FDD_EXIT_COND` Register ===============================================
1278
1279/// `FDD_EXIT_COND` Register
1280///
1281/// Address: 0x30
1282///
1283/// Reset Value: 0x0
1284///
1285/// Holds the FDD exit condition for all the bands.
1286#[derive(Debug, PartialEq)]
1287pub struct FddExitCond {
1288    /// Bits: `[5:4]`
1289    pub band_2g4: ExitCond,
1290    /// Bits: `[1:0]`
1291    pub band_433: ExitCond,
1292    /// Bits: `[3:2]`
1293    pub band_868: ExitCond,
1294}
1295
1296/// Register Properties
1297impl Register<1, u8> for FddExitCond {
1298    const ADDRESS: u8 = 0x30;
1299    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1300}
1301
1302/// Reset Value
1303impl Default for FddExitCond {
1304    fn default() -> Self {
1305        Self {
1306            band_2g4: ExitCond::NoReason,
1307            band_433: ExitCond::NoReason,
1308            band_868: ExitCond::NoReason,
1309        }
1310    }
1311}
1312
1313// ==== `IRQ_SELECT` Register ==================================================
1314
1315/// `IRQ_SELECT` Register
1316///
1317/// Address: 0x31
1318///
1319/// Reset Value: 0x1
1320///
1321/// Selects the interrupt sources.
1322#[derive(Debug, PartialEq)]
1323pub struct IrqSelect {
1324    /// Bits: `[7:0]`
1325    pub irq_select: IrqSource,
1326}
1327
1328/// Register Properties
1329impl Register<1, u8> for IrqSelect {
1330    const ADDRESS: u8 = 0x31;
1331    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x1]));
1332}
1333
1334/// Reset Value
1335impl Default for IrqSelect {
1336    fn default() -> Self {
1337        Self {
1338            irq_select: IrqSource {
1339                correl_match: false,
1340                cyclic_timer_alarm: false,
1341                fifo_full: false,
1342                fifo_overflow: false,
1343                id_match: true,
1344                id_match_and_fifo_full: false,
1345                id_match_and_ldr: false,
1346                rtc_timer_alarm: false,
1347            },
1348        }
1349    }
1350}
1351
1352// ==== `IRQ_STATUS` Register ==================================================
1353
1354/// `IRQ_STATUS` Register
1355///
1356/// Address: 0x32
1357///
1358/// Reset Value: 0x0
1359///
1360/// Holds the status of the IRQ events.
1361#[derive(Debug, PartialEq)]
1362pub struct IrqStatus {
1363    /// Bits: `[7:0]`
1364    pub irq_status: IrqSource,
1365}
1366
1367/// Register Properties
1368impl Register<1, u8> for IrqStatus {
1369    const ADDRESS: u8 = 0x32;
1370    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1371}
1372
1373/// Reset Value
1374impl Default for IrqStatus {
1375    fn default() -> Self {
1376        Self {
1377            irq_status: IrqSource {
1378                correl_match: false,
1379                cyclic_timer_alarm: false,
1380                fifo_full: false,
1381                fifo_overflow: false,
1382                id_match: false,
1383                id_match_and_fifo_full: false,
1384                id_match_and_ldr: false,
1385                rtc_timer_alarm: false,
1386            },
1387        }
1388    }
1389}
1390
1391// ==== `IRQ_CLR` Register =====================================================
1392
1393/// `IRQ_CLR` Register
1394///
1395/// Address: 0x33
1396///
1397/// Reset Value: 0x0
1398///
1399/// Resets the corresponding IRQ event bit.
1400#[derive(Debug, PartialEq)]
1401pub struct IrqClr {
1402    /// Bits: `[7:0]`
1403    pub irq_clr: IrqSource,
1404}
1405
1406/// Register Properties
1407impl Register<1, u8> for IrqClr {
1408    const ADDRESS: u8 = 0x33;
1409    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1410}
1411
1412/// Reset Value
1413impl Default for IrqClr {
1414    fn default() -> Self {
1415        Self {
1416            irq_clr: IrqSource {
1417                correl_match: false,
1418                cyclic_timer_alarm: false,
1419                fifo_full: false,
1420                fifo_overflow: false,
1421                id_match: false,
1422                id_match_and_fifo_full: false,
1423                id_match_and_ldr: false,
1424                rtc_timer_alarm: false,
1425            },
1426        }
1427    }
1428}
1429
1430// ==== `IRQ_SET` Register =====================================================
1431
1432/// `IRQ_SET` Register
1433///
1434/// Address: 0x34
1435///
1436/// Reset Value: 0x0
1437///
1438/// Sets the corresponding IRQ event bit (triggers IRQ events for debugging).
1439#[derive(Debug, PartialEq)]
1440pub struct IrqSet {
1441    /// Bits: `[7:0]`
1442    pub irq_set: IrqSource,
1443}
1444
1445/// Register Properties
1446impl Register<1, u8> for IrqSet {
1447    const ADDRESS: u8 = 0x34;
1448    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1449}
1450
1451/// Reset Value
1452impl Default for IrqSet {
1453    fn default() -> Self {
1454        Self {
1455            irq_set: IrqSource {
1456                correl_match: false,
1457                cyclic_timer_alarm: false,
1458                fifo_full: false,
1459                fifo_overflow: false,
1460                id_match: false,
1461                id_match_and_fifo_full: false,
1462                id_match_and_ldr: false,
1463                rtc_timer_alarm: false,
1464            },
1465        }
1466    }
1467}
1468
1469// ==== `ID_HI` Register =======================================================
1470
1471/// `ID_HI` Register
1472///
1473/// Address: 0x35
1474///
1475/// Reset Value: 0x7D
1476///
1477/// Sets the high byte of the match ID. 4-MSB form the group ID.
1478#[derive(Debug, PartialEq)]
1479pub struct IdHi {
1480    /// Bits: `[7:0]`
1481    pub data: u8,
1482}
1483
1484/// Register Properties
1485impl Register<1, u8> for IdHi {
1486    const ADDRESS: u8 = 0x35;
1487    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x7D]));
1488}
1489
1490/// Reset Value
1491impl Default for IdHi {
1492    fn default() -> Self {
1493        Self {
1494            data: 0x7D,
1495        }
1496    }
1497}
1498
1499// ==== `ID_LO` Register =======================================================
1500
1501/// `ID_LO` Register
1502///
1503/// Address: 0x36
1504///
1505/// Reset Value: 0xA8
1506///
1507/// Sets the low byte of the match ID.
1508#[derive(Debug, PartialEq)]
1509pub struct IdLo {
1510    /// Bits: `[7:0]`
1511    pub data: u8,
1512}
1513
1514/// Register Properties
1515impl Register<1, u8> for IdLo {
1516    const ADDRESS: u8 = 0x36;
1517    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0xA8]));
1518}
1519
1520/// Reset Value
1521impl Default for IdLo {
1522    fn default() -> Self {
1523        Self {
1524            data: 0xA8,
1525        }
1526    }
1527}
1528
1529// ==== `IDM_ENABLE` Register ==================================================
1530
1531/// `IDM_ENABLE` Register
1532///
1533/// Address: 0x37
1534///
1535/// Reset Value: 0x7
1536///
1537/// Enables the ID match for a given band.
1538#[derive(Debug, PartialEq)]
1539pub struct IdmEnable {
1540    /// Bits: `[2:0]`
1541    pub match_bands: Bands,
1542}
1543
1544/// Register Properties
1545impl Register<1, u8> for IdmEnable {
1546    const ADDRESS: u8 = 0x37;
1547    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x7]));
1548}
1549
1550/// Reset Value
1551impl Default for IdmEnable {
1552    fn default() -> Self {
1553        Self {
1554            match_bands: Bands {
1555                band_2g4: true,
1556                band_433: true,
1557                band_868: true,
1558            },
1559        }
1560    }
1561}
1562
1563// ==== `IDM_CTRL` Register ====================================================
1564
1565/// `IDM_CTRL` Register
1566///
1567/// Address: 0x38
1568///
1569/// Reset Value: 0x0
1570///
1571/// Slect the type of ID's accepted by the receiver.
1572#[derive(Debug, PartialEq)]
1573pub struct IdmCtrl {
1574    /// Bits: `[1:0]`
1575    pub ctrl: Ctrl,
1576}
1577
1578// Register-specific sub-layouts:
1579#[derive(Clone, Copy, Debug, PartialEq)]
1580pub enum Ctrl {
1581    /// only broadcast ID.
1582    BroadOnly, // 0x2
1583    /// individual 16 bit ID or groupwise ID.
1584    IndGroup, // 0x1
1585    /// individual 16 bit ID, groupwise ID, or broadcast ID.
1586    IndGroupBroad, // 0x3
1587    /// only individual 16 bit ID.
1588    IndOnly, // 0x0
1589}
1590
1591/// Register Properties
1592impl Register<1, u8> for IdmCtrl {
1593    const ADDRESS: u8 = 0x38;
1594    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1595}
1596
1597/// Reset Value
1598impl Default for IdmCtrl {
1599    fn default() -> Self {
1600        Self {
1601            ctrl: Ctrl::IndOnly,
1602        }
1603    }
1604}
1605
1606// ==== `IDM_CLR` Register =====================================================
1607
1608/// `IDM_CLR` Register
1609///
1610/// Address: 0x39
1611///
1612/// Reset Value: 0x0
1613///
1614/// Clear the FDD_EXIT_COND register.
1615#[derive(Debug, PartialEq)]
1616pub struct IdmClr {
1617    /// Bits: `[0]`
1618    pub branch: bool,
1619}
1620
1621/// Register Properties
1622impl Register<1, u8> for IdmClr {
1623    const ADDRESS: u8 = 0x39;
1624    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1625}
1626
1627/// Reset Value
1628impl Default for IdmClr {
1629    fn default() -> Self {
1630        Self {
1631            branch: false,
1632        }
1633    }
1634}
1635
1636// ==== `IDM_BAND` Register ====================================================
1637
1638/// `IDM_BAND` Register
1639///
1640/// Address: 0x3A
1641///
1642/// Reset Value: 0x3
1643///
1644/// Indicates the frequency band of the ID match event.
1645#[derive(Debug, PartialEq)]
1646pub struct IdmBand {
1647    /// Bits: `[1:0]`
1648    pub data: Data,
1649}
1650
1651// Register-specific sub-layouts:
1652#[derive(Clone, Copy, Debug, PartialEq)]
1653pub enum Data {
1654    Band2g4, // 0x2
1655    Band433, // 0x0
1656    Band868, // 0x1
1657}
1658
1659/// Register Properties
1660impl Register<1, u8> for IdmBand {
1661    const ADDRESS: u8 = 0x3A;
1662    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x3]));
1663}
1664
1665// ==== `IDM_REASON` Register ==================================================
1666
1667/// `IDM_REASON` Register
1668///
1669/// Address: 0x3B
1670///
1671/// Reset Value: 0x0
1672///
1673/// Indicates the type of ID match event.
1674#[derive(Debug, PartialEq)]
1675pub struct IdmReason {
1676    /// Bits: `[1:0]`
1677    pub reason: Reason,
1678}
1679
1680// Register-specific sub-layouts:
1681#[derive(Clone, Copy, Debug, PartialEq)]
1682pub enum Reason {
1683    /// Broadcast ID
1684    BroadMatch, // 0x3
1685    /// Group ID
1686    GroupMatch, // 0x2
1687    /// Individual ID
1688    IndMatch, // 0x1
1689    /// Unspecified reason
1690    Unknown, // 0x0
1691}
1692
1693/// Register Properties
1694impl Register<1, u8> for IdmReason {
1695    const ADDRESS: u8 = 0x3B;
1696    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1697}
1698
1699/// Reset Value
1700impl Default for IdmReason {
1701    fn default() -> Self {
1702        Self {
1703            reason: Reason::Unknown,
1704        }
1705    }
1706}
1707
1708// ==== `RTC_SELECT` Register ==================================================
1709
1710/// `RTC_SELECT` Register
1711///
1712/// Address: 0x3C
1713///
1714/// Reset Value: 0x0
1715///
1716/// Allows for selection of the desired timer modes.
1717#[derive(Debug, PartialEq)]
1718pub struct RtcSelect {
1719    /// Selects the cyclic counter (CYCLTOP).
1720    ///
1721    /// Bits: `[4]`
1722    pub cycltop: bool,
1723    /// Bits: `[3:0]`
1724    pub rtc_select: Rtc,
1725}
1726
1727/// Register Properties
1728impl Register<1, u8> for RtcSelect {
1729    const ADDRESS: u8 = 0x3C;
1730    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1731}
1732
1733/// Reset Value
1734impl Default for RtcSelect {
1735    fn default() -> Self {
1736        Self {
1737            cycltop: false,
1738            rtc_select: Rtc {
1739                rtclg0: false,
1740                rtclg1: false,
1741                rtcsh0: false,
1742                rtcsh1: false,
1743            },
1744        }
1745    }
1746}
1747
1748// ==== `RTC_STATUS` Register ==================================================
1749
1750/// `RTC_STATUS` Register
1751///
1752/// Address: 0x3D
1753///
1754/// Reset Value: 0x0
1755///
1756/// Indicates occurence of RTC events.
1757#[derive(Debug, PartialEq)]
1758pub struct RtcStatus {
1759    /// Bits: `[3:0]`
1760    pub rtc_select: Rtc,
1761}
1762
1763/// Register Properties
1764impl Register<1, u8> for RtcStatus {
1765    const ADDRESS: u8 = 0x3D;
1766    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1767}
1768
1769/// Reset Value
1770impl Default for RtcStatus {
1771    fn default() -> Self {
1772        Self {
1773            rtc_select: Rtc {
1774                rtclg0: false,
1775                rtclg1: false,
1776                rtcsh0: false,
1777                rtcsh1: false,
1778            },
1779        }
1780    }
1781}
1782
1783// ==== `RTC_CLR` Register =====================================================
1784
1785/// `RTC_CLR` Register
1786///
1787/// Address: 0x3E
1788///
1789/// Reset Value: 0x0
1790///
1791/// Clears the respective event entries in RTC_STATUS.
1792#[derive(Debug, PartialEq)]
1793pub struct RtcClr {
1794    /// Bits: `[3:0]`
1795    pub rtc_clr: Rtc,
1796}
1797
1798/// Register Properties
1799impl Register<1, u8> for RtcClr {
1800    const ADDRESS: u8 = 0x3E;
1801    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1802}
1803
1804/// Reset Value
1805impl Default for RtcClr {
1806    fn default() -> Self {
1807        Self {
1808            rtc_clr: Rtc {
1809                rtclg0: false,
1810                rtclg1: false,
1811                rtcsh0: false,
1812                rtcsh1: false,
1813            },
1814        }
1815    }
1816}
1817
1818// ==== `RTCSH0_THRESH_HI` Register ============================================
1819
1820/// `RTCSH0_THRESH_HI` Register
1821///
1822/// Address: 0x3F
1823///
1824/// Reset Value: 0x0
1825///
1826/// Upper (Bits 15:8) byte of the RTCSH0 threshold.
1827#[derive(Debug, PartialEq)]
1828pub struct Rtcsh0ThreshHi {
1829    /// Bits: `[7:0]`
1830    pub data: u8,
1831}
1832
1833/// Register Properties
1834impl Register<1, u8> for Rtcsh0ThreshHi {
1835    const ADDRESS: u8 = 0x3F;
1836    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1837}
1838
1839/// Reset Value
1840impl Default for Rtcsh0ThreshHi {
1841    fn default() -> Self {
1842        Self {
1843            data: 0x0,
1844        }
1845    }
1846}
1847
1848// ==== `RTCSH0_THRESH_LO` Register ============================================
1849
1850/// `RTCSH0_THRESH_LO` Register
1851///
1852/// Address: 0x40
1853///
1854/// Reset Value: 0x0
1855///
1856/// Lower (Bits 7:0) byte of the RTCSH0 threshold.
1857#[derive(Debug, PartialEq)]
1858pub struct Rtcsh0ThreshLo {
1859    /// Bits: `[7:0]`
1860    pub data: u8,
1861}
1862
1863/// Register Properties
1864impl Register<1, u8> for Rtcsh0ThreshLo {
1865    const ADDRESS: u8 = 0x40;
1866    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1867}
1868
1869/// Reset Value
1870impl Default for Rtcsh0ThreshLo {
1871    fn default() -> Self {
1872        Self {
1873            data: 0x0,
1874        }
1875    }
1876}
1877
1878// ==== `RTCSH1_THRESH_HI` Register ============================================
1879
1880/// `RTCSH1_THRESH_HI` Register
1881///
1882/// Address: 0x41
1883///
1884/// Reset Value: 0x0
1885///
1886/// Upper (Bits 15:8) byte of the RTCSH1 threshold.
1887#[derive(Debug, PartialEq)]
1888pub struct Rtcsh1ThreshHi {
1889    /// Bits: `[7:0]`
1890    pub data: u8,
1891}
1892
1893/// Register Properties
1894impl Register<1, u8> for Rtcsh1ThreshHi {
1895    const ADDRESS: u8 = 0x41;
1896    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1897}
1898
1899/// Reset Value
1900impl Default for Rtcsh1ThreshHi {
1901    fn default() -> Self {
1902        Self {
1903            data: 0x0,
1904        }
1905    }
1906}
1907
1908// ==== `RTCSH1_THRESH_LO` Register ============================================
1909
1910/// `RTCSH1_THRESH_LO` Register
1911///
1912/// Address: 0x42
1913///
1914/// Reset Value: 0x0
1915///
1916/// Lower (Bits 7:0) byte of the RTCSH1 threshold.
1917#[derive(Debug, PartialEq)]
1918pub struct Rtcsh1ThreshLo {
1919    /// Bits: `[7:0]`
1920    pub data: u8,
1921}
1922
1923/// Register Properties
1924impl Register<1, u8> for Rtcsh1ThreshLo {
1925    const ADDRESS: u8 = 0x42;
1926    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1927}
1928
1929/// Reset Value
1930impl Default for Rtcsh1ThreshLo {
1931    fn default() -> Self {
1932        Self {
1933            data: 0x0,
1934        }
1935    }
1936}
1937
1938// ==== `RTCLG0_THRESH_4` Register =============================================
1939
1940/// `RTCLG0_THRESH_4` Register
1941///
1942/// Address: 0x43
1943///
1944/// Reset Value: 0x0
1945///
1946/// Bits 39:32 of the RTCLG0 threshold.
1947#[derive(Debug, PartialEq)]
1948pub struct Rtclg0Thresh4 {
1949    /// Bits: `[7:0]`
1950    pub data: u8,
1951}
1952
1953/// Register Properties
1954impl Register<1, u8> for Rtclg0Thresh4 {
1955    const ADDRESS: u8 = 0x43;
1956    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1957}
1958
1959/// Reset Value
1960impl Default for Rtclg0Thresh4 {
1961    fn default() -> Self {
1962        Self {
1963            data: 0x0,
1964        }
1965    }
1966}
1967
1968// ==== `RTCLG0_THRESH_3` Register =============================================
1969
1970/// `RTCLG0_THRESH_3` Register
1971///
1972/// Address: 0x44
1973///
1974/// Reset Value: 0x0
1975///
1976/// Bits 31:24 of the RTCLG0 threshold.
1977#[derive(Debug, PartialEq)]
1978pub struct Rtclg0Thresh3 {
1979    /// Bits: `[7:0]`
1980    pub data: u8,
1981}
1982
1983/// Register Properties
1984impl Register<1, u8> for Rtclg0Thresh3 {
1985    const ADDRESS: u8 = 0x44;
1986    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1987}
1988
1989/// Reset Value
1990impl Default for Rtclg0Thresh3 {
1991    fn default() -> Self {
1992        Self {
1993            data: 0x0,
1994        }
1995    }
1996}
1997
1998// ==== `RTCLG0_THRESH_2` Register =============================================
1999
2000/// `RTCLG0_THRESH_2` Register
2001///
2002/// Address: 0x45
2003///
2004/// Reset Value: 0x0
2005///
2006/// Bits 23:16 of the RTCLG0 threshold.
2007#[derive(Debug, PartialEq)]
2008pub struct Rtclg0Thresh2 {
2009    /// Bits: `[7:0]`
2010    pub data: u8,
2011}
2012
2013/// Register Properties
2014impl Register<1, u8> for Rtclg0Thresh2 {
2015    const ADDRESS: u8 = 0x45;
2016    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2017}
2018
2019/// Reset Value
2020impl Default for Rtclg0Thresh2 {
2021    fn default() -> Self {
2022        Self {
2023            data: 0x0,
2024        }
2025    }
2026}
2027
2028// ==== `RTCLG0_THRESH_1` Register =============================================
2029
2030/// `RTCLG0_THRESH_1` Register
2031///
2032/// Address: 0x46
2033///
2034/// Reset Value: 0x0
2035///
2036/// Bits 15:8 of the RTCLG0 threshold.
2037#[derive(Debug, PartialEq)]
2038pub struct Rtclg0Thresh1 {
2039    /// Bits: `[7:0]`
2040    pub data: u8,
2041}
2042
2043/// Register Properties
2044impl Register<1, u8> for Rtclg0Thresh1 {
2045    const ADDRESS: u8 = 0x46;
2046    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2047}
2048
2049/// Reset Value
2050impl Default for Rtclg0Thresh1 {
2051    fn default() -> Self {
2052        Self {
2053            data: 0x0,
2054        }
2055    }
2056}
2057
2058// ==== `RTCLG0_THRESH_0` Register =============================================
2059
2060/// `RTCLG0_THRESH_0` Register
2061///
2062/// Address: 0x47
2063///
2064/// Reset Value: 0x0
2065///
2066/// Bits 7:0 of the RTCLG0 threshold.
2067#[derive(Debug, PartialEq)]
2068pub struct Rtclg0Thresh0 {
2069    /// Bits: `[7:0]`
2070    pub data: u8,
2071}
2072
2073/// Register Properties
2074impl Register<1, u8> for Rtclg0Thresh0 {
2075    const ADDRESS: u8 = 0x47;
2076    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2077}
2078
2079/// Reset Value
2080impl Default for Rtclg0Thresh0 {
2081    fn default() -> Self {
2082        Self {
2083            data: 0x0,
2084        }
2085    }
2086}
2087
2088// ==== `RTCLG1_THRESH_4` Register =============================================
2089
2090/// `RTCLG1_THRESH_4` Register
2091///
2092/// Address: 0x48
2093///
2094/// Reset Value: 0x0
2095///
2096/// Bits 39:32 of the RTCLG1 threshold.
2097#[derive(Debug, PartialEq)]
2098pub struct Rtclg1Thresh4 {
2099    /// Bits: `[7:0]`
2100    pub data: u8,
2101}
2102
2103/// Register Properties
2104impl Register<1, u8> for Rtclg1Thresh4 {
2105    const ADDRESS: u8 = 0x48;
2106    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2107}
2108
2109/// Reset Value
2110impl Default for Rtclg1Thresh4 {
2111    fn default() -> Self {
2112        Self {
2113            data: 0x0,
2114        }
2115    }
2116}
2117
2118// ==== `RTCLG1_THRESH_3` Register =============================================
2119
2120/// `RTCLG1_THRESH_3` Register
2121///
2122/// Address: 0x49
2123///
2124/// Reset Value: 0x0
2125///
2126/// Bits 31:24 of the RTCLG1 threshold.
2127#[derive(Debug, PartialEq)]
2128pub struct Rtclg1Thresh3 {
2129    /// Bits: `[7:0]`
2130    pub data: u8,
2131}
2132
2133/// Register Properties
2134impl Register<1, u8> for Rtclg1Thresh3 {
2135    const ADDRESS: u8 = 0x49;
2136    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2137}
2138
2139/// Reset Value
2140impl Default for Rtclg1Thresh3 {
2141    fn default() -> Self {
2142        Self {
2143            data: 0x0,
2144        }
2145    }
2146}
2147
2148// ==== `RTCLG1_THRESH_2` Register =============================================
2149
2150/// `RTCLG1_THRESH_2` Register
2151///
2152/// Address: 0x4A
2153///
2154/// Reset Value: 0x0
2155///
2156/// Bits 23:16 of the RTCLG1 threshold.
2157#[derive(Debug, PartialEq)]
2158pub struct Rtclg1Thresh2 {
2159    /// Bits: `[7:0]`
2160    pub data: u8,
2161}
2162
2163/// Register Properties
2164impl Register<1, u8> for Rtclg1Thresh2 {
2165    const ADDRESS: u8 = 0x4A;
2166    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2167}
2168
2169/// Reset Value
2170impl Default for Rtclg1Thresh2 {
2171    fn default() -> Self {
2172        Self {
2173            data: 0x0,
2174        }
2175    }
2176}
2177
2178// ==== `RTCLG1_THRESH_1` Register =============================================
2179
2180/// `RTCLG1_THRESH_1` Register
2181///
2182/// Address: 0x4B
2183///
2184/// Reset Value: 0x0
2185///
2186/// Bits 15:8 of the RTCLG1 threshold.
2187#[derive(Debug, PartialEq)]
2188pub struct Rtclg1Thresh1 {
2189    /// Bits: `[7:0]`
2190    pub data: u8,
2191}
2192
2193/// Register Properties
2194impl Register<1, u8> for Rtclg1Thresh1 {
2195    const ADDRESS: u8 = 0x4B;
2196    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2197}
2198
2199/// Reset Value
2200impl Default for Rtclg1Thresh1 {
2201    fn default() -> Self {
2202        Self {
2203            data: 0x0,
2204        }
2205    }
2206}
2207
2208// ==== `RTCLG1_THRESH_0` Register =============================================
2209
2210/// `RTCLG1_THRESH_0` Register
2211///
2212/// Address: 0x4C
2213///
2214/// Reset Value: 0x0
2215///
2216/// Bits 7:0 of the RTCLG1 threshold.
2217#[derive(Debug, PartialEq)]
2218pub struct Rtclg1Thresh0 {
2219    /// Bits: `[7:0]`
2220    pub data: u8,
2221}
2222
2223/// Register Properties
2224impl Register<1, u8> for Rtclg1Thresh0 {
2225    const ADDRESS: u8 = 0x4C;
2226    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2227}
2228
2229/// Reset Value
2230impl Default for Rtclg1Thresh0 {
2231    fn default() -> Self {
2232        Self {
2233            data: 0x0,
2234        }
2235    }
2236}
2237
2238// ==== `CYCLPRESC` Register ===================================================
2239
2240/// `CYCLPRESC` Register
2241///
2242/// Address: 0x4D
2243///
2244/// Reset Value: 0x0
2245///
2246/// Cycle prescaler for cyclic counter, system clock divided by prescaler (therefore max 8:29.9922 minutes).
2247#[derive(Debug, PartialEq)]
2248pub struct Cyclpresc {
2249    /// Bits: `[7:0]`
2250    pub data: u8,
2251}
2252
2253/// Register Properties
2254impl Register<1, u8> for Cyclpresc {
2255    const ADDRESS: u8 = 0x4D;
2256    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2257}
2258
2259/// Reset Value
2260impl Default for Cyclpresc {
2261    fn default() -> Self {
2262        Self {
2263            data: 0x0,
2264        }
2265    }
2266}
2267
2268// ==== `CYCLTOP_HI` Register ==================================================
2269
2270/// `CYCLTOP_HI` Register
2271///
2272/// Address: 0x4E
2273///
2274/// Reset Value: 0x0
2275///
2276/// Bits 15:8 defining the maximal cyclic counter value CYCLTOP before being reset to zero.
2277#[derive(Debug, PartialEq)]
2278pub struct CycltopHi {
2279    /// Bits: `[7:0]`
2280    pub data: u8,
2281}
2282
2283/// Register Properties
2284impl Register<1, u8> for CycltopHi {
2285    const ADDRESS: u8 = 0x4E;
2286    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2287}
2288
2289/// Reset Value
2290impl Default for CycltopHi {
2291    fn default() -> Self {
2292        Self {
2293            data: 0x0,
2294        }
2295    }
2296}
2297
2298// ==== `CYCLTOP_LO` Register ==================================================
2299
2300/// `CYCLTOP_LO` Register
2301///
2302/// Address: 0x4F
2303///
2304/// Reset Value: 0x0
2305///
2306/// Bits 7:0 defining the maximal cyclic counter value CYCLTOP before being reset to zero.
2307#[derive(Debug, PartialEq)]
2308pub struct CycltopLo {
2309    /// Bits: `[7:0]`
2310    pub data: u8,
2311}
2312
2313/// Register Properties
2314impl Register<1, u8> for CycltopLo {
2315    const ADDRESS: u8 = 0x4F;
2316    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2317}
2318
2319/// Reset Value
2320impl Default for CycltopLo {
2321    fn default() -> Self {
2322        Self {
2323            data: 0x0,
2324        }
2325    }
2326}
2327
2328// ==== `CNTR40_4` Register ====================================================
2329
2330/// `CNTR40_4` Register
2331///
2332/// Address: 0x50
2333///
2334/// Reset Value: 0x0
2335///
2336/// Bits 39:32 of the system clock counter CNTR40.
2337#[derive(Debug, PartialEq)]
2338pub struct Cntr404 {
2339    /// Bits: `[7:0]`
2340    pub data: u8,
2341}
2342
2343/// Register Properties
2344impl Register<1, u8> for Cntr404 {
2345    const ADDRESS: u8 = 0x50;
2346    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2347}
2348
2349/// Reset Value
2350impl Default for Cntr404 {
2351    fn default() -> Self {
2352        Self {
2353            data: 0x0,
2354        }
2355    }
2356}
2357
2358// ==== `CNTR40_3` Register ====================================================
2359
2360/// `CNTR40_3` Register
2361///
2362/// Address: 0x51
2363///
2364/// Reset Value: 0x0
2365///
2366/// Bits 31:24 of the system clock counter CNTR40.
2367#[derive(Debug, PartialEq)]
2368pub struct Cntr403 {
2369    /// Bits: `[7:0]`
2370    pub data: u8,
2371}
2372
2373/// Register Properties
2374impl Register<1, u8> for Cntr403 {
2375    const ADDRESS: u8 = 0x51;
2376    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2377}
2378
2379/// Reset Value
2380impl Default for Cntr403 {
2381    fn default() -> Self {
2382        Self {
2383            data: 0x0,
2384        }
2385    }
2386}
2387
2388// ==== `CNTR40_2` Register ====================================================
2389
2390/// `CNTR40_2` Register
2391///
2392/// Address: 0x52
2393///
2394/// Reset Value: 0x0
2395///
2396/// Bits 23:16 of the system clock counter CNTR40.
2397#[derive(Debug, PartialEq)]
2398pub struct Cntr402 {
2399    /// Bits: `[7:0]`
2400    pub data: u8,
2401}
2402
2403/// Register Properties
2404impl Register<1, u8> for Cntr402 {
2405    const ADDRESS: u8 = 0x52;
2406    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2407}
2408
2409/// Reset Value
2410impl Default for Cntr402 {
2411    fn default() -> Self {
2412        Self {
2413            data: 0x0,
2414        }
2415    }
2416}
2417
2418// ==== `CNTR40_1` Register ====================================================
2419
2420/// `CNTR40_1` Register
2421///
2422/// Address: 0x53
2423///
2424/// Reset Value: 0x0
2425///
2426/// Bits 15:8 of the system clock counter CNTR40.
2427#[derive(Debug, PartialEq)]
2428pub struct Cntr401 {
2429    /// Bits: `[7:0]`
2430    pub data: u8,
2431}
2432
2433/// Register Properties
2434impl Register<1, u8> for Cntr401 {
2435    const ADDRESS: u8 = 0x53;
2436    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2437}
2438
2439/// Reset Value
2440impl Default for Cntr401 {
2441    fn default() -> Self {
2442        Self {
2443            data: 0x0,
2444        }
2445    }
2446}
2447
2448// ==== `CNTR40_0` Register ====================================================
2449
2450/// `CNTR40_0` Register
2451///
2452/// Address: 0x54
2453///
2454/// Reset Value: 0x0
2455///
2456/// Bits 7:0 of the system clock counter CNTR40.
2457#[derive(Debug, PartialEq)]
2458pub struct Cntr400 {
2459    /// Bits: `[7:0]`
2460    pub data: u8,
2461}
2462
2463/// Register Properties
2464impl Register<1, u8> for Cntr400 {
2465    const ADDRESS: u8 = 0x54;
2466    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2467}
2468
2469/// Reset Value
2470impl Default for Cntr400 {
2471    fn default() -> Self {
2472        Self {
2473            data: 0x0,
2474        }
2475    }
2476}
2477
2478// ==== `CNTR40_CLR` Register ==================================================
2479
2480/// `CNTR40_CLR` Register
2481///
2482/// Address: 0x55
2483///
2484/// Reset Value: 0x0
2485///
2486/// Clear the system clock counter CNTR40 by setting this to true. Manually setting the register to false afterwards is mandatory!
2487#[derive(Debug, PartialEq)]
2488pub struct Cntr40Clr {
2489    /// Bits: `[0]`
2490    pub clr: bool,
2491}
2492
2493/// Register Properties
2494impl Register<1, u8> for Cntr40Clr {
2495    const ADDRESS: u8 = 0x55;
2496    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2497}
2498
2499/// Reset Value
2500impl Default for Cntr40Clr {
2501    fn default() -> Self {
2502        Self {
2503            clr: false,
2504        }
2505    }
2506}
2507
2508// ==== `FIFO_LENGTH` Register =================================================
2509
2510/// `FIFO_LENGTH` Register
2511///
2512/// Address: 0x56
2513///
2514/// Reset Value: 0x14
2515///
2516/// Selects the FIFO length for each band.
2517#[derive(Debug, PartialEq)]
2518pub struct FifoLength {
2519    /// Bits: `[5:4]`
2520    pub band_2g4: FifoLen,
2521    /// Bits: `[1:0]`
2522    pub band_433: FifoLen,
2523    /// Bits: `[3:2]`
2524    pub band_868: FifoLen,
2525}
2526
2527/// Register Properties
2528impl Register<1, u8> for FifoLength {
2529    const ADDRESS: u8 = 0x56;
2530    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x14]));
2531}
2532
2533/// Reset Value
2534impl Default for FifoLength {
2535    fn default() -> Self {
2536        Self {
2537            band_2g4: FifoLen::Bit24,
2538            band_433: FifoLen::Bit16,
2539            band_868: FifoLen::Bit24,
2540        }
2541    }
2542}
2543
2544// ==== `FIFO_COUNT_433` Register ==============================================
2545
2546/// `FIFO_COUNT_433` Register
2547///
2548/// Address: 0x57
2549///
2550/// Reset Value: 0x0
2551///
2552/// Number of bits in the FIFO buffer for the 433MHz band. Can be cleared by writing 0.
2553#[derive(Debug, PartialEq)]
2554pub struct FifoCount433 {
2555    /// Bits: `[5:0]`
2556    pub data: u8,
2557}
2558
2559/// Register Properties
2560impl Register<1, u8> for FifoCount433 {
2561    const ADDRESS: u8 = 0x57;
2562    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2563}
2564
2565/// Reset Value
2566impl Default for FifoCount433 {
2567    fn default() -> Self {
2568        Self {
2569            data: 0x0,
2570        }
2571    }
2572}
2573
2574// ==== `FIFO_COUNT_868` Register ==============================================
2575
2576/// `FIFO_COUNT_868` Register
2577///
2578/// Address: 0x58
2579///
2580/// Reset Value: 0x0
2581///
2582/// Number of bits in the FIFO buffer for the 868/915MHz band. Can be cleared by writing 0.
2583#[derive(Debug, PartialEq)]
2584pub struct FifoCount868 {
2585    /// Bits: `[5:0]`
2586    pub data: u8,
2587}
2588
2589/// Register Properties
2590impl Register<1, u8> for FifoCount868 {
2591    const ADDRESS: u8 = 0x58;
2592    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2593}
2594
2595/// Reset Value
2596impl Default for FifoCount868 {
2597    fn default() -> Self {
2598        Self {
2599            data: 0x0,
2600        }
2601    }
2602}
2603
2604// ==== `FIFO_COUNT_2G4` Register ==============================================
2605
2606/// `FIFO_COUNT_2G4` Register
2607///
2608/// Address: 0x59
2609///
2610/// Reset Value: 0x0
2611///
2612/// Number of bits in the FIFO buffer for the 2.4GHz band. Can be cleared by writing 0.
2613#[derive(Debug, PartialEq)]
2614pub struct FifoCount2g4 {
2615    /// Bits: `[5:0]`
2616    pub data: u8,
2617}
2618
2619/// Register Properties
2620impl Register<1, u8> for FifoCount2g4 {
2621    const ADDRESS: u8 = 0x59;
2622    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2623}
2624
2625/// Reset Value
2626impl Default for FifoCount2g4 {
2627    fn default() -> Self {
2628        Self {
2629            data: 0x0,
2630        }
2631    }
2632}
2633
2634// ==== `RX_FIFO_5_433` Register ===============================================
2635
2636/// `RX_FIFO_5_433` Register
2637///
2638/// Address: 0x5A
2639///
2640/// Reset Value: 0x0
2641///
2642/// The FIFO byte 5 for the 433MHz band, _5 is filled first.
2643#[derive(Debug, PartialEq)]
2644pub struct RxFifo5433 {
2645    /// Bits: `[7:0]`
2646    pub data: u8,
2647}
2648
2649/// Register Properties
2650impl Register<1, u8> for RxFifo5433 {
2651    const ADDRESS: u8 = 0x5A;
2652    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2653}
2654
2655/// Reset Value
2656impl Default for RxFifo5433 {
2657    fn default() -> Self {
2658        Self {
2659            data: 0x0,
2660        }
2661    }
2662}
2663
2664// ==== `RX_FIFO_4_433` Register ===============================================
2665
2666/// `RX_FIFO_4_433` Register
2667///
2668/// Address: 0x5B
2669///
2670/// Reset Value: 0x0
2671///
2672/// The FIFO byte 4 for the 433MHz band, _5 is filled first.
2673#[derive(Debug, PartialEq)]
2674pub struct RxFifo4433 {
2675    /// Bits: `[7:0]`
2676    pub data: u8,
2677}
2678
2679/// Register Properties
2680impl Register<1, u8> for RxFifo4433 {
2681    const ADDRESS: u8 = 0x5B;
2682    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2683}
2684
2685/// Reset Value
2686impl Default for RxFifo4433 {
2687    fn default() -> Self {
2688        Self {
2689            data: 0x0,
2690        }
2691    }
2692}
2693
2694// ==== `RX_FIFO_3_433` Register ===============================================
2695
2696/// `RX_FIFO_3_433` Register
2697///
2698/// Address: 0x5C
2699///
2700/// Reset Value: 0x0
2701///
2702/// The FIFO byte 3 for the 433MHz band, _5 is filled first.
2703#[derive(Debug, PartialEq)]
2704pub struct RxFifo3433 {
2705    /// Bits: `[7:0]`
2706    pub data: u8,
2707}
2708
2709/// Register Properties
2710impl Register<1, u8> for RxFifo3433 {
2711    const ADDRESS: u8 = 0x5C;
2712    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2713}
2714
2715/// Reset Value
2716impl Default for RxFifo3433 {
2717    fn default() -> Self {
2718        Self {
2719            data: 0x0,
2720        }
2721    }
2722}
2723
2724// ==== `RX_FIFO_2_433` Register ===============================================
2725
2726/// `RX_FIFO_2_433` Register
2727///
2728/// Address: 0x5D
2729///
2730/// Reset Value: 0x0
2731///
2732/// The FIFO byte 2 for the 433MHz band, _5 is filled first.
2733#[derive(Debug, PartialEq)]
2734pub struct RxFifo2433 {
2735    /// Bits: `[7:0]`
2736    pub data: u8,
2737}
2738
2739/// Register Properties
2740impl Register<1, u8> for RxFifo2433 {
2741    const ADDRESS: u8 = 0x5D;
2742    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2743}
2744
2745/// Reset Value
2746impl Default for RxFifo2433 {
2747    fn default() -> Self {
2748        Self {
2749            data: 0x0,
2750        }
2751    }
2752}
2753
2754// ==== `RX_FIFO_1_433` Register ===============================================
2755
2756/// `RX_FIFO_1_433` Register
2757///
2758/// Address: 0x5E
2759///
2760/// Reset Value: 0x0
2761///
2762/// The FIFO byte 1 for the 433MHz band, _5 is filled first.
2763#[derive(Debug, PartialEq)]
2764pub struct RxFifo1433 {
2765    /// Bits: `[7:0]`
2766    pub data: u8,
2767}
2768
2769/// Register Properties
2770impl Register<1, u8> for RxFifo1433 {
2771    const ADDRESS: u8 = 0x5E;
2772    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2773}
2774
2775/// Reset Value
2776impl Default for RxFifo1433 {
2777    fn default() -> Self {
2778        Self {
2779            data: 0x0,
2780        }
2781    }
2782}
2783
2784// ==== `RX_FIFO_0_433` Register ===============================================
2785
2786/// `RX_FIFO_0_433` Register
2787///
2788/// Address: 0x5F
2789///
2790/// Reset Value: 0x0
2791///
2792/// The FIFO byte 0 for the 433MHz band, _5 is filled first.
2793#[derive(Debug, PartialEq)]
2794pub struct RxFifo0433 {
2795    /// Bits: `[7:0]`
2796    pub data: u8,
2797}
2798
2799/// Register Properties
2800impl Register<1, u8> for RxFifo0433 {
2801    const ADDRESS: u8 = 0x5F;
2802    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2803}
2804
2805/// Reset Value
2806impl Default for RxFifo0433 {
2807    fn default() -> Self {
2808        Self {
2809            data: 0x0,
2810        }
2811    }
2812}
2813
2814// ==== `RX_FIFO_5_868` Register ===============================================
2815
2816/// `RX_FIFO_5_868` Register
2817///
2818/// Address: 0x60
2819///
2820/// Reset Value: 0x0
2821///
2822/// The FIFO byte 5 for the 868MHz band, _5 is filled first.
2823#[derive(Debug, PartialEq)]
2824pub struct RxFifo5868 {
2825    /// Bits: `[7:0]`
2826    pub data: u8,
2827}
2828
2829/// Register Properties
2830impl Register<1, u8> for RxFifo5868 {
2831    const ADDRESS: u8 = 0x60;
2832    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2833}
2834
2835/// Reset Value
2836impl Default for RxFifo5868 {
2837    fn default() -> Self {
2838        Self {
2839            data: 0x0,
2840        }
2841    }
2842}
2843
2844// ==== `RX_FIFO_4_868` Register ===============================================
2845
2846/// `RX_FIFO_4_868` Register
2847///
2848/// Address: 0x61
2849///
2850/// Reset Value: 0x0
2851///
2852/// The FIFO byte 4 for the 868MHz band, _5 is filled first.
2853#[derive(Debug, PartialEq)]
2854pub struct RxFifo4868 {
2855    /// Bits: `[7:0]`
2856    pub data: u8,
2857}
2858
2859/// Register Properties
2860impl Register<1, u8> for RxFifo4868 {
2861    const ADDRESS: u8 = 0x61;
2862    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2863}
2864
2865/// Reset Value
2866impl Default for RxFifo4868 {
2867    fn default() -> Self {
2868        Self {
2869            data: 0x0,
2870        }
2871    }
2872}
2873
2874// ==== `RX_FIFO_3_868` Register ===============================================
2875
2876/// `RX_FIFO_3_868` Register
2877///
2878/// Address: 0x62
2879///
2880/// Reset Value: 0x0
2881///
2882/// The FIFO byte 3 for the 868MHz band, _5 is filled first.
2883#[derive(Debug, PartialEq)]
2884pub struct RxFifo3868 {
2885    /// Bits: `[7:0]`
2886    pub data: u8,
2887}
2888
2889/// Register Properties
2890impl Register<1, u8> for RxFifo3868 {
2891    const ADDRESS: u8 = 0x62;
2892    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2893}
2894
2895/// Reset Value
2896impl Default for RxFifo3868 {
2897    fn default() -> Self {
2898        Self {
2899            data: 0x0,
2900        }
2901    }
2902}
2903
2904// ==== `RX_FIFO_2_868` Register ===============================================
2905
2906/// `RX_FIFO_2_868` Register
2907///
2908/// Address: 0x63
2909///
2910/// Reset Value: 0x0
2911///
2912/// The FIFO byte 2 for the 868MHz band, _5 is filled first.
2913#[derive(Debug, PartialEq)]
2914pub struct RxFifo2868 {
2915    /// Bits: `[7:0]`
2916    pub data: u8,
2917}
2918
2919/// Register Properties
2920impl Register<1, u8> for RxFifo2868 {
2921    const ADDRESS: u8 = 0x63;
2922    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2923}
2924
2925/// Reset Value
2926impl Default for RxFifo2868 {
2927    fn default() -> Self {
2928        Self {
2929            data: 0x0,
2930        }
2931    }
2932}
2933
2934// ==== `RX_FIFO_1_868` Register ===============================================
2935
2936/// `RX_FIFO_1_868` Register
2937///
2938/// Address: 0x64
2939///
2940/// Reset Value: 0x0
2941///
2942/// The FIFO byte 1 for the 868MHz band, _5 is filled first.
2943#[derive(Debug, PartialEq)]
2944pub struct RxFifo1868 {
2945    /// Bits: `[7:0]`
2946    pub data: u8,
2947}
2948
2949/// Register Properties
2950impl Register<1, u8> for RxFifo1868 {
2951    const ADDRESS: u8 = 0x64;
2952    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2953}
2954
2955/// Reset Value
2956impl Default for RxFifo1868 {
2957    fn default() -> Self {
2958        Self {
2959            data: 0x0,
2960        }
2961    }
2962}
2963
2964// ==== `RX_FIFO_0_868` Register ===============================================
2965
2966/// `RX_FIFO_0_868` Register
2967///
2968/// Address: 0x65
2969///
2970/// Reset Value: 0x0
2971///
2972/// The FIFO byte 0 for the 868MHz band, _5 is filled first.
2973#[derive(Debug, PartialEq)]
2974pub struct RxFifo0868 {
2975    /// Bits: `[7:0]`
2976    pub data: u8,
2977}
2978
2979/// Register Properties
2980impl Register<1, u8> for RxFifo0868 {
2981    const ADDRESS: u8 = 0x65;
2982    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2983}
2984
2985/// Reset Value
2986impl Default for RxFifo0868 {
2987    fn default() -> Self {
2988        Self {
2989            data: 0x0,
2990        }
2991    }
2992}
2993
2994// ==== `RX_FIFO_5_2G4` Register ===============================================
2995
2996/// `RX_FIFO_5_2G4` Register
2997///
2998/// Address: 0x66
2999///
3000/// Reset Value: 0x0
3001///
3002/// The FIFO byte 5 for the 2.4GHz band, _5 is filled first.
3003#[derive(Debug, PartialEq)]
3004pub struct RxFifo52g4 {
3005    /// Bits: `[7:0]`
3006    pub data: u8,
3007}
3008
3009/// Register Properties
3010impl Register<1, u8> for RxFifo52g4 {
3011    const ADDRESS: u8 = 0x66;
3012    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
3013}
3014
3015/// Reset Value
3016impl Default for RxFifo52g4 {
3017    fn default() -> Self {
3018        Self {
3019            data: 0x0,
3020        }
3021    }
3022}
3023
3024// ==== `RX_FIFO_4_2G4` Register ===============================================
3025
3026/// `RX_FIFO_4_2G4` Register
3027///
3028/// Address: 0x67
3029///
3030/// Reset Value: 0x0
3031///
3032/// The FIFO byte 4 for the 2.4GHz band, _5 is filled first.
3033#[derive(Debug, PartialEq)]
3034pub struct RxFifo42g4 {
3035    /// Bits: `[7:0]`
3036    pub data: u8,
3037}
3038
3039/// Register Properties
3040impl Register<1, u8> for RxFifo42g4 {
3041    const ADDRESS: u8 = 0x67;
3042    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
3043}
3044
3045/// Reset Value
3046impl Default for RxFifo42g4 {
3047    fn default() -> Self {
3048        Self {
3049            data: 0x0,
3050        }
3051    }
3052}
3053
3054// ==== `RX_FIFO_3_2G4` Register ===============================================
3055
3056/// `RX_FIFO_3_2G4` Register
3057///
3058/// Address: 0x68
3059///
3060/// Reset Value: 0x0
3061///
3062/// The FIFO byte 3 for the 2.4GHz band, _5 is filled first.
3063#[derive(Debug, PartialEq)]
3064pub struct RxFifo32g4 {
3065    /// Bits: `[7:0]`
3066    pub data: u8,
3067}
3068
3069/// Register Properties
3070impl Register<1, u8> for RxFifo32g4 {
3071    const ADDRESS: u8 = 0x68;
3072    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
3073}
3074
3075/// Reset Value
3076impl Default for RxFifo32g4 {
3077    fn default() -> Self {
3078        Self {
3079            data: 0x0,
3080        }
3081    }
3082}
3083
3084// ==== `RX_FIFO_2_2G4` Register ===============================================
3085
3086/// `RX_FIFO_2_2G4` Register
3087///
3088/// Address: 0x69
3089///
3090/// Reset Value: 0x0
3091///
3092/// The FIFO byte 2 for the 2.4GHz band, _5 is filled first.
3093#[derive(Debug, PartialEq)]
3094pub struct RxFifo22g4 {
3095    /// Bits: `[7:0]`
3096    pub data: u8,
3097}
3098
3099/// Register Properties
3100impl Register<1, u8> for RxFifo22g4 {
3101    const ADDRESS: u8 = 0x69;
3102    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
3103}
3104
3105/// Reset Value
3106impl Default for RxFifo22g4 {
3107    fn default() -> Self {
3108        Self {
3109            data: 0x0,
3110        }
3111    }
3112}
3113
3114// ==== `RX_FIFO_1_2G4` Register ===============================================
3115
3116/// `RX_FIFO_1_2G4` Register
3117///
3118/// Address: 0x6A
3119///
3120/// Reset Value: 0x0
3121///
3122/// The FIFO byte 1 for the 2.4GHz band, _5 is filled first.
3123#[derive(Debug, PartialEq)]
3124pub struct RxFifo12g4 {
3125    /// Bits: `[7:0]`
3126    pub data: u8,
3127}
3128
3129/// Register Properties
3130impl Register<1, u8> for RxFifo12g4 {
3131    const ADDRESS: u8 = 0x6A;
3132    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
3133}
3134
3135/// Reset Value
3136impl Default for RxFifo12g4 {
3137    fn default() -> Self {
3138        Self {
3139            data: 0x0,
3140        }
3141    }
3142}
3143
3144// ==== `RX_FIFO_0_2G4` Register ===============================================
3145
3146/// `RX_FIFO_0_2G4` Register
3147///
3148/// Address: 0x6B
3149///
3150/// Reset Value: 0x0
3151///
3152/// The FIFO byte 0 for the 2.4GHz band, _5 is filled first.
3153#[derive(Debug, PartialEq)]
3154pub struct RxFifo02g4 {
3155    /// Bits: `[7:0]`
3156    pub data: u8,
3157}
3158
3159/// Register Properties
3160impl Register<1, u8> for RxFifo02g4 {
3161    const ADDRESS: u8 = 0x6B;
3162    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
3163}
3164
3165/// Reset Value
3166impl Default for RxFifo02g4 {
3167    fn default() -> Self {
3168        Self {
3169            data: 0x0,
3170        }
3171    }
3172}
3173
3174// ==== `ACTUAL_NFA_433` Register ==============================================
3175
3176/// `ACTUAL_NFA_433` Register
3177///
3178/// Address: 0x6C
3179///
3180/// Reset Value: 0x25
3181///
3182/// This register contains the actual NFA (sampling rate) value that is currently valid for 433MHz data reception.
3183#[derive(Debug, PartialEq)]
3184pub struct ActualNfa433 {
3185    /// Bits: `[6:4]`
3186    pub fast: SampleRate,
3187    /// Bits: `[2:0]`
3188    pub slow: SampleRate,
3189}
3190
3191/// Register Properties
3192impl Register<1, u8> for ActualNfa433 {
3193    const ADDRESS: u8 = 0x6C;
3194    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x25]));
3195}
3196
3197/// Reset Value
3198impl Default for ActualNfa433 {
3199    fn default() -> Self {
3200        Self {
3201            fast: SampleRate::Sr8192,
3202            slow: SampleRate::Sr1024,
3203        }
3204    }
3205}
3206
3207// ==== `ACTUAL_NFA_868` Register ==============================================
3208
3209/// `ACTUAL_NFA_868` Register
3210///
3211/// Address: 0x6D
3212///
3213/// Reset Value: 0x15
3214///
3215/// This register contains the actual NFA (sampling rate) value that is currently valid for 868MHz data reception.
3216#[derive(Debug, PartialEq)]
3217pub struct ActualNfa868 {
3218    /// Bits: `[6:4]`
3219    pub fast: SampleRate,
3220    /// Bits: `[2:0]`
3221    pub slow: SampleRate,
3222}
3223
3224/// Register Properties
3225impl Register<1, u8> for ActualNfa868 {
3226    const ADDRESS: u8 = 0x6D;
3227    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x15]));
3228}
3229
3230/// Reset Value
3231impl Default for ActualNfa868 {
3232    fn default() -> Self {
3233        Self {
3234            fast: SampleRate::Sr16384,
3235            slow: SampleRate::Sr1024,
3236        }
3237    }
3238}
3239
3240// ==== `ACTUAL_NFA_2G4` Register ==============================================
3241
3242/// `ACTUAL_NFA_2G4` Register
3243///
3244/// Address: 0x6E
3245///
3246/// Reset Value: 0x25
3247///
3248/// This register contains the actual NFA (sampling rate) value that is currently valid for 2.4GHz data reception.
3249#[derive(Debug, PartialEq)]
3250pub struct ActualNfa2g4 {
3251    /// Bits: `[6:4]`
3252    pub fast: SampleRate,
3253    /// Bits: `[2:0]`
3254    pub slow: SampleRate,
3255}
3256
3257/// Register Properties
3258impl Register<1, u8> for ActualNfa2g4 {
3259    const ADDRESS: u8 = 0x6E;
3260    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x25]));
3261}
3262
3263/// Reset Value
3264impl Default for ActualNfa2g4 {
3265    fn default() -> Self {
3266        Self {
3267            fast: SampleRate::Sr8192,
3268            slow: SampleRate::Sr1024,
3269        }
3270    }
3271}
3272
3273// ==== `ACTUAL_BANDSELECT` Register ===========================================
3274
3275/// `ACTUAL_BANDSELECT` Register
3276///
3277/// Address: 0x6F
3278///
3279/// Reset Value: 0x7
3280///
3281/// This 3 bit register contains the actual selected frequency bands that are currently used.
3282#[derive(Debug, PartialEq)]
3283pub struct ActualBandselect {
3284    /// Bits: `[2:0]`
3285    pub selected_bands: Bands,
3286}
3287
3288/// Register Properties
3289impl Register<1, u8> for ActualBandselect {
3290    const ADDRESS: u8 = 0x6F;
3291    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x7]));
3292}
3293
3294/// Reset Value
3295impl Default for ActualBandselect {
3296    fn default() -> Self {
3297        Self {
3298            selected_bands: Bands {
3299                band_2g4: true,
3300                band_433: true,
3301                band_868: true,
3302            },
3303        }
3304    }
3305}
3306
3307// ==== `GENPURP_1` Register ===================================================
3308
3309/// `GENPURP_1` Register
3310///
3311/// Address: 0x71
3312///
3313/// Reset Value: 0x0
3314///
3315/// 8 bits free to use for read/write. (Register table says only write).
3316#[derive(Debug, PartialEq)]
3317pub struct Genpurp1 {
3318    /// Bits: `[7:0]`
3319    pub data: u8,
3320}
3321
3322/// Register Properties
3323impl Register<1, u8> for Genpurp1 {
3324    const ADDRESS: u8 = 0x71;
3325    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
3326}
3327
3328/// Reset Value
3329impl Default for Genpurp1 {
3330    fn default() -> Self {
3331        Self {
3332            data: 0x0,
3333        }
3334    }
3335}
3336
3337// ==== `XTAL_OSC_CTRL` Register ===============================================
3338
3339/// `XTAL_OSC_CTRL` Register
3340///
3341/// Address: 0x73
3342///
3343/// Reset Value: 0x1
3344///
3345/// Enables the built-in crystal oscillator driving a 2-pin crystal device.
3346#[derive(Debug, PartialEq)]
3347pub struct XtalOscCtrl {
3348    /// Bits: `[0]`
3349    pub data: bool,
3350}
3351
3352/// Register Properties
3353impl Register<1, u8> for XtalOscCtrl {
3354    const ADDRESS: u8 = 0x73;
3355    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x1]));
3356}
3357
3358/// Reset Value
3359impl Default for XtalOscCtrl {
3360    fn default() -> Self {
3361        Self {
3362            data: true,
3363        }
3364    }
3365}
3366
3367// ==== `LDO_XTAL_CTRL` Register ===============================================
3368
3369/// `LDO_XTAL_CTRL` Register
3370///
3371/// Address: 0x74
3372///
3373/// Reset Value: 0x3
3374///
3375/// Controls the LDO and the crystal oscillator.
3376///
3377/// Fixed bits:
3378/// - `[1:0]` = 0b11
3379#[derive(Debug, PartialEq)]
3380pub struct LdoXtalCtrl {
3381    /// sed to deactivate the internal LDO for VDDC voltage generation. If set to true, an external VDDC source must be supplied.
3382    ///
3383    /// Bits: `[5]`
3384    pub ldo_ena_nfa: bool,
3385    /// Used for selecting an external system clock source that is applied to pin CLK32_XI. In this case, XTAL_OSC_BYP should be true. Set this, if a 2-pin crystal will not be used.
3386    ///
3387    /// Bits: `[3]`
3388    pub xtal_osc_byp: bool,
3389}
3390
3391/// Register Properties
3392impl Register<1, u8> for LdoXtalCtrl {
3393    const ADDRESS: u8 = 0x74;
3394    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x3]));
3395}
3396
3397/// Reset Value
3398impl Default for LdoXtalCtrl {
3399    fn default() -> Self {
3400        Self {
3401            ldo_ena_nfa: false,
3402            xtal_osc_byp: false,
3403        }
3404    }
3405}
3406
3407// ==== `MUX_D_OUT_SEL` Register ===============================================
3408
3409/// `MUX_D_OUT_SEL` Register
3410///
3411/// Address: 0x75
3412///
3413/// Reset Value: 0xF
3414///
3415/// Selects the signal routed to the GPO1 and GPO2 pins.
3416#[derive(Debug, PartialEq)]
3417pub struct MuxDOutSel {
3418    /// Bits: `[3:0]`
3419    pub out: Out,
3420}
3421
3422// Register-specific sub-layouts:
3423#[derive(Clone, Copy, Debug, PartialEq)]
3424pub enum Out {
3425    /// System Clock CLK32 on GPO1 and interrupt signal IRQ_EVENT on GPO2.
3426    Clk32IrqEvent, // 0xE
3427    /// General ID match on GPO1 and 433MHz Wake-up A signal WUP_A on GPO2.
3428    IdmWupA433, // 0x6
3429    /// Interrupt signal IRQ_EVENT on GPO1 and static high on GPO2.
3430    IrqEvent1, // 0xF
3431    /// RX data stream at 2.4GHz. CLK on GPO1 and DATA on GPO2.
3432    Rx2g4, // 0x0
3433    /// RX data stream at 433MHz. CLK on GPO1 and DATA on GPO2.
3434    Rx433, // 0x2
3435    /// RX data stream at 868MHz. CLK on GPO1 and DATA on GPO2.
3436    Rx868, // 0x1
3437    /// 2.4GHz Wake-up A signal WUP_A on GPO1 and RX_ACTIVE trigger signal on GPO2.
3438    WupA2g4RxActive, // 0xA
3439    /// 433MHz Wake-up A signal WUP_A on GPO1 and RX_ACTIVE trigger signal on GPO2.
3440    WupA433RxActive, // 0x8
3441    /// 868MHz Wake-up A signal WUP_A on GPO1 and RX_ACTIVE trigger signal on GPO2.
3442    WupA868RxActive, // 0x9
3443    /// Wake-up A/B signals at 2.4GHz. WUP_A on GPO1 and WUP_B on GPO2.
3444    WupAB2g4, // 0x3
3445    /// Wake-up A/B signals at 868MHz. WUP_A on GPO1 and WUP_B on GPO2.
3446    WupAB868, // 0x7
3447}
3448
3449/// Register Properties
3450impl Register<1, u8> for MuxDOutSel {
3451    const ADDRESS: u8 = 0x75;
3452    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0xF]));
3453}
3454
3455/// Reset Value
3456impl Default for MuxDOutSel {
3457    fn default() -> Self {
3458        Self {
3459            out: Out::IrqEvent1,
3460        }
3461    }
3462}
3463
3464// ==== `LC_TG_ENA` Register ===================================================
3465
3466/// `LC_TG_ENA` Register
3467///
3468/// Address: 0x76
3469///
3470/// Reset Value: 0x1
3471///
3472/// Set to 0x00 during power-up.
3473#[derive(Debug, PartialEq)]
3474pub struct LcTgEna {
3475    /// Bits: `[0]`
3476    pub data: bool,
3477}
3478
3479/// Register Properties
3480impl Register<1, u8> for LcTgEna {
3481    const ADDRESS: u8 = 0x76;
3482    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x1]));
3483}
3484
3485/// Reset Value
3486impl Default for LcTgEna {
3487    fn default() -> Self {
3488        Self {
3489            data: true,
3490        }
3491    }
3492}
3493
3494// ==== `XTAL_GOOD` Register ===================================================
3495
3496/// `XTAL_GOOD` Register
3497///
3498/// Address: 0x77
3499///
3500/// Reset Value: 0x0
3501///
3502/// Reads as true if the clock source is stable.
3503#[derive(Debug, PartialEq)]
3504pub struct XtalGood {
3505    /// Bits: `[0]`
3506    pub data: bool,
3507}
3508
3509/// Register Properties
3510impl Register<1, u8> for XtalGood {
3511    const ADDRESS: u8 = 0x77;
3512    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
3513}
3514
3515/// Reset Value
3516impl Default for XtalGood {
3517    fn default() -> Self {
3518        Self {
3519            data: false,
3520        }
3521    }
3522}
3523
3524// ==== `COMP_THRESH_W` Register ===============================================
3525
3526/// `COMP_THRESH_W` Register
3527///
3528/// Address: 0x78
3529///
3530/// Reset Value: 0x0
3531///
3532/// Set this register to 0xA before executing the comparator calibration.
3533#[derive(Debug, PartialEq)]
3534pub struct CompThreshW {
3535    /// Bits: `[7:0]`
3536    pub data: u8,
3537}
3538
3539/// Register Properties
3540impl Register<1, u8> for CompThreshW {
3541    const ADDRESS: u8 = 0x78;
3542    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
3543}
3544
3545/// Reset Value
3546impl Default for CompThreshW {
3547    fn default() -> Self {
3548        Self {
3549            data: 0x0,
3550        }
3551    }
3552}
3553
3554// ==== `KORREL_SV_CLEAR` Register =============================================
3555
3556/// `KORREL_SV_CLEAR` Register
3557///
3558/// Address: 0x7C
3559///
3560/// Reset Value: 0x0
3561///
3562/// Set true to clear the KORREL_STATE and KORREL_VAL registers.
3563#[derive(Debug, PartialEq)]
3564pub struct KorrelSvClear {
3565    /// Bits: `[0]`
3566    pub data: bool,
3567}
3568
3569/// Register Properties
3570impl Register<1, u8> for KorrelSvClear {
3571    const ADDRESS: u8 = 0x7C;
3572    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
3573}
3574
3575/// Reset Value
3576impl Default for KorrelSvClear {
3577    fn default() -> Self {
3578        Self {
3579            data: false,
3580        }
3581    }
3582}
3583
3584// ==== `VERSION` Register =====================================================
3585
3586/// `VERSION` Register
3587///
3588/// Address: 0x7F
3589///
3590/// Reset Value: 0x41
3591///
3592/// Holds the version number of the IC, currently 0x41.
3593///
3594/// Fixed bits:
3595/// - `[7:0]` = 0b1000001
3596#[derive(Debug, PartialEq)]
3597pub struct Version {
3598}
3599
3600/// Register Properties
3601impl Register<1, u8> for Version {
3602    const ADDRESS: u8 = 0x7F;
3603    const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x41]));
3604}
3605
3606/// Reset Value
3607impl Default for Version {
3608    fn default() -> Self {
3609        Self {
3610        }
3611    }
3612}
3613
3614// ==== Shared Enums ===========================================================
3615
3616#[derive(Clone, Copy, Debug, PartialEq)]
3617pub enum BinCode {
3618    /// mls A
3619    A, // 0x0
3620    /// mls A inv
3621    AInv, // 0x4
3622    /// m-sequence A
3623    ASeq, // 0x6
3624    /// mls B
3625    B, // 0x1
3626    /// mls B inv
3627    BInv, // 0x5
3628    /// m-sequence B
3629    BSeq, // 0x7
3630    /// mls C
3631    C, // 0x2
3632    /// mls D
3633    D, // 0x3
3634    /// 16 ones
3635    One16, // 0xA
3636    /// 24 ones
3637    One24, // 0xB
3638    /// 31 ones
3639    One31, // 0xC
3640    /// 8 ones
3641    One8, // 0x9
3642    /// 111000 pattern
3643    Ooozzz, // 0xF
3644    /// 1100 pattern
3645    Oozz, // 0xE
3646    /// 31 zeros
3647    Zero31, // 0x8
3648    /// 0101 pattern
3649    Zozo, // 0xD
3650}
3651
3652#[derive(Clone, Copy, Debug, PartialEq)]
3653pub enum ExitCond {
3654    /// FO_QUIT was set - user forced slow mode.
3655    ForceQuit, // 0x3
3656    /// ID match failed - 16-bit ID did not match.
3657    IdFail, // 0x2
3658    /// RX resetted or FDD is disabled - Initial state.
3659    NoReason, // 0x0
3660    /// Timeout - No fast code A or B received.
3661    Timeout, // 0x1
3662}
3663
3664#[derive(Clone, Copy, Debug, PartialEq)]
3665pub enum FddMode {
3666    /// Fast mode.
3667    Fast, // 0x1
3668    /// Slow mode.
3669    Slow, // 0x0
3670}
3671
3672#[derive(Clone, Copy, Debug, PartialEq)]
3673pub enum FifoLen {
3674    /// 16-bit FIFO.
3675    Bit16, // 0x0
3676    /// 24-bit FIFO.
3677    Bit24, // 0x1
3678    /// 32-bit FIFO.
3679    Bit32, // 0x2
3680    /// 40-bit FIFO.
3681    Bit40, // 0x3
3682}
3683
3684#[derive(Clone, Copy, Debug, PartialEq)]
3685pub enum SampleRate {
3686    /// 256 Hz. 125ms code-sequence-duration.
3687    Sr0256, // 0x7
3688    /// 512 Hz. 62.5ms code-sequence-duration.
3689    Sr0512, // 0x6
3690    /// 16384 Hz. 1.957ms code-sequence-duration.
3691    Sr16384, // 0x1
3692    /// 1024 Hz. 31.25ms code-sequence-duration.
3693    Sr1024, // 0x5
3694    /// 2048 Hz. 15.625ms code-sequence-duration.
3695    Sr2048, // 0x4
3696    /// 32768 Hz. 0.977ms code-sequence-duration.
3697    Sr32768, // 0x0
3698    /// 4096 Hz. 7.813ms code-sequence-duration.
3699    Sr4096, // 0x3
3700    /// 32768 Hz. 0.977ms code-sequence-duration.
3701    Sr8192, // 0x2
3702}
3703
3704// ==== `BANDS` Shared Layout ==================================================
3705
3706/// `BANDS`
3707#[derive(Debug, PartialEq)]
3708pub struct Bands {
3709    /// True means on for 2.4GHz band.
3710    ///
3711    /// Bits: `[2]`
3712    pub band_2g4: bool,
3713    /// True means on for 433MHz band.
3714    ///
3715    /// Bits: `[0]`
3716    pub band_433: bool,
3717    /// True means on for 868/915MHz band.
3718    ///
3719    /// Bits: `[1]`
3720    pub band_868: bool,
3721}
3722
3723// ==== `BRANCHES` Shared Layout ===============================================
3724
3725/// `BRANCHES`
3726#[derive(Debug, PartialEq)]
3727pub struct Branches {
3728    /// True means medium branch on (+8dB of weak).
3729    ///
3730    /// Bits: `[1]`
3731    pub medium: bool,
3732    /// True means strong branch on (+16dB of weak).
3733    ///
3734    /// Bits: `[2]`
3735    pub strong: bool,
3736    /// True means weak branch on.
3737    ///
3738    /// Bits: `[0]`
3739    pub weak: bool,
3740}
3741
3742// ==== `IRQ_SOURCE` Shared Layout =============================================
3743
3744/// `IRQ_SOURCE`
3745#[derive(Debug, PartialEq)]
3746pub struct IrqSource {
3747    /// OOK data matches the correlation sequence.
3748    ///
3749    /// Bits: `[3]`
3750    pub correl_match: bool,
3751    /// Cyclic timer alarm.
3752    ///
3753    /// Bits: `[7]`
3754    pub cyclic_timer_alarm: bool,
3755    /// FIFO buffer full.
3756    ///
3757    /// Bits: `[2]`
3758    pub fifo_full: bool,
3759    /// FIFO overflow.
3760    ///
3761    /// Bits: `[1]`
3762    pub fifo_overflow: bool,
3763    /// The 16-bit ID in FDD mode matches (register ID_HI, ID_LO).
3764    ///
3765    /// Bits: `[0]`
3766    pub id_match: bool,
3767    /// 16-bit ID in FDD mode matches and FIFO buffer full.
3768    ///
3769    /// Bits: `[4]`
3770    pub id_match_and_fifo_full: bool,
3771    /// 16-bit ID in FDD mode matches and LDR was entered.
3772    ///
3773    /// Bits: `[5]`
3774    pub id_match_and_ldr: bool,
3775    /// RTC timer alarm.
3776    ///
3777    /// Bits: `[6]`
3778    pub rtc_timer_alarm: bool,
3779}
3780
3781// ==== `RTC` Shared Layout ====================================================
3782
3783/// `RTC`
3784#[derive(Debug, PartialEq)]
3785pub struct Rtc {
3786    /// Selects the long RTC counter
3787    ///
3788    /// Bits: `[2]`
3789    pub rtclg0: bool,
3790    /// Selects the long RTC counter
3791    ///
3792    /// Bits: `[3]`
3793    pub rtclg1: bool,
3794    /// Selects the short RTC counter
3795    ///
3796    /// Bits: `[0]`
3797    pub rtcsh0: bool,
3798    /// Selects the short RTC counter
3799    ///
3800    /// Bits: `[1]`
3801    pub rtcsh1: bool,
3802}
3803
3804// ==== `BIN_CODE` Enum Conversion Functions ===================================
3805
3806impl FromMaskedBytes<1> for BinCode {
3807    fn from_masked_le_bytes(val: &[u8; 1]) -> Self {
3808        match [val[0] & 0xF] {
3809            [0x0] => Self::A,
3810            [0x4] => Self::AInv,
3811            [0x6] => Self::ASeq,
3812            [0x1] => Self::B,
3813            [0x5] => Self::BInv,
3814            [0x7] => Self::BSeq,
3815            [0x2] => Self::C,
3816            [0x3] => Self::D,
3817            [0xA] => Self::One16,
3818            [0xB] => Self::One24,
3819            [0xC] => Self::One31,
3820            [0x9] => Self::One8,
3821            [0xF] => Self::Ooozzz,
3822            [0xE] => Self::Oozz,
3823            [0x8] => Self::Zero31,
3824            [0xD] => Self::Zozo,
3825            _ => unreachable!(),
3826        }
3827    }
3828}
3829
3830impl TryFromBytes<1> for BinCode {
3831    type Error = FromBytesError;
3832
3833    fn try_from_le_bytes(val: &[u8; 1]) -> Result<Self, Self::Error> {
3834        let bytes_outside = [val[0] & 0xF0];
3835        if bytes_outside == [0; 1] {
3836            Ok(Self::from_masked_le_bytes(val))
3837        } else {
3838            Err(Self::Error {pos: 0})
3839        }
3840    }
3841}
3842
3843impl ToBytes<1> for BinCode {
3844    fn to_le_bytes(&self) -> [u8; 1] {
3845        match self {
3846            Self::A => [0x0],
3847            Self::AInv => [0x4],
3848            Self::ASeq => [0x6],
3849            Self::B => [0x1],
3850            Self::BInv => [0x5],
3851            Self::BSeq => [0x7],
3852            Self::C => [0x2],
3853            Self::D => [0x3],
3854            Self::One16 => [0xA],
3855            Self::One24 => [0xB],
3856            Self::One31 => [0xC],
3857            Self::One8 => [0x9],
3858            Self::Ooozzz => [0xF],
3859            Self::Oozz => [0xE],
3860            Self::Zero31 => [0x8],
3861            Self::Zozo => [0xD],
3862        }
3863    }
3864}
3865
3866// ==== `CTRL` Enum Conversion Functions =======================================
3867
3868impl FromMaskedBytes<1> for Ctrl {
3869    fn from_masked_le_bytes(val: &[u8; 1]) -> Self {
3870        match [val[0] & 0x3] {
3871            [0x2] => Self::BroadOnly,
3872            [0x1] => Self::IndGroup,
3873            [0x3] => Self::IndGroupBroad,
3874            [0x0] => Self::IndOnly,
3875            _ => unreachable!(),
3876        }
3877    }
3878}
3879
3880impl TryFromBytes<1> for Ctrl {
3881    type Error = FromBytesError;
3882
3883    fn try_from_le_bytes(val: &[u8; 1]) -> Result<Self, Self::Error> {
3884        let bytes_outside = [val[0] & 0xFC];
3885        if bytes_outside == [0; 1] {
3886            Ok(Self::from_masked_le_bytes(val))
3887        } else {
3888            Err(Self::Error {pos: 0})
3889        }
3890    }
3891}
3892
3893impl ToBytes<1> for Ctrl {
3894    fn to_le_bytes(&self) -> [u8; 1] {
3895        match self {
3896            Self::BroadOnly => [0x2],
3897            Self::IndGroup => [0x1],
3898            Self::IndGroupBroad => [0x3],
3899            Self::IndOnly => [0x0],
3900        }
3901    }
3902}
3903
3904// ==== `DATA` Enum Conversion Functions =======================================
3905
3906impl TryFromBytes<1> for Data {
3907    type Error = FromBytesError;
3908
3909    fn try_from_le_bytes(val: &[u8; 1]) -> Result<Self, Self::Error> {
3910        match val {
3911           [0x2] => Ok(Self::Band2g4),
3912           [0x0] => Ok(Self::Band433),
3913           [0x1] => Ok(Self::Band868),
3914            _ => Err(Self::Error {pos: 0})
3915        }
3916    }
3917}
3918
3919impl ToBytes<1> for Data {
3920    fn to_le_bytes(&self) -> [u8; 1] {
3921        match self {
3922            Self::Band2g4 => [0x2],
3923            Self::Band433 => [0x0],
3924            Self::Band868 => [0x1],
3925        }
3926    }
3927}
3928
3929// ==== `EXIT_COND` Enum Conversion Functions ==================================
3930
3931impl FromMaskedBytes<1> for ExitCond {
3932    fn from_masked_le_bytes(val: &[u8; 1]) -> Self {
3933        match [val[0] & 0x3] {
3934            [0x3] => Self::ForceQuit,
3935            [0x2] => Self::IdFail,
3936            [0x0] => Self::NoReason,
3937            [0x1] => Self::Timeout,
3938            _ => unreachable!(),
3939        }
3940    }
3941}
3942
3943impl TryFromBytes<1> for ExitCond {
3944    type Error = FromBytesError;
3945
3946    fn try_from_le_bytes(val: &[u8; 1]) -> Result<Self, Self::Error> {
3947        let bytes_outside = [val[0] & 0xFC];
3948        if bytes_outside == [0; 1] {
3949            Ok(Self::from_masked_le_bytes(val))
3950        } else {
3951            Err(Self::Error {pos: 0})
3952        }
3953    }
3954}
3955
3956impl ToBytes<1> for ExitCond {
3957    fn to_le_bytes(&self) -> [u8; 1] {
3958        match self {
3959            Self::ForceQuit => [0x3],
3960            Self::IdFail => [0x2],
3961            Self::NoReason => [0x0],
3962            Self::Timeout => [0x1],
3963        }
3964    }
3965}
3966
3967// ==== `FDD_MODE` Enum Conversion Functions ===================================
3968
3969impl FromMaskedBytes<1> for FddMode {
3970    fn from_masked_le_bytes(val: &[u8; 1]) -> Self {
3971        match [val[0] & 0x1] {
3972            [0x1] => Self::Fast,
3973            [0x0] => Self::Slow,
3974            _ => unreachable!(),
3975        }
3976    }
3977}
3978
3979impl TryFromBytes<1> for FddMode {
3980    type Error = FromBytesError;
3981
3982    fn try_from_le_bytes(val: &[u8; 1]) -> Result<Self, Self::Error> {
3983        let bytes_outside = [val[0] & 0xFE];
3984        if bytes_outside == [0; 1] {
3985            Ok(Self::from_masked_le_bytes(val))
3986        } else {
3987            Err(Self::Error {pos: 0})
3988        }
3989    }
3990}
3991
3992impl ToBytes<1> for FddMode {
3993    fn to_le_bytes(&self) -> [u8; 1] {
3994        match self {
3995            Self::Fast => [0x1],
3996            Self::Slow => [0x0],
3997        }
3998    }
3999}
4000
4001// ==== `FIFO_LEN` Enum Conversion Functions ===================================
4002
4003impl FromMaskedBytes<1> for FifoLen {
4004    fn from_masked_le_bytes(val: &[u8; 1]) -> Self {
4005        match [val[0] & 0x3] {
4006            [0x0] => Self::Bit16,
4007            [0x1] => Self::Bit24,
4008            [0x2] => Self::Bit32,
4009            [0x3] => Self::Bit40,
4010            _ => unreachable!(),
4011        }
4012    }
4013}
4014
4015impl TryFromBytes<1> for FifoLen {
4016    type Error = FromBytesError;
4017
4018    fn try_from_le_bytes(val: &[u8; 1]) -> Result<Self, Self::Error> {
4019        let bytes_outside = [val[0] & 0xFC];
4020        if bytes_outside == [0; 1] {
4021            Ok(Self::from_masked_le_bytes(val))
4022        } else {
4023            Err(Self::Error {pos: 0})
4024        }
4025    }
4026}
4027
4028impl ToBytes<1> for FifoLen {
4029    fn to_le_bytes(&self) -> [u8; 1] {
4030        match self {
4031            Self::Bit16 => [0x0],
4032            Self::Bit24 => [0x1],
4033            Self::Bit32 => [0x2],
4034            Self::Bit40 => [0x3],
4035        }
4036    }
4037}
4038
4039// ==== `KORREL_BRANCHES_LATEST` Enum Conversion Functions =====================
4040
4041impl TryFromBytes<1> for KorrelBranchesLatest {
4042    type Error = FromBytesError;
4043
4044    fn try_from_le_bytes(val: &[u8; 1]) -> Result<Self, Self::Error> {
4045        match val {
4046           [0x2] => Ok(Self::Band2g4),
4047           [0x0] => Ok(Self::Band433),
4048           [0x1] => Ok(Self::Band868),
4049            _ => Err(Self::Error {pos: 0})
4050        }
4051    }
4052}
4053
4054impl ToBytes<1> for KorrelBranchesLatest {
4055    fn to_le_bytes(&self) -> [u8; 1] {
4056        match self {
4057            Self::Band2g4 => [0x2],
4058            Self::Band433 => [0x0],
4059            Self::Band868 => [0x1],
4060        }
4061    }
4062}
4063
4064// ==== `OUT` Enum Conversion Functions ========================================
4065
4066impl TryFromBytes<1> for Out {
4067    type Error = FromBytesError;
4068
4069    fn try_from_le_bytes(val: &[u8; 1]) -> Result<Self, Self::Error> {
4070        match val {
4071           [0xE] => Ok(Self::Clk32IrqEvent),
4072           [0x6] => Ok(Self::IdmWupA433),
4073           [0xF] => Ok(Self::IrqEvent1),
4074           [0x0] => Ok(Self::Rx2g4),
4075           [0x2] => Ok(Self::Rx433),
4076           [0x1] => Ok(Self::Rx868),
4077           [0xA] => Ok(Self::WupA2g4RxActive),
4078           [0x8] => Ok(Self::WupA433RxActive),
4079           [0x9] => Ok(Self::WupA868RxActive),
4080           [0x3] => Ok(Self::WupAB2g4),
4081           [0x7] => Ok(Self::WupAB868),
4082            _ => Err(Self::Error {pos: 0})
4083        }
4084    }
4085}
4086
4087impl ToBytes<1> for Out {
4088    fn to_le_bytes(&self) -> [u8; 1] {
4089        match self {
4090            Self::Clk32IrqEvent => [0xE],
4091            Self::IdmWupA433 => [0x6],
4092            Self::IrqEvent1 => [0xF],
4093            Self::Rx2g4 => [0x0],
4094            Self::Rx433 => [0x2],
4095            Self::Rx868 => [0x1],
4096            Self::WupA2g4RxActive => [0xA],
4097            Self::WupA433RxActive => [0x8],
4098            Self::WupA868RxActive => [0x9],
4099            Self::WupAB2g4 => [0x3],
4100            Self::WupAB868 => [0x7],
4101        }
4102    }
4103}
4104
4105// ==== `REASON` Enum Conversion Functions =====================================
4106
4107impl FromMaskedBytes<1> for Reason {
4108    fn from_masked_le_bytes(val: &[u8; 1]) -> Self {
4109        match [val[0] & 0x3] {
4110            [0x3] => Self::BroadMatch,
4111            [0x2] => Self::GroupMatch,
4112            [0x1] => Self::IndMatch,
4113            [0x0] => Self::Unknown,
4114            _ => unreachable!(),
4115        }
4116    }
4117}
4118
4119impl TryFromBytes<1> for Reason {
4120    type Error = FromBytesError;
4121
4122    fn try_from_le_bytes(val: &[u8; 1]) -> Result<Self, Self::Error> {
4123        let bytes_outside = [val[0] & 0xFC];
4124        if bytes_outside == [0; 1] {
4125            Ok(Self::from_masked_le_bytes(val))
4126        } else {
4127            Err(Self::Error {pos: 0})
4128        }
4129    }
4130}
4131
4132impl ToBytes<1> for Reason {
4133    fn to_le_bytes(&self) -> [u8; 1] {
4134        match self {
4135            Self::BroadMatch => [0x3],
4136            Self::GroupMatch => [0x2],
4137            Self::IndMatch => [0x1],
4138            Self::Unknown => [0x0],
4139        }
4140    }
4141}
4142
4143// ==== `SAMPLE_RATE` Enum Conversion Functions ================================
4144
4145impl FromMaskedBytes<1> for SampleRate {
4146    fn from_masked_le_bytes(val: &[u8; 1]) -> Self {
4147        match [val[0] & 0x7] {
4148            [0x7] => Self::Sr0256,
4149            [0x6] => Self::Sr0512,
4150            [0x1] => Self::Sr16384,
4151            [0x5] => Self::Sr1024,
4152            [0x4] => Self::Sr2048,
4153            [0x0] => Self::Sr32768,
4154            [0x3] => Self::Sr4096,
4155            [0x2] => Self::Sr8192,
4156            _ => unreachable!(),
4157        }
4158    }
4159}
4160
4161impl TryFromBytes<1> for SampleRate {
4162    type Error = FromBytesError;
4163
4164    fn try_from_le_bytes(val: &[u8; 1]) -> Result<Self, Self::Error> {
4165        let bytes_outside = [val[0] & 0xF8];
4166        if bytes_outside == [0; 1] {
4167            Ok(Self::from_masked_le_bytes(val))
4168        } else {
4169            Err(Self::Error {pos: 0})
4170        }
4171    }
4172}
4173
4174impl ToBytes<1> for SampleRate {
4175    fn to_le_bytes(&self) -> [u8; 1] {
4176        match self {
4177            Self::Sr0256 => [0x7],
4178            Self::Sr0512 => [0x6],
4179            Self::Sr16384 => [0x1],
4180            Self::Sr1024 => [0x5],
4181            Self::Sr2048 => [0x4],
4182            Self::Sr32768 => [0x0],
4183            Self::Sr4096 => [0x3],
4184            Self::Sr8192 => [0x2],
4185        }
4186    }
4187}
4188
4189// ==== `ACTUAL_BANDSELECT` Layout Conversion Functions ========================
4190
4191impl ToBytes<1> for ActualBandselect {
4192    #[allow(clippy::cast_possible_truncation)]
4193    fn to_le_bytes(&self) -> [u8; 1] {
4194        let mut val: [u8; 1] = [0; 1];
4195        // SELECTED_BANDS @ ActualBandselect[2:0]:
4196        let selected_bands: [u8; 1] = self.selected_bands.to_le_bytes();
4197        val[0] |= selected_bands[0] & 0x7;
4198        val
4199    }
4200}
4201
4202impl FromBytes<1> for ActualBandselect {
4203    fn from_le_bytes(val: &[u8; 1]) -> Self {
4204        // SELECTED_BANDS @ ActualBandselect[2:0]:
4205        let mut selected_bands: [u8; 1] = [0; 1];
4206        selected_bands[0] |= val[0] & 0x7;
4207        Self {
4208          // SELECTED_BANDS @ ActualBandselect[2:0]:
4209          selected_bands: Bands::from_le_bytes(&selected_bands),
4210        }
4211    }
4212}
4213
4214impl From<ActualBandselect> for u8 {
4215    fn from(value: ActualBandselect) -> Self {
4216        Self::from_le_bytes(value.to_le_bytes())
4217    }
4218}
4219
4220impl From<u8> for ActualBandselect {
4221    fn from(value: u8) -> Self {
4222        Self::from_le_bytes(&value.to_le_bytes())
4223    }
4224}
4225
4226// ==== `ACTUAL_NFA_2G4` Layout Conversion Functions ===========================
4227
4228impl ToBytes<1> for ActualNfa2g4 {
4229    #[allow(clippy::cast_possible_truncation)]
4230    fn to_le_bytes(&self) -> [u8; 1] {
4231        let mut val: [u8; 1] = [0; 1];
4232        // FAST @ ActualNfa2g4[6:4]:
4233        let fast: [u8; 1] = self.fast.to_le_bytes();
4234        val[0] |= (fast[0] << 4) & 0x70;
4235        // SLOW @ ActualNfa2g4[2:0]:
4236        let slow: [u8; 1] = self.slow.to_le_bytes();
4237        val[0] |= slow[0] & 0x7;
4238        val
4239    }
4240}
4241
4242impl FromBytes<1> for ActualNfa2g4 {
4243    fn from_le_bytes(val: &[u8; 1]) -> Self {
4244        // FAST @ ActualNfa2g4[6:4]:
4245        let mut fast: [u8; 1] = [0; 1];
4246        fast[0] |= (val[0] & 0x70) >> 4;
4247        // SLOW @ ActualNfa2g4[2:0]:
4248        let mut slow: [u8; 1] = [0; 1];
4249        slow[0] |= val[0] & 0x7;
4250        Self {
4251          // FAST @ ActualNfa2g4[6:4]:
4252          fast: SampleRate::from_masked_le_bytes(&fast),
4253          // SLOW @ ActualNfa2g4[2:0]:
4254          slow: SampleRate::from_masked_le_bytes(&slow),
4255        }
4256    }
4257}
4258
4259impl From<ActualNfa2g4> for u8 {
4260    fn from(value: ActualNfa2g4) -> Self {
4261        Self::from_le_bytes(value.to_le_bytes())
4262    }
4263}
4264
4265impl From<u8> for ActualNfa2g4 {
4266    fn from(value: u8) -> Self {
4267        Self::from_le_bytes(&value.to_le_bytes())
4268    }
4269}
4270
4271// ==== `ACTUAL_NFA_433` Layout Conversion Functions ===========================
4272
4273impl ToBytes<1> for ActualNfa433 {
4274    #[allow(clippy::cast_possible_truncation)]
4275    fn to_le_bytes(&self) -> [u8; 1] {
4276        let mut val: [u8; 1] = [0; 1];
4277        // FAST @ ActualNfa433[6:4]:
4278        let fast: [u8; 1] = self.fast.to_le_bytes();
4279        val[0] |= (fast[0] << 4) & 0x70;
4280        // SLOW @ ActualNfa433[2:0]:
4281        let slow: [u8; 1] = self.slow.to_le_bytes();
4282        val[0] |= slow[0] & 0x7;
4283        val
4284    }
4285}
4286
4287impl FromBytes<1> for ActualNfa433 {
4288    fn from_le_bytes(val: &[u8; 1]) -> Self {
4289        // FAST @ ActualNfa433[6:4]:
4290        let mut fast: [u8; 1] = [0; 1];
4291        fast[0] |= (val[0] & 0x70) >> 4;
4292        // SLOW @ ActualNfa433[2:0]:
4293        let mut slow: [u8; 1] = [0; 1];
4294        slow[0] |= val[0] & 0x7;
4295        Self {
4296          // FAST @ ActualNfa433[6:4]:
4297          fast: SampleRate::from_masked_le_bytes(&fast),
4298          // SLOW @ ActualNfa433[2:0]:
4299          slow: SampleRate::from_masked_le_bytes(&slow),
4300        }
4301    }
4302}
4303
4304impl From<ActualNfa433> for u8 {
4305    fn from(value: ActualNfa433) -> Self {
4306        Self::from_le_bytes(value.to_le_bytes())
4307    }
4308}
4309
4310impl From<u8> for ActualNfa433 {
4311    fn from(value: u8) -> Self {
4312        Self::from_le_bytes(&value.to_le_bytes())
4313    }
4314}
4315
4316// ==== `ACTUAL_NFA_868` Layout Conversion Functions ===========================
4317
4318impl ToBytes<1> for ActualNfa868 {
4319    #[allow(clippy::cast_possible_truncation)]
4320    fn to_le_bytes(&self) -> [u8; 1] {
4321        let mut val: [u8; 1] = [0; 1];
4322        // FAST @ ActualNfa868[6:4]:
4323        let fast: [u8; 1] = self.fast.to_le_bytes();
4324        val[0] |= (fast[0] << 4) & 0x70;
4325        // SLOW @ ActualNfa868[2:0]:
4326        let slow: [u8; 1] = self.slow.to_le_bytes();
4327        val[0] |= slow[0] & 0x7;
4328        val
4329    }
4330}
4331
4332impl FromBytes<1> for ActualNfa868 {
4333    fn from_le_bytes(val: &[u8; 1]) -> Self {
4334        // FAST @ ActualNfa868[6:4]:
4335        let mut fast: [u8; 1] = [0; 1];
4336        fast[0] |= (val[0] & 0x70) >> 4;
4337        // SLOW @ ActualNfa868[2:0]:
4338        let mut slow: [u8; 1] = [0; 1];
4339        slow[0] |= val[0] & 0x7;
4340        Self {
4341          // FAST @ ActualNfa868[6:4]:
4342          fast: SampleRate::from_masked_le_bytes(&fast),
4343          // SLOW @ ActualNfa868[2:0]:
4344          slow: SampleRate::from_masked_le_bytes(&slow),
4345        }
4346    }
4347}
4348
4349impl From<ActualNfa868> for u8 {
4350    fn from(value: ActualNfa868) -> Self {
4351        Self::from_le_bytes(value.to_le_bytes())
4352    }
4353}
4354
4355impl From<u8> for ActualNfa868 {
4356    fn from(value: u8) -> Self {
4357        Self::from_le_bytes(&value.to_le_bytes())
4358    }
4359}
4360
4361// ==== `BANDS` Layout Conversion Functions ====================================
4362
4363impl ToBytes<1> for Bands {
4364    #[allow(clippy::cast_possible_truncation)]
4365    fn to_le_bytes(&self) -> [u8; 1] {
4366        let mut val: [u8; 1] = [0; 1];
4367        // BAND_2G4 @ Bands[2]:
4368        val[0] |= ((u8::from(self.band_2g4) << 2) & 0x4) as u8;
4369        // BAND_433 @ Bands[0]:
4370        val[0] |= (u8::from(self.band_433) & 0x1) as u8;
4371        // BAND_868 @ Bands[1]:
4372        val[0] |= ((u8::from(self.band_868) << 1) & 0x2) as u8;
4373        val
4374    }
4375}
4376
4377impl FromBytes<1> for Bands {
4378    fn from_le_bytes(val: &[u8; 1]) -> Self {
4379        Self {
4380          // BAND_2G4 @ Bands[2]:
4381          band_2g4: (val[0] & 0x4) >> 2 != 0,
4382          // BAND_433 @ Bands[0]:
4383          band_433: val[0] & 0x1 != 0,
4384          // BAND_868 @ Bands[1]:
4385          band_868: (val[0] & 0x2) >> 1 != 0,
4386        }
4387    }
4388}
4389
4390impl From<Bands> for u8 {
4391    fn from(value: Bands) -> Self {
4392        Self::from_le_bytes(value.to_le_bytes())
4393    }
4394}
4395
4396impl From<u8> for Bands {
4397    fn from(value: u8) -> Self {
4398        Self::from_le_bytes(&value.to_le_bytes())
4399    }
4400}
4401
4402// ==== `BAND_BRANCH_CTRL` Layout Conversion Functions =========================
4403
4404impl ToBytes<1> for BandBranchCtrl {
4405    #[allow(clippy::cast_possible_truncation)]
4406    fn to_le_bytes(&self) -> [u8; 1] {
4407        let mut val: [u8; 1] = [0; 1];
4408        // ACTIVE_BANDS @ BandBranchCtrl[6:4]:
4409        let active_bands: [u8; 1] = self.active_bands.to_le_bytes();
4410        val[0] |= (active_bands[0] << 4) & 0x70;
4411        // ACTIVE_BRANCHES @ BandBranchCtrl[2:0]:
4412        let active_branches: [u8; 1] = self.active_branches.to_le_bytes();
4413        val[0] |= active_branches[0] & 0x7;
4414        val
4415    }
4416}
4417
4418impl FromBytes<1> for BandBranchCtrl {
4419    fn from_le_bytes(val: &[u8; 1]) -> Self {
4420        // ACTIVE_BANDS @ BandBranchCtrl[6:4]:
4421        let mut active_bands: [u8; 1] = [0; 1];
4422        active_bands[0] |= (val[0] & 0x70) >> 4;
4423        // ACTIVE_BRANCHES @ BandBranchCtrl[2:0]:
4424        let mut active_branches: [u8; 1] = [0; 1];
4425        active_branches[0] |= val[0] & 0x7;
4426        Self {
4427          // ACTIVE_BANDS @ BandBranchCtrl[6:4]:
4428          active_bands: Bands::from_le_bytes(&active_bands),
4429          // ACTIVE_BRANCHES @ BandBranchCtrl[2:0]:
4430          active_branches: Branches::from_le_bytes(&active_branches),
4431        }
4432    }
4433}
4434
4435impl From<BandBranchCtrl> for u8 {
4436    fn from(value: BandBranchCtrl) -> Self {
4437        Self::from_le_bytes(value.to_le_bytes())
4438    }
4439}
4440
4441impl From<u8> for BandBranchCtrl {
4442    fn from(value: u8) -> Self {
4443        Self::from_le_bytes(&value.to_le_bytes())
4444    }
4445}
4446
4447// ==== `BRANCHES` Layout Conversion Functions =================================
4448
4449impl ToBytes<1> for Branches {
4450    #[allow(clippy::cast_possible_truncation)]
4451    fn to_le_bytes(&self) -> [u8; 1] {
4452        let mut val: [u8; 1] = [0; 1];
4453        // MEDIUM @ Branches[1]:
4454        val[0] |= ((u8::from(self.medium) << 1) & 0x2) as u8;
4455        // STRONG @ Branches[2]:
4456        val[0] |= ((u8::from(self.strong) << 2) & 0x4) as u8;
4457        // WEAK @ Branches[0]:
4458        val[0] |= (u8::from(self.weak) & 0x1) as u8;
4459        val
4460    }
4461}
4462
4463impl FromBytes<1> for Branches {
4464    fn from_le_bytes(val: &[u8; 1]) -> Self {
4465        Self {
4466          // MEDIUM @ Branches[1]:
4467          medium: (val[0] & 0x2) >> 1 != 0,
4468          // STRONG @ Branches[2]:
4469          strong: (val[0] & 0x4) >> 2 != 0,
4470          // WEAK @ Branches[0]:
4471          weak: val[0] & 0x1 != 0,
4472        }
4473    }
4474}
4475
4476impl From<Branches> for u8 {
4477    fn from(value: Branches) -> Self {
4478        Self::from_le_bytes(value.to_le_bytes())
4479    }
4480}
4481
4482impl From<u8> for Branches {
4483    fn from(value: u8) -> Self {
4484        Self::from_le_bytes(&value.to_le_bytes())
4485    }
4486}
4487
4488// ==== `CALIB_CTRL` Layout Conversion Functions ===============================
4489
4490impl ToBytes<1> for CalibCtrl {
4491    #[allow(clippy::cast_possible_truncation)]
4492    fn to_le_bytes(&self) -> [u8; 1] {
4493        let mut val: [u8; 1] = [0; 1];
4494        // CAL_START @ CalibCtrl[0]:
4495        val[0] |= (u8::from(self.cal_start) & 0x1) as u8;
4496        // LCO_CAL @ CalibCtrl[1]:
4497        val[0] |= ((u8::from(self.lco_cal) << 1) & 0x2) as u8;
4498        // OFFSET_CAL @ CalibCtrl[3]:
4499        val[0] |= ((u8::from(self.offset_cal) << 3) & 0x8) as u8;
4500        // SPG_CAL @ CalibCtrl[2]:
4501        val[0] |= ((u8::from(self.spg_cal) << 2) & 0x4) as u8;
4502        val
4503    }
4504}
4505
4506impl FromBytes<1> for CalibCtrl {
4507    fn from_le_bytes(val: &[u8; 1]) -> Self {
4508        Self {
4509          // CAL_START @ CalibCtrl[0]:
4510          cal_start: val[0] & 0x1 != 0,
4511          // LCO_CAL @ CalibCtrl[1]:
4512          lco_cal: (val[0] & 0x2) >> 1 != 0,
4513          // OFFSET_CAL @ CalibCtrl[3]:
4514          offset_cal: (val[0] & 0x8) >> 3 != 0,
4515          // SPG_CAL @ CalibCtrl[2]:
4516          spg_cal: (val[0] & 0x4) >> 2 != 0,
4517        }
4518    }
4519}
4520
4521impl From<CalibCtrl> for u8 {
4522    fn from(value: CalibCtrl) -> Self {
4523        Self::from_le_bytes(value.to_le_bytes())
4524    }
4525}
4526
4527impl From<u8> for CalibCtrl {
4528    fn from(value: u8) -> Self {
4529        Self::from_le_bytes(&value.to_le_bytes())
4530    }
4531}
4532
4533// ==== `CALIB_STATUS` Layout Conversion Functions =============================
4534
4535impl ToBytes<1> for CalibStatus {
4536    #[allow(clippy::cast_possible_truncation)]
4537    fn to_le_bytes(&self) -> [u8; 1] {
4538        let mut val: [u8; 1] = [0; 1];
4539        // CAL_IN_PROG @ CalibStatus[0]:
4540        val[0] |= (u8::from(self.cal_in_prog) & 0x1) as u8;
4541        // LCO_CAL_IN_PROG @ CalibStatus[1]:
4542        val[0] |= ((u8::from(self.lco_cal_in_prog) << 1) & 0x2) as u8;
4543        // OFFSET_CAL_IN_PROG @ CalibStatus[3]:
4544        val[0] |= ((u8::from(self.offset_cal_in_prog) << 3) & 0x8) as u8;
4545        // SPG_CAL_IN_PROG @ CalibStatus[2]:
4546        val[0] |= ((u8::from(self.spg_cal_in_prog) << 2) & 0x4) as u8;
4547        val
4548    }
4549}
4550
4551impl FromBytes<1> for CalibStatus {
4552    fn from_le_bytes(val: &[u8; 1]) -> Self {
4553        Self {
4554          // CAL_IN_PROG @ CalibStatus[0]:
4555          cal_in_prog: val[0] & 0x1 != 0,
4556          // LCO_CAL_IN_PROG @ CalibStatus[1]:
4557          lco_cal_in_prog: (val[0] & 0x2) >> 1 != 0,
4558          // OFFSET_CAL_IN_PROG @ CalibStatus[3]:
4559          offset_cal_in_prog: (val[0] & 0x8) >> 3 != 0,
4560          // SPG_CAL_IN_PROG @ CalibStatus[2]:
4561          spg_cal_in_prog: (val[0] & 0x4) >> 2 != 0,
4562        }
4563    }
4564}
4565
4566impl From<CalibStatus> for u8 {
4567    fn from(value: CalibStatus) -> Self {
4568        Self::from_le_bytes(value.to_le_bytes())
4569    }
4570}
4571
4572impl From<u8> for CalibStatus {
4573    fn from(value: u8) -> Self {
4574        Self::from_le_bytes(&value.to_le_bytes())
4575    }
4576}
4577
4578// ==== `CNTR40_0` Layout Conversion Functions =================================
4579
4580impl ToBytes<1> for Cntr400 {
4581    #[allow(clippy::cast_possible_truncation)]
4582    fn to_le_bytes(&self) -> [u8; 1] {
4583        let mut val: [u8; 1] = [0; 1];
4584        // DATA @ Cntr400[7:0]:
4585        val[0] |= self.data as u8;
4586        val
4587    }
4588}
4589
4590impl FromBytes<1> for Cntr400 {
4591    fn from_le_bytes(val: &[u8; 1]) -> Self {
4592        Self {
4593          // DATA @ Cntr400[7:0]:
4594          data: val[0],
4595        }
4596    }
4597}
4598
4599impl From<Cntr400> for u8 {
4600    fn from(value: Cntr400) -> Self {
4601        Self::from_le_bytes(value.to_le_bytes())
4602    }
4603}
4604
4605impl From<u8> for Cntr400 {
4606    fn from(value: u8) -> Self {
4607        Self::from_le_bytes(&value.to_le_bytes())
4608    }
4609}
4610
4611// ==== `CNTR40_1` Layout Conversion Functions =================================
4612
4613impl ToBytes<1> for Cntr401 {
4614    #[allow(clippy::cast_possible_truncation)]
4615    fn to_le_bytes(&self) -> [u8; 1] {
4616        let mut val: [u8; 1] = [0; 1];
4617        // DATA @ Cntr401[7:0]:
4618        val[0] |= self.data as u8;
4619        val
4620    }
4621}
4622
4623impl FromBytes<1> for Cntr401 {
4624    fn from_le_bytes(val: &[u8; 1]) -> Self {
4625        Self {
4626          // DATA @ Cntr401[7:0]:
4627          data: val[0],
4628        }
4629    }
4630}
4631
4632impl From<Cntr401> for u8 {
4633    fn from(value: Cntr401) -> Self {
4634        Self::from_le_bytes(value.to_le_bytes())
4635    }
4636}
4637
4638impl From<u8> for Cntr401 {
4639    fn from(value: u8) -> Self {
4640        Self::from_le_bytes(&value.to_le_bytes())
4641    }
4642}
4643
4644// ==== `CNTR40_2` Layout Conversion Functions =================================
4645
4646impl ToBytes<1> for Cntr402 {
4647    #[allow(clippy::cast_possible_truncation)]
4648    fn to_le_bytes(&self) -> [u8; 1] {
4649        let mut val: [u8; 1] = [0; 1];
4650        // DATA @ Cntr402[7:0]:
4651        val[0] |= self.data as u8;
4652        val
4653    }
4654}
4655
4656impl FromBytes<1> for Cntr402 {
4657    fn from_le_bytes(val: &[u8; 1]) -> Self {
4658        Self {
4659          // DATA @ Cntr402[7:0]:
4660          data: val[0],
4661        }
4662    }
4663}
4664
4665impl From<Cntr402> for u8 {
4666    fn from(value: Cntr402) -> Self {
4667        Self::from_le_bytes(value.to_le_bytes())
4668    }
4669}
4670
4671impl From<u8> for Cntr402 {
4672    fn from(value: u8) -> Self {
4673        Self::from_le_bytes(&value.to_le_bytes())
4674    }
4675}
4676
4677// ==== `CNTR40_3` Layout Conversion Functions =================================
4678
4679impl ToBytes<1> for Cntr403 {
4680    #[allow(clippy::cast_possible_truncation)]
4681    fn to_le_bytes(&self) -> [u8; 1] {
4682        let mut val: [u8; 1] = [0; 1];
4683        // DATA @ Cntr403[7:0]:
4684        val[0] |= self.data as u8;
4685        val
4686    }
4687}
4688
4689impl FromBytes<1> for Cntr403 {
4690    fn from_le_bytes(val: &[u8; 1]) -> Self {
4691        Self {
4692          // DATA @ Cntr403[7:0]:
4693          data: val[0],
4694        }
4695    }
4696}
4697
4698impl From<Cntr403> for u8 {
4699    fn from(value: Cntr403) -> Self {
4700        Self::from_le_bytes(value.to_le_bytes())
4701    }
4702}
4703
4704impl From<u8> for Cntr403 {
4705    fn from(value: u8) -> Self {
4706        Self::from_le_bytes(&value.to_le_bytes())
4707    }
4708}
4709
4710// ==== `CNTR40_4` Layout Conversion Functions =================================
4711
4712impl ToBytes<1> for Cntr404 {
4713    #[allow(clippy::cast_possible_truncation)]
4714    fn to_le_bytes(&self) -> [u8; 1] {
4715        let mut val: [u8; 1] = [0; 1];
4716        // DATA @ Cntr404[7:0]:
4717        val[0] |= self.data as u8;
4718        val
4719    }
4720}
4721
4722impl FromBytes<1> for Cntr404 {
4723    fn from_le_bytes(val: &[u8; 1]) -> Self {
4724        Self {
4725          // DATA @ Cntr404[7:0]:
4726          data: val[0],
4727        }
4728    }
4729}
4730
4731impl From<Cntr404> for u8 {
4732    fn from(value: Cntr404) -> Self {
4733        Self::from_le_bytes(value.to_le_bytes())
4734    }
4735}
4736
4737impl From<u8> for Cntr404 {
4738    fn from(value: u8) -> Self {
4739        Self::from_le_bytes(&value.to_le_bytes())
4740    }
4741}
4742
4743// ==== `CNTR40_CLR` Layout Conversion Functions ===============================
4744
4745impl ToBytes<1> for Cntr40Clr {
4746    #[allow(clippy::cast_possible_truncation)]
4747    fn to_le_bytes(&self) -> [u8; 1] {
4748        let mut val: [u8; 1] = [0; 1];
4749        // CLR @ Cntr40Clr[0]:
4750        val[0] |= (u8::from(self.clr) & 0x1) as u8;
4751        val
4752    }
4753}
4754
4755impl FromBytes<1> for Cntr40Clr {
4756    fn from_le_bytes(val: &[u8; 1]) -> Self {
4757        Self {
4758          // CLR @ Cntr40Clr[0]:
4759          clr: val[0] & 0x1 != 0,
4760        }
4761    }
4762}
4763
4764impl From<Cntr40Clr> for u8 {
4765    fn from(value: Cntr40Clr) -> Self {
4766        Self::from_le_bytes(value.to_le_bytes())
4767    }
4768}
4769
4770impl From<u8> for Cntr40Clr {
4771    fn from(value: u8) -> Self {
4772        Self::from_le_bytes(&value.to_le_bytes())
4773    }
4774}
4775
4776// ==== `CODE_SELECT` Layout Conversion Functions ==============================
4777
4778impl ToBytes<1> for CodeSelect {
4779    #[allow(clippy::cast_possible_truncation)]
4780    fn to_le_bytes(&self) -> [u8; 1] {
4781        let mut val: [u8; 1] = [0; 1];
4782        // A @ CodeSelect[3:0]:
4783        let a: [u8; 1] = self.a.to_le_bytes();
4784        val[0] |= a[0] & 0xF;
4785        // B @ CodeSelect[7:4]:
4786        let b: [u8; 1] = self.b.to_le_bytes();
4787        val[0] |= (b[0] << 4) & 0xF0;
4788        val
4789    }
4790}
4791
4792impl FromBytes<1> for CodeSelect {
4793    fn from_le_bytes(val: &[u8; 1]) -> Self {
4794        // A @ CodeSelect[3:0]:
4795        let mut a: [u8; 1] = [0; 1];
4796        a[0] |= val[0] & 0xF;
4797        // B @ CodeSelect[7:4]:
4798        let mut b: [u8; 1] = [0; 1];
4799        b[0] |= (val[0] & 0xF0) >> 4;
4800        Self {
4801          // A @ CodeSelect[3:0]:
4802          a: BinCode::from_masked_le_bytes(&a),
4803          // B @ CodeSelect[7:4]:
4804          b: BinCode::from_masked_le_bytes(&b),
4805        }
4806    }
4807}
4808
4809impl From<CodeSelect> for u8 {
4810    fn from(value: CodeSelect) -> Self {
4811        Self::from_le_bytes(value.to_le_bytes())
4812    }
4813}
4814
4815impl From<u8> for CodeSelect {
4816    fn from(value: u8) -> Self {
4817        Self::from_le_bytes(&value.to_le_bytes())
4818    }
4819}
4820
4821// ==== `COMP_THRESH_W` Layout Conversion Functions ============================
4822
4823impl ToBytes<1> for CompThreshW {
4824    #[allow(clippy::cast_possible_truncation)]
4825    fn to_le_bytes(&self) -> [u8; 1] {
4826        let mut val: [u8; 1] = [0; 1];
4827        // DATA @ CompThreshW[7:0]:
4828        val[0] |= self.data as u8;
4829        val
4830    }
4831}
4832
4833impl FromBytes<1> for CompThreshW {
4834    fn from_le_bytes(val: &[u8; 1]) -> Self {
4835        Self {
4836          // DATA @ CompThreshW[7:0]:
4837          data: val[0],
4838        }
4839    }
4840}
4841
4842impl From<CompThreshW> for u8 {
4843    fn from(value: CompThreshW) -> Self {
4844        Self::from_le_bytes(value.to_le_bytes())
4845    }
4846}
4847
4848impl From<u8> for CompThreshW {
4849    fn from(value: u8) -> Self {
4850        Self::from_le_bytes(&value.to_le_bytes())
4851    }
4852}
4853
4854// ==== `CYCLPRESC` Layout Conversion Functions ================================
4855
4856impl ToBytes<1> for Cyclpresc {
4857    #[allow(clippy::cast_possible_truncation)]
4858    fn to_le_bytes(&self) -> [u8; 1] {
4859        let mut val: [u8; 1] = [0; 1];
4860        // DATA @ Cyclpresc[7:0]:
4861        val[0] |= self.data as u8;
4862        val
4863    }
4864}
4865
4866impl FromBytes<1> for Cyclpresc {
4867    fn from_le_bytes(val: &[u8; 1]) -> Self {
4868        Self {
4869          // DATA @ Cyclpresc[7:0]:
4870          data: val[0],
4871        }
4872    }
4873}
4874
4875impl From<Cyclpresc> for u8 {
4876    fn from(value: Cyclpresc) -> Self {
4877        Self::from_le_bytes(value.to_le_bytes())
4878    }
4879}
4880
4881impl From<u8> for Cyclpresc {
4882    fn from(value: u8) -> Self {
4883        Self::from_le_bytes(&value.to_le_bytes())
4884    }
4885}
4886
4887// ==== `CYCLTOP_HI` Layout Conversion Functions ===============================
4888
4889impl ToBytes<1> for CycltopHi {
4890    #[allow(clippy::cast_possible_truncation)]
4891    fn to_le_bytes(&self) -> [u8; 1] {
4892        let mut val: [u8; 1] = [0; 1];
4893        // DATA @ CycltopHi[7:0]:
4894        val[0] |= self.data as u8;
4895        val
4896    }
4897}
4898
4899impl FromBytes<1> for CycltopHi {
4900    fn from_le_bytes(val: &[u8; 1]) -> Self {
4901        Self {
4902          // DATA @ CycltopHi[7:0]:
4903          data: val[0],
4904        }
4905    }
4906}
4907
4908impl From<CycltopHi> for u8 {
4909    fn from(value: CycltopHi) -> Self {
4910        Self::from_le_bytes(value.to_le_bytes())
4911    }
4912}
4913
4914impl From<u8> for CycltopHi {
4915    fn from(value: u8) -> Self {
4916        Self::from_le_bytes(&value.to_le_bytes())
4917    }
4918}
4919
4920// ==== `CYCLTOP_LO` Layout Conversion Functions ===============================
4921
4922impl ToBytes<1> for CycltopLo {
4923    #[allow(clippy::cast_possible_truncation)]
4924    fn to_le_bytes(&self) -> [u8; 1] {
4925        let mut val: [u8; 1] = [0; 1];
4926        // DATA @ CycltopLo[7:0]:
4927        val[0] |= self.data as u8;
4928        val
4929    }
4930}
4931
4932impl FromBytes<1> for CycltopLo {
4933    fn from_le_bytes(val: &[u8; 1]) -> Self {
4934        Self {
4935          // DATA @ CycltopLo[7:0]:
4936          data: val[0],
4937        }
4938    }
4939}
4940
4941impl From<CycltopLo> for u8 {
4942    fn from(value: CycltopLo) -> Self {
4943        Self::from_le_bytes(value.to_le_bytes())
4944    }
4945}
4946
4947impl From<u8> for CycltopLo {
4948    fn from(value: u8) -> Self {
4949        Self::from_le_bytes(&value.to_le_bytes())
4950    }
4951}
4952
4953// ==== `D_CORNER_CTRL` Layout Conversion Functions ============================
4954
4955impl ToBytes<1> for DCornerCtrl {
4956    #[allow(clippy::cast_possible_truncation)]
4957    fn to_le_bytes(&self) -> [u8; 1] {
4958        let mut val: [u8; 1] = [0; 1];
4959        // DATA @ DCornerCtrl[7:0]:
4960        val[0] |= self.data as u8;
4961        val
4962    }
4963}
4964
4965impl FromBytes<1> for DCornerCtrl {
4966    fn from_le_bytes(val: &[u8; 1]) -> Self {
4967        Self {
4968          // DATA @ DCornerCtrl[7:0]:
4969          data: val[0],
4970        }
4971    }
4972}
4973
4974impl From<DCornerCtrl> for u8 {
4975    fn from(value: DCornerCtrl) -> Self {
4976        Self::from_le_bytes(value.to_le_bytes())
4977    }
4978}
4979
4980impl From<u8> for DCornerCtrl {
4981    fn from(value: u8) -> Self {
4982        Self::from_le_bytes(&value.to_le_bytes())
4983    }
4984}
4985
4986// ==== `FDD_ACTIVE` Layout Conversion Functions ===============================
4987
4988impl ToBytes<1> for FddActive {
4989    #[allow(clippy::cast_possible_truncation)]
4990    fn to_le_bytes(&self) -> [u8; 1] {
4991        let mut val: [u8; 1] = [0; 1];
4992        // BAND_2G4 @ FddActive[0]:
4993        let band_2g4: [u8; 1] = self.band_2g4.to_le_bytes();
4994        val[0] |= band_2g4[0] & 0x1;
4995        // BAND_433 @ FddActive[2]:
4996        let band_433: [u8; 1] = self.band_433.to_le_bytes();
4997        val[0] |= (band_433[0] << 2) & 0x4;
4998        // BAND_868 @ FddActive[1]:
4999        let band_868: [u8; 1] = self.band_868.to_le_bytes();
5000        val[0] |= (band_868[0] << 1) & 0x2;
5001        val
5002    }
5003}
5004
5005impl FromBytes<1> for FddActive {
5006    fn from_le_bytes(val: &[u8; 1]) -> Self {
5007        // BAND_2G4 @ FddActive[0]:
5008        let mut band_2g4: [u8; 1] = [0; 1];
5009        band_2g4[0] |= val[0] & 0x1;
5010        // BAND_433 @ FddActive[2]:
5011        let mut band_433: [u8; 1] = [0; 1];
5012        band_433[0] |= (val[0] & 0x4) >> 2;
5013        // BAND_868 @ FddActive[1]:
5014        let mut band_868: [u8; 1] = [0; 1];
5015        band_868[0] |= (val[0] & 0x2) >> 1;
5016        Self {
5017          // BAND_2G4 @ FddActive[0]:
5018          band_2g4: FddMode::from_masked_le_bytes(&band_2g4),
5019          // BAND_433 @ FddActive[2]:
5020          band_433: FddMode::from_masked_le_bytes(&band_433),
5021          // BAND_868 @ FddActive[1]:
5022          band_868: FddMode::from_masked_le_bytes(&band_868),
5023        }
5024    }
5025}
5026
5027impl From<FddActive> for u8 {
5028    fn from(value: FddActive) -> Self {
5029        Self::from_le_bytes(value.to_le_bytes())
5030    }
5031}
5032
5033impl From<u8> for FddActive {
5034    fn from(value: u8) -> Self {
5035        Self::from_le_bytes(&value.to_le_bytes())
5036    }
5037}
5038
5039// ==== `FDD_ENABLE` Layout Conversion Functions ===============================
5040
5041impl ToBytes<1> for FddEnable {
5042    #[allow(clippy::cast_possible_truncation)]
5043    fn to_le_bytes(&self) -> [u8; 1] {
5044        let mut val: [u8; 1] = [0; 1];
5045        // FDD_BANDS @ FddEnable[2:0]:
5046        let fdd_bands: [u8; 1] = self.fdd_bands.to_le_bytes();
5047        val[0] |= fdd_bands[0] & 0x7;
5048        val
5049    }
5050}
5051
5052impl FromBytes<1> for FddEnable {
5053    fn from_le_bytes(val: &[u8; 1]) -> Self {
5054        // FDD_BANDS @ FddEnable[2:0]:
5055        let mut fdd_bands: [u8; 1] = [0; 1];
5056        fdd_bands[0] |= val[0] & 0x7;
5057        Self {
5058          // FDD_BANDS @ FddEnable[2:0]:
5059          fdd_bands: Bands::from_le_bytes(&fdd_bands),
5060        }
5061    }
5062}
5063
5064impl From<FddEnable> for u8 {
5065    fn from(value: FddEnable) -> Self {
5066        Self::from_le_bytes(value.to_le_bytes())
5067    }
5068}
5069
5070impl From<u8> for FddEnable {
5071    fn from(value: u8) -> Self {
5072        Self::from_le_bytes(&value.to_le_bytes())
5073    }
5074}
5075
5076// ==== `FDD_EXIT_COND` Layout Conversion Functions ============================
5077
5078impl ToBytes<1> for FddExitCond {
5079    #[allow(clippy::cast_possible_truncation)]
5080    fn to_le_bytes(&self) -> [u8; 1] {
5081        let mut val: [u8; 1] = [0; 1];
5082        // BAND_2G4 @ FddExitCond[5:4]:
5083        let band_2g4: [u8; 1] = self.band_2g4.to_le_bytes();
5084        val[0] |= (band_2g4[0] << 4) & 0x30;
5085        // BAND_433 @ FddExitCond[1:0]:
5086        let band_433: [u8; 1] = self.band_433.to_le_bytes();
5087        val[0] |= band_433[0] & 0x3;
5088        // BAND_868 @ FddExitCond[3:2]:
5089        let band_868: [u8; 1] = self.band_868.to_le_bytes();
5090        val[0] |= (band_868[0] << 2) & 0xC;
5091        val
5092    }
5093}
5094
5095impl FromBytes<1> for FddExitCond {
5096    fn from_le_bytes(val: &[u8; 1]) -> Self {
5097        // BAND_2G4 @ FddExitCond[5:4]:
5098        let mut band_2g4: [u8; 1] = [0; 1];
5099        band_2g4[0] |= (val[0] & 0x30) >> 4;
5100        // BAND_433 @ FddExitCond[1:0]:
5101        let mut band_433: [u8; 1] = [0; 1];
5102        band_433[0] |= val[0] & 0x3;
5103        // BAND_868 @ FddExitCond[3:2]:
5104        let mut band_868: [u8; 1] = [0; 1];
5105        band_868[0] |= (val[0] & 0xC) >> 2;
5106        Self {
5107          // BAND_2G4 @ FddExitCond[5:4]:
5108          band_2g4: ExitCond::from_masked_le_bytes(&band_2g4),
5109          // BAND_433 @ FddExitCond[1:0]:
5110          band_433: ExitCond::from_masked_le_bytes(&band_433),
5111          // BAND_868 @ FddExitCond[3:2]:
5112          band_868: ExitCond::from_masked_le_bytes(&band_868),
5113        }
5114    }
5115}
5116
5117impl From<FddExitCond> for u8 {
5118    fn from(value: FddExitCond) -> Self {
5119        Self::from_le_bytes(value.to_le_bytes())
5120    }
5121}
5122
5123impl From<u8> for FddExitCond {
5124    fn from(value: u8) -> Self {
5125        Self::from_le_bytes(&value.to_le_bytes())
5126    }
5127}
5128
5129// ==== `FIFO_COUNT_2G4` Layout Conversion Functions ===========================
5130
5131impl ToBytes<1> for FifoCount2g4 {
5132    #[allow(clippy::cast_possible_truncation)]
5133    fn to_le_bytes(&self) -> [u8; 1] {
5134        let mut val: [u8; 1] = [0; 1];
5135        // DATA @ FifoCount2g4[5:0]:
5136        val[0] |= (self.data & 0x3F) as u8;
5137        val
5138    }
5139}
5140
5141impl FromBytes<1> for FifoCount2g4 {
5142    fn from_le_bytes(val: &[u8; 1]) -> Self {
5143        Self {
5144          // DATA @ FifoCount2g4[5:0]:
5145          data: val[0] & 0x3F,
5146        }
5147    }
5148}
5149
5150impl From<FifoCount2g4> for u8 {
5151    fn from(value: FifoCount2g4) -> Self {
5152        Self::from_le_bytes(value.to_le_bytes())
5153    }
5154}
5155
5156impl From<u8> for FifoCount2g4 {
5157    fn from(value: u8) -> Self {
5158        Self::from_le_bytes(&value.to_le_bytes())
5159    }
5160}
5161
5162// ==== `FIFO_COUNT_433` Layout Conversion Functions ===========================
5163
5164impl ToBytes<1> for FifoCount433 {
5165    #[allow(clippy::cast_possible_truncation)]
5166    fn to_le_bytes(&self) -> [u8; 1] {
5167        let mut val: [u8; 1] = [0; 1];
5168        // DATA @ FifoCount433[5:0]:
5169        val[0] |= (self.data & 0x3F) as u8;
5170        val
5171    }
5172}
5173
5174impl FromBytes<1> for FifoCount433 {
5175    fn from_le_bytes(val: &[u8; 1]) -> Self {
5176        Self {
5177          // DATA @ FifoCount433[5:0]:
5178          data: val[0] & 0x3F,
5179        }
5180    }
5181}
5182
5183impl From<FifoCount433> for u8 {
5184    fn from(value: FifoCount433) -> Self {
5185        Self::from_le_bytes(value.to_le_bytes())
5186    }
5187}
5188
5189impl From<u8> for FifoCount433 {
5190    fn from(value: u8) -> Self {
5191        Self::from_le_bytes(&value.to_le_bytes())
5192    }
5193}
5194
5195// ==== `FIFO_COUNT_868` Layout Conversion Functions ===========================
5196
5197impl ToBytes<1> for FifoCount868 {
5198    #[allow(clippy::cast_possible_truncation)]
5199    fn to_le_bytes(&self) -> [u8; 1] {
5200        let mut val: [u8; 1] = [0; 1];
5201        // DATA @ FifoCount868[5:0]:
5202        val[0] |= (self.data & 0x3F) as u8;
5203        val
5204    }
5205}
5206
5207impl FromBytes<1> for FifoCount868 {
5208    fn from_le_bytes(val: &[u8; 1]) -> Self {
5209        Self {
5210          // DATA @ FifoCount868[5:0]:
5211          data: val[0] & 0x3F,
5212        }
5213    }
5214}
5215
5216impl From<FifoCount868> for u8 {
5217    fn from(value: FifoCount868) -> Self {
5218        Self::from_le_bytes(value.to_le_bytes())
5219    }
5220}
5221
5222impl From<u8> for FifoCount868 {
5223    fn from(value: u8) -> Self {
5224        Self::from_le_bytes(&value.to_le_bytes())
5225    }
5226}
5227
5228// ==== `FIFO_LENGTH` Layout Conversion Functions ==============================
5229
5230impl ToBytes<1> for FifoLength {
5231    #[allow(clippy::cast_possible_truncation)]
5232    fn to_le_bytes(&self) -> [u8; 1] {
5233        let mut val: [u8; 1] = [0; 1];
5234        // BAND_2G4 @ FifoLength[5:4]:
5235        let band_2g4: [u8; 1] = self.band_2g4.to_le_bytes();
5236        val[0] |= (band_2g4[0] << 4) & 0x30;
5237        // BAND_433 @ FifoLength[1:0]:
5238        let band_433: [u8; 1] = self.band_433.to_le_bytes();
5239        val[0] |= band_433[0] & 0x3;
5240        // BAND_868 @ FifoLength[3:2]:
5241        let band_868: [u8; 1] = self.band_868.to_le_bytes();
5242        val[0] |= (band_868[0] << 2) & 0xC;
5243        val
5244    }
5245}
5246
5247impl FromBytes<1> for FifoLength {
5248    fn from_le_bytes(val: &[u8; 1]) -> Self {
5249        // BAND_2G4 @ FifoLength[5:4]:
5250        let mut band_2g4: [u8; 1] = [0; 1];
5251        band_2g4[0] |= (val[0] & 0x30) >> 4;
5252        // BAND_433 @ FifoLength[1:0]:
5253        let mut band_433: [u8; 1] = [0; 1];
5254        band_433[0] |= val[0] & 0x3;
5255        // BAND_868 @ FifoLength[3:2]:
5256        let mut band_868: [u8; 1] = [0; 1];
5257        band_868[0] |= (val[0] & 0xC) >> 2;
5258        Self {
5259          // BAND_2G4 @ FifoLength[5:4]:
5260          band_2g4: FifoLen::from_masked_le_bytes(&band_2g4),
5261          // BAND_433 @ FifoLength[1:0]:
5262          band_433: FifoLen::from_masked_le_bytes(&band_433),
5263          // BAND_868 @ FifoLength[3:2]:
5264          band_868: FifoLen::from_masked_le_bytes(&band_868),
5265        }
5266    }
5267}
5268
5269impl From<FifoLength> for u8 {
5270    fn from(value: FifoLength) -> Self {
5271        Self::from_le_bytes(value.to_le_bytes())
5272    }
5273}
5274
5275impl From<u8> for FifoLength {
5276    fn from(value: u8) -> Self {
5277        Self::from_le_bytes(&value.to_le_bytes())
5278    }
5279}
5280
5281// ==== `FO_QUIT` Layout Conversion Functions ==================================
5282
5283impl ToBytes<1> for FoQuit {
5284    #[allow(clippy::cast_possible_truncation)]
5285    fn to_le_bytes(&self) -> [u8; 1] {
5286        let mut val: [u8; 1] = [0; 1];
5287        // QUIT_BANDS @ FoQuit[2:0]:
5288        let quit_bands: [u8; 1] = self.quit_bands.to_le_bytes();
5289        val[0] |= quit_bands[0] & 0x7;
5290        val
5291    }
5292}
5293
5294impl FromBytes<1> for FoQuit {
5295    fn from_le_bytes(val: &[u8; 1]) -> Self {
5296        // QUIT_BANDS @ FoQuit[2:0]:
5297        let mut quit_bands: [u8; 1] = [0; 1];
5298        quit_bands[0] |= val[0] & 0x7;
5299        Self {
5300          // QUIT_BANDS @ FoQuit[2:0]:
5301          quit_bands: Bands::from_le_bytes(&quit_bands),
5302        }
5303    }
5304}
5305
5306impl From<FoQuit> for u8 {
5307    fn from(value: FoQuit) -> Self {
5308        Self::from_le_bytes(value.to_le_bytes())
5309    }
5310}
5311
5312impl From<u8> for FoQuit {
5313    fn from(value: u8) -> Self {
5314        Self::from_le_bytes(&value.to_le_bytes())
5315    }
5316}
5317
5318// ==== `GENPURP_1` Layout Conversion Functions ================================
5319
5320impl ToBytes<1> for Genpurp1 {
5321    #[allow(clippy::cast_possible_truncation)]
5322    fn to_le_bytes(&self) -> [u8; 1] {
5323        let mut val: [u8; 1] = [0; 1];
5324        // DATA @ Genpurp1[7:0]:
5325        val[0] |= self.data as u8;
5326        val
5327    }
5328}
5329
5330impl FromBytes<1> for Genpurp1 {
5331    fn from_le_bytes(val: &[u8; 1]) -> Self {
5332        Self {
5333          // DATA @ Genpurp1[7:0]:
5334          data: val[0],
5335        }
5336    }
5337}
5338
5339impl From<Genpurp1> for u8 {
5340    fn from(value: Genpurp1) -> Self {
5341        Self::from_le_bytes(value.to_le_bytes())
5342    }
5343}
5344
5345impl From<u8> for Genpurp1 {
5346    fn from(value: u8) -> Self {
5347        Self::from_le_bytes(&value.to_le_bytes())
5348    }
5349}
5350
5351// ==== `IDM_BAND` Layout Conversion Functions =================================
5352
5353impl ToBytes<1> for IdmBand {
5354    #[allow(clippy::cast_possible_truncation)]
5355    fn to_le_bytes(&self) -> [u8; 1] {
5356        let mut val: [u8; 1] = [0; 1];
5357        // DATA @ IdmBand[1:0]:
5358        let data: [u8; 1] = self.data.to_le_bytes();
5359        val[0] |= data[0] & 0x3;
5360        val
5361    }
5362}
5363
5364impl TryFromBytes<1> for IdmBand {
5365    type Error = FromBytesError;
5366    fn try_from_le_bytes(val: &[u8; 1]) -> Result<Self, Self::Error> {
5367        // DATA @ IdmBand[1:0]:
5368        let mut data: [u8; 1] = [0; 1];
5369        data[0] |= val[0] & 0x3;
5370        Ok(Self {
5371          // DATA @ IdmBand[1:0]:
5372          data: Data::try_from_le_bytes(&data)?,
5373        })
5374    }
5375}
5376
5377impl From<IdmBand> for u8 {
5378    fn from(value: IdmBand) -> Self {
5379        Self::from_le_bytes(value.to_le_bytes())
5380    }
5381}
5382
5383impl TryFrom<u8> for IdmBand {
5384    type Error = FromBytesError;
5385    fn try_from(value: u8) -> Result<Self, Self::Error> {
5386        Self::try_from_le_bytes(&value.to_le_bytes())
5387    }
5388}
5389
5390// ==== `IDM_CLR` Layout Conversion Functions ==================================
5391
5392impl ToBytes<1> for IdmClr {
5393    #[allow(clippy::cast_possible_truncation)]
5394    fn to_le_bytes(&self) -> [u8; 1] {
5395        let mut val: [u8; 1] = [0; 1];
5396        // BRANCH @ IdmClr[0]:
5397        val[0] |= (u8::from(self.branch) & 0x1) as u8;
5398        val
5399    }
5400}
5401
5402impl FromBytes<1> for IdmClr {
5403    fn from_le_bytes(val: &[u8; 1]) -> Self {
5404        Self {
5405          // BRANCH @ IdmClr[0]:
5406          branch: val[0] & 0x1 != 0,
5407        }
5408    }
5409}
5410
5411impl From<IdmClr> for u8 {
5412    fn from(value: IdmClr) -> Self {
5413        Self::from_le_bytes(value.to_le_bytes())
5414    }
5415}
5416
5417impl From<u8> for IdmClr {
5418    fn from(value: u8) -> Self {
5419        Self::from_le_bytes(&value.to_le_bytes())
5420    }
5421}
5422
5423// ==== `IDM_CTRL` Layout Conversion Functions =================================
5424
5425impl ToBytes<1> for IdmCtrl {
5426    #[allow(clippy::cast_possible_truncation)]
5427    fn to_le_bytes(&self) -> [u8; 1] {
5428        let mut val: [u8; 1] = [0; 1];
5429        // CTRL @ IdmCtrl[1:0]:
5430        let ctrl: [u8; 1] = self.ctrl.to_le_bytes();
5431        val[0] |= ctrl[0] & 0x3;
5432        val
5433    }
5434}
5435
5436impl FromBytes<1> for IdmCtrl {
5437    fn from_le_bytes(val: &[u8; 1]) -> Self {
5438        // CTRL @ IdmCtrl[1:0]:
5439        let mut ctrl: [u8; 1] = [0; 1];
5440        ctrl[0] |= val[0] & 0x3;
5441        Self {
5442          // CTRL @ IdmCtrl[1:0]:
5443          ctrl: Ctrl::from_masked_le_bytes(&ctrl),
5444        }
5445    }
5446}
5447
5448impl From<IdmCtrl> for u8 {
5449    fn from(value: IdmCtrl) -> Self {
5450        Self::from_le_bytes(value.to_le_bytes())
5451    }
5452}
5453
5454impl From<u8> for IdmCtrl {
5455    fn from(value: u8) -> Self {
5456        Self::from_le_bytes(&value.to_le_bytes())
5457    }
5458}
5459
5460// ==== `IDM_ENABLE` Layout Conversion Functions ===============================
5461
5462impl ToBytes<1> for IdmEnable {
5463    #[allow(clippy::cast_possible_truncation)]
5464    fn to_le_bytes(&self) -> [u8; 1] {
5465        let mut val: [u8; 1] = [0; 1];
5466        // MATCH_BANDS @ IdmEnable[2:0]:
5467        let match_bands: [u8; 1] = self.match_bands.to_le_bytes();
5468        val[0] |= match_bands[0] & 0x7;
5469        val
5470    }
5471}
5472
5473impl FromBytes<1> for IdmEnable {
5474    fn from_le_bytes(val: &[u8; 1]) -> Self {
5475        // MATCH_BANDS @ IdmEnable[2:0]:
5476        let mut match_bands: [u8; 1] = [0; 1];
5477        match_bands[0] |= val[0] & 0x7;
5478        Self {
5479          // MATCH_BANDS @ IdmEnable[2:0]:
5480          match_bands: Bands::from_le_bytes(&match_bands),
5481        }
5482    }
5483}
5484
5485impl From<IdmEnable> for u8 {
5486    fn from(value: IdmEnable) -> Self {
5487        Self::from_le_bytes(value.to_le_bytes())
5488    }
5489}
5490
5491impl From<u8> for IdmEnable {
5492    fn from(value: u8) -> Self {
5493        Self::from_le_bytes(&value.to_le_bytes())
5494    }
5495}
5496
5497// ==== `IDM_REASON` Layout Conversion Functions ===============================
5498
5499impl ToBytes<1> for IdmReason {
5500    #[allow(clippy::cast_possible_truncation)]
5501    fn to_le_bytes(&self) -> [u8; 1] {
5502        let mut val: [u8; 1] = [0; 1];
5503        // REASON @ IdmReason[1:0]:
5504        let reason: [u8; 1] = self.reason.to_le_bytes();
5505        val[0] |= reason[0] & 0x3;
5506        val
5507    }
5508}
5509
5510impl FromBytes<1> for IdmReason {
5511    fn from_le_bytes(val: &[u8; 1]) -> Self {
5512        // REASON @ IdmReason[1:0]:
5513        let mut reason: [u8; 1] = [0; 1];
5514        reason[0] |= val[0] & 0x3;
5515        Self {
5516          // REASON @ IdmReason[1:0]:
5517          reason: Reason::from_masked_le_bytes(&reason),
5518        }
5519    }
5520}
5521
5522impl From<IdmReason> for u8 {
5523    fn from(value: IdmReason) -> Self {
5524        Self::from_le_bytes(value.to_le_bytes())
5525    }
5526}
5527
5528impl From<u8> for IdmReason {
5529    fn from(value: u8) -> Self {
5530        Self::from_le_bytes(&value.to_le_bytes())
5531    }
5532}
5533
5534// ==== `ID_HI` Layout Conversion Functions ====================================
5535
5536impl ToBytes<1> for IdHi {
5537    #[allow(clippy::cast_possible_truncation)]
5538    fn to_le_bytes(&self) -> [u8; 1] {
5539        let mut val: [u8; 1] = [0; 1];
5540        // DATA @ IdHi[7:0]:
5541        val[0] |= self.data as u8;
5542        val
5543    }
5544}
5545
5546impl FromBytes<1> for IdHi {
5547    fn from_le_bytes(val: &[u8; 1]) -> Self {
5548        Self {
5549          // DATA @ IdHi[7:0]:
5550          data: val[0],
5551        }
5552    }
5553}
5554
5555impl From<IdHi> for u8 {
5556    fn from(value: IdHi) -> Self {
5557        Self::from_le_bytes(value.to_le_bytes())
5558    }
5559}
5560
5561impl From<u8> for IdHi {
5562    fn from(value: u8) -> Self {
5563        Self::from_le_bytes(&value.to_le_bytes())
5564    }
5565}
5566
5567// ==== `ID_LO` Layout Conversion Functions ====================================
5568
5569impl ToBytes<1> for IdLo {
5570    #[allow(clippy::cast_possible_truncation)]
5571    fn to_le_bytes(&self) -> [u8; 1] {
5572        let mut val: [u8; 1] = [0; 1];
5573        // DATA @ IdLo[7:0]:
5574        val[0] |= self.data as u8;
5575        val
5576    }
5577}
5578
5579impl FromBytes<1> for IdLo {
5580    fn from_le_bytes(val: &[u8; 1]) -> Self {
5581        Self {
5582          // DATA @ IdLo[7:0]:
5583          data: val[0],
5584        }
5585    }
5586}
5587
5588impl From<IdLo> for u8 {
5589    fn from(value: IdLo) -> Self {
5590        Self::from_le_bytes(value.to_le_bytes())
5591    }
5592}
5593
5594impl From<u8> for IdLo {
5595    fn from(value: u8) -> Self {
5596        Self::from_le_bytes(&value.to_le_bytes())
5597    }
5598}
5599
5600// ==== `IRQ_CLR` Layout Conversion Functions ==================================
5601
5602impl ToBytes<1> for IrqClr {
5603    #[allow(clippy::cast_possible_truncation)]
5604    fn to_le_bytes(&self) -> [u8; 1] {
5605        let mut val: [u8; 1] = [0; 1];
5606        // IRQ_CLR @ IrqClr[7:0]:
5607        let irq_clr: [u8; 1] = self.irq_clr.to_le_bytes();
5608        val[0] |= irq_clr[0];
5609        val
5610    }
5611}
5612
5613impl FromBytes<1> for IrqClr {
5614    fn from_le_bytes(val: &[u8; 1]) -> Self {
5615        // IRQ_CLR @ IrqClr[7:0]:
5616        let mut irq_clr: [u8; 1] = [0; 1];
5617        irq_clr[0] |= val[0];
5618        Self {
5619          // IRQ_CLR @ IrqClr[7:0]:
5620          irq_clr: IrqSource::from_le_bytes(&irq_clr),
5621        }
5622    }
5623}
5624
5625impl From<IrqClr> for u8 {
5626    fn from(value: IrqClr) -> Self {
5627        Self::from_le_bytes(value.to_le_bytes())
5628    }
5629}
5630
5631impl From<u8> for IrqClr {
5632    fn from(value: u8) -> Self {
5633        Self::from_le_bytes(&value.to_le_bytes())
5634    }
5635}
5636
5637// ==== `IRQ_SELECT` Layout Conversion Functions ===============================
5638
5639impl ToBytes<1> for IrqSelect {
5640    #[allow(clippy::cast_possible_truncation)]
5641    fn to_le_bytes(&self) -> [u8; 1] {
5642        let mut val: [u8; 1] = [0; 1];
5643        // IRQ_SELECT @ IrqSelect[7:0]:
5644        let irq_select: [u8; 1] = self.irq_select.to_le_bytes();
5645        val[0] |= irq_select[0];
5646        val
5647    }
5648}
5649
5650impl FromBytes<1> for IrqSelect {
5651    fn from_le_bytes(val: &[u8; 1]) -> Self {
5652        // IRQ_SELECT @ IrqSelect[7:0]:
5653        let mut irq_select: [u8; 1] = [0; 1];
5654        irq_select[0] |= val[0];
5655        Self {
5656          // IRQ_SELECT @ IrqSelect[7:0]:
5657          irq_select: IrqSource::from_le_bytes(&irq_select),
5658        }
5659    }
5660}
5661
5662impl From<IrqSelect> for u8 {
5663    fn from(value: IrqSelect) -> Self {
5664        Self::from_le_bytes(value.to_le_bytes())
5665    }
5666}
5667
5668impl From<u8> for IrqSelect {
5669    fn from(value: u8) -> Self {
5670        Self::from_le_bytes(&value.to_le_bytes())
5671    }
5672}
5673
5674// ==== `IRQ_SET` Layout Conversion Functions ==================================
5675
5676impl ToBytes<1> for IrqSet {
5677    #[allow(clippy::cast_possible_truncation)]
5678    fn to_le_bytes(&self) -> [u8; 1] {
5679        let mut val: [u8; 1] = [0; 1];
5680        // IRQ_SET @ IrqSet[7:0]:
5681        let irq_set: [u8; 1] = self.irq_set.to_le_bytes();
5682        val[0] |= irq_set[0];
5683        val
5684    }
5685}
5686
5687impl FromBytes<1> for IrqSet {
5688    fn from_le_bytes(val: &[u8; 1]) -> Self {
5689        // IRQ_SET @ IrqSet[7:0]:
5690        let mut irq_set: [u8; 1] = [0; 1];
5691        irq_set[0] |= val[0];
5692        Self {
5693          // IRQ_SET @ IrqSet[7:0]:
5694          irq_set: IrqSource::from_le_bytes(&irq_set),
5695        }
5696    }
5697}
5698
5699impl From<IrqSet> for u8 {
5700    fn from(value: IrqSet) -> Self {
5701        Self::from_le_bytes(value.to_le_bytes())
5702    }
5703}
5704
5705impl From<u8> for IrqSet {
5706    fn from(value: u8) -> Self {
5707        Self::from_le_bytes(&value.to_le_bytes())
5708    }
5709}
5710
5711// ==== `IRQ_SOURCE` Layout Conversion Functions ===============================
5712
5713impl ToBytes<1> for IrqSource {
5714    #[allow(clippy::cast_possible_truncation)]
5715    fn to_le_bytes(&self) -> [u8; 1] {
5716        let mut val: [u8; 1] = [0; 1];
5717        // CORREL_MATCH @ IrqSource[3]:
5718        val[0] |= ((u8::from(self.correl_match) << 3) & 0x8) as u8;
5719        // CYCLIC_TIMER_ALARM @ IrqSource[7]:
5720        val[0] |= ((u8::from(self.cyclic_timer_alarm) << 7) & 0x80) as u8;
5721        // FIFO_FULL @ IrqSource[2]:
5722        val[0] |= ((u8::from(self.fifo_full) << 2) & 0x4) as u8;
5723        // FIFO_OVERFLOW @ IrqSource[1]:
5724        val[0] |= ((u8::from(self.fifo_overflow) << 1) & 0x2) as u8;
5725        // ID_MATCH @ IrqSource[0]:
5726        val[0] |= (u8::from(self.id_match) & 0x1) as u8;
5727        // ID_MATCH_AND_FIFO_FULL @ IrqSource[4]:
5728        val[0] |= ((u8::from(self.id_match_and_fifo_full) << 4) & 0x10) as u8;
5729        // ID_MATCH_AND_LDR @ IrqSource[5]:
5730        val[0] |= ((u8::from(self.id_match_and_ldr) << 5) & 0x20) as u8;
5731        // RTC_TIMER_ALARM @ IrqSource[6]:
5732        val[0] |= ((u8::from(self.rtc_timer_alarm) << 6) & 0x40) as u8;
5733        val
5734    }
5735}
5736
5737impl FromBytes<1> for IrqSource {
5738    fn from_le_bytes(val: &[u8; 1]) -> Self {
5739        Self {
5740          // CORREL_MATCH @ IrqSource[3]:
5741          correl_match: (val[0] & 0x8) >> 3 != 0,
5742          // CYCLIC_TIMER_ALARM @ IrqSource[7]:
5743          cyclic_timer_alarm: (val[0] & 0x80) >> 7 != 0,
5744          // FIFO_FULL @ IrqSource[2]:
5745          fifo_full: (val[0] & 0x4) >> 2 != 0,
5746          // FIFO_OVERFLOW @ IrqSource[1]:
5747          fifo_overflow: (val[0] & 0x2) >> 1 != 0,
5748          // ID_MATCH @ IrqSource[0]:
5749          id_match: val[0] & 0x1 != 0,
5750          // ID_MATCH_AND_FIFO_FULL @ IrqSource[4]:
5751          id_match_and_fifo_full: (val[0] & 0x10) >> 4 != 0,
5752          // ID_MATCH_AND_LDR @ IrqSource[5]:
5753          id_match_and_ldr: (val[0] & 0x20) >> 5 != 0,
5754          // RTC_TIMER_ALARM @ IrqSource[6]:
5755          rtc_timer_alarm: (val[0] & 0x40) >> 6 != 0,
5756        }
5757    }
5758}
5759
5760impl From<IrqSource> for u8 {
5761    fn from(value: IrqSource) -> Self {
5762        Self::from_le_bytes(value.to_le_bytes())
5763    }
5764}
5765
5766impl From<u8> for IrqSource {
5767    fn from(value: u8) -> Self {
5768        Self::from_le_bytes(&value.to_le_bytes())
5769    }
5770}
5771
5772// ==== `IRQ_STATUS` Layout Conversion Functions ===============================
5773
5774impl ToBytes<1> for IrqStatus {
5775    #[allow(clippy::cast_possible_truncation)]
5776    fn to_le_bytes(&self) -> [u8; 1] {
5777        let mut val: [u8; 1] = [0; 1];
5778        // IRQ_STATUS @ IrqStatus[7:0]:
5779        let irq_status: [u8; 1] = self.irq_status.to_le_bytes();
5780        val[0] |= irq_status[0];
5781        val
5782    }
5783}
5784
5785impl FromBytes<1> for IrqStatus {
5786    fn from_le_bytes(val: &[u8; 1]) -> Self {
5787        // IRQ_STATUS @ IrqStatus[7:0]:
5788        let mut irq_status: [u8; 1] = [0; 1];
5789        irq_status[0] |= val[0];
5790        Self {
5791          // IRQ_STATUS @ IrqStatus[7:0]:
5792          irq_status: IrqSource::from_le_bytes(&irq_status),
5793        }
5794    }
5795}
5796
5797impl From<IrqStatus> for u8 {
5798    fn from(value: IrqStatus) -> Self {
5799        Self::from_le_bytes(value.to_le_bytes())
5800    }
5801}
5802
5803impl From<u8> for IrqStatus {
5804    fn from(value: u8) -> Self {
5805        Self::from_le_bytes(&value.to_le_bytes())
5806    }
5807}
5808
5809// ==== `KORREL_STATE` Layout Conversion Functions =============================
5810
5811impl ToBytes<1> for KorrelState {
5812    #[allow(clippy::cast_possible_truncation)]
5813    fn to_le_bytes(&self) -> [u8; 1] {
5814        let mut val: [u8; 1] = [0; 1];
5815        // KORREL_BRANCHES_A @ KorrelState[2:0]:
5816        let korrel_branches_a: [u8; 1] = self.korrel_branches_a.to_le_bytes();
5817        val[0] |= korrel_branches_a[0] & 0x7;
5818        // KORREL_BRANCHES_B @ KorrelState[5:3]:
5819        let korrel_branches_b: [u8; 1] = self.korrel_branches_b.to_le_bytes();
5820        val[0] |= (korrel_branches_b[0] << 3) & 0x38;
5821        // KORREL_BRANCHES_LATEST @ KorrelState[7:6]:
5822        let korrel_branches_latest: [u8; 1] = self.korrel_branches_latest.to_le_bytes();
5823        val[0] |= (korrel_branches_latest[0] << 6) & 0xC0;
5824        val
5825    }
5826}
5827
5828impl TryFromBytes<1> for KorrelState {
5829    type Error = FromBytesError;
5830    fn try_from_le_bytes(val: &[u8; 1]) -> Result<Self, Self::Error> {
5831        // KORREL_BRANCHES_A @ KorrelState[2:0]:
5832        let mut korrel_branches_a: [u8; 1] = [0; 1];
5833        korrel_branches_a[0] |= val[0] & 0x7;
5834        // KORREL_BRANCHES_B @ KorrelState[5:3]:
5835        let mut korrel_branches_b: [u8; 1] = [0; 1];
5836        korrel_branches_b[0] |= (val[0] & 0x38) >> 3;
5837        // KORREL_BRANCHES_LATEST @ KorrelState[7:6]:
5838        let mut korrel_branches_latest: [u8; 1] = [0; 1];
5839        korrel_branches_latest[0] |= (val[0] & 0xC0) >> 6;
5840        Ok(Self {
5841          // KORREL_BRANCHES_A @ KorrelState[2:0]:
5842          korrel_branches_a: Branches::from_le_bytes(&korrel_branches_a),
5843          // KORREL_BRANCHES_B @ KorrelState[5:3]:
5844          korrel_branches_b: Branches::from_le_bytes(&korrel_branches_b),
5845          // KORREL_BRANCHES_LATEST @ KorrelState[7:6]:
5846          korrel_branches_latest: KorrelBranchesLatest::try_from_le_bytes(&korrel_branches_latest).map_err(|x| Self::Error {pos: x.pos + 6})?,
5847        })
5848    }
5849}
5850
5851impl From<KorrelState> for u8 {
5852    fn from(value: KorrelState) -> Self {
5853        Self::from_le_bytes(value.to_le_bytes())
5854    }
5855}
5856
5857impl TryFrom<u8> for KorrelState {
5858    type Error = FromBytesError;
5859    fn try_from(value: u8) -> Result<Self, Self::Error> {
5860        Self::try_from_le_bytes(&value.to_le_bytes())
5861    }
5862}
5863
5864// ==== `KORREL_SV_CLEAR` Layout Conversion Functions ==========================
5865
5866impl ToBytes<1> for KorrelSvClear {
5867    #[allow(clippy::cast_possible_truncation)]
5868    fn to_le_bytes(&self) -> [u8; 1] {
5869        let mut val: [u8; 1] = [0; 1];
5870        // DATA @ KorrelSvClear[0]:
5871        val[0] |= (u8::from(self.data) & 0x1) as u8;
5872        val
5873    }
5874}
5875
5876impl FromBytes<1> for KorrelSvClear {
5877    fn from_le_bytes(val: &[u8; 1]) -> Self {
5878        Self {
5879          // DATA @ KorrelSvClear[0]:
5880          data: val[0] & 0x1 != 0,
5881        }
5882    }
5883}
5884
5885impl From<KorrelSvClear> for u8 {
5886    fn from(value: KorrelSvClear) -> Self {
5887        Self::from_le_bytes(value.to_le_bytes())
5888    }
5889}
5890
5891impl From<u8> for KorrelSvClear {
5892    fn from(value: u8) -> Self {
5893        Self::from_le_bytes(&value.to_le_bytes())
5894    }
5895}
5896
5897// ==== `KORREL_THRESH_A` Layout Conversion Functions ==========================
5898
5899impl ToBytes<1> for KorrelThreshA {
5900    #[allow(clippy::cast_possible_truncation)]
5901    fn to_le_bytes(&self) -> [u8; 1] {
5902        let mut val: [u8; 1] = [0; 1];
5903        // DATA @ KorrelThreshA[4:0]:
5904        val[0] |= (self.data & 0x1F) as u8;
5905        val
5906    }
5907}
5908
5909impl FromBytes<1> for KorrelThreshA {
5910    fn from_le_bytes(val: &[u8; 1]) -> Self {
5911        Self {
5912          // DATA @ KorrelThreshA[4:0]:
5913          data: val[0] & 0x1F,
5914        }
5915    }
5916}
5917
5918impl From<KorrelThreshA> for u8 {
5919    fn from(value: KorrelThreshA) -> Self {
5920        Self::from_le_bytes(value.to_le_bytes())
5921    }
5922}
5923
5924impl From<u8> for KorrelThreshA {
5925    fn from(value: u8) -> Self {
5926        Self::from_le_bytes(&value.to_le_bytes())
5927    }
5928}
5929
5930// ==== `KORREL_THRESH_B` Layout Conversion Functions ==========================
5931
5932impl ToBytes<1> for KorrelThreshB {
5933    #[allow(clippy::cast_possible_truncation)]
5934    fn to_le_bytes(&self) -> [u8; 1] {
5935        let mut val: [u8; 1] = [0; 1];
5936        // DATA @ KorrelThreshB[4:0]:
5937        val[0] |= (self.data & 0x1F) as u8;
5938        val
5939    }
5940}
5941
5942impl FromBytes<1> for KorrelThreshB {
5943    fn from_le_bytes(val: &[u8; 1]) -> Self {
5944        Self {
5945          // DATA @ KorrelThreshB[4:0]:
5946          data: val[0] & 0x1F,
5947        }
5948    }
5949}
5950
5951impl From<KorrelThreshB> for u8 {
5952    fn from(value: KorrelThreshB) -> Self {
5953        Self::from_le_bytes(value.to_le_bytes())
5954    }
5955}
5956
5957impl From<u8> for KorrelThreshB {
5958    fn from(value: u8) -> Self {
5959        Self::from_le_bytes(&value.to_le_bytes())
5960    }
5961}
5962
5963// ==== `KORREL_VAL` Layout Conversion Functions ===============================
5964
5965impl ToBytes<1> for KorrelVal {
5966    #[allow(clippy::cast_possible_truncation)]
5967    fn to_le_bytes(&self) -> [u8; 1] {
5968        let mut val: [u8; 1] = [0; 1];
5969        // A @ KorrelVal[3:0]:
5970        val[0] |= (self.a & 0xF) as u8;
5971        // B @ KorrelVal[7:4]:
5972        val[0] |= ((self.b << 4) & 0xF0) as u8;
5973        val
5974    }
5975}
5976
5977impl FromBytes<1> for KorrelVal {
5978    fn from_le_bytes(val: &[u8; 1]) -> Self {
5979        Self {
5980          // A @ KorrelVal[3:0]:
5981          a: val[0] & 0xF,
5982          // B @ KorrelVal[7:4]:
5983          b: (val[0] & 0xF0) >> 4,
5984        }
5985    }
5986}
5987
5988impl From<KorrelVal> for u8 {
5989    fn from(value: KorrelVal) -> Self {
5990        Self::from_le_bytes(value.to_le_bytes())
5991    }
5992}
5993
5994impl From<u8> for KorrelVal {
5995    fn from(value: u8) -> Self {
5996        Self::from_le_bytes(&value.to_le_bytes())
5997    }
5998}
5999
6000// ==== `LCO_FREQ_2G4_HI` Layout Conversion Functions ==========================
6001
6002impl ToBytes<1> for LcoFreq2g4Hi {
6003    #[allow(clippy::cast_possible_truncation)]
6004    fn to_le_bytes(&self) -> [u8; 1] {
6005        let mut val: [u8; 1] = [0; 1];
6006        // DATA @ LcoFreq2g4Hi[7:0]:
6007        val[0] |= self.data as u8;
6008        val
6009    }
6010}
6011
6012impl FromBytes<1> for LcoFreq2g4Hi {
6013    fn from_le_bytes(val: &[u8; 1]) -> Self {
6014        Self {
6015          // DATA @ LcoFreq2g4Hi[7:0]:
6016          data: val[0],
6017        }
6018    }
6019}
6020
6021impl From<LcoFreq2g4Hi> for u8 {
6022    fn from(value: LcoFreq2g4Hi) -> Self {
6023        Self::from_le_bytes(value.to_le_bytes())
6024    }
6025}
6026
6027impl From<u8> for LcoFreq2g4Hi {
6028    fn from(value: u8) -> Self {
6029        Self::from_le_bytes(&value.to_le_bytes())
6030    }
6031}
6032
6033// ==== `LCO_FREQ_2G4_LO` Layout Conversion Functions ==========================
6034
6035impl ToBytes<1> for LcoFreq2g4Lo {
6036    #[allow(clippy::cast_possible_truncation)]
6037    fn to_le_bytes(&self) -> [u8; 1] {
6038        let mut val: [u8; 1] = [0; 1];
6039        // DATA @ LcoFreq2g4Lo[7:0]:
6040        val[0] |= self.data as u8;
6041        val
6042    }
6043}
6044
6045impl FromBytes<1> for LcoFreq2g4Lo {
6046    fn from_le_bytes(val: &[u8; 1]) -> Self {
6047        Self {
6048          // DATA @ LcoFreq2g4Lo[7:0]:
6049          data: val[0],
6050        }
6051    }
6052}
6053
6054impl From<LcoFreq2g4Lo> for u8 {
6055    fn from(value: LcoFreq2g4Lo) -> Self {
6056        Self::from_le_bytes(value.to_le_bytes())
6057    }
6058}
6059
6060impl From<u8> for LcoFreq2g4Lo {
6061    fn from(value: u8) -> Self {
6062        Self::from_le_bytes(&value.to_le_bytes())
6063    }
6064}
6065
6066// ==== `LCO_FREQ_433_HI` Layout Conversion Functions ==========================
6067
6068impl ToBytes<1> for LcoFreq433Hi {
6069    #[allow(clippy::cast_possible_truncation)]
6070    fn to_le_bytes(&self) -> [u8; 1] {
6071        let mut val: [u8; 1] = [0; 1];
6072        // DATA @ LcoFreq433Hi[7:0]:
6073        val[0] |= self.data as u8;
6074        val
6075    }
6076}
6077
6078impl FromBytes<1> for LcoFreq433Hi {
6079    fn from_le_bytes(val: &[u8; 1]) -> Self {
6080        Self {
6081          // DATA @ LcoFreq433Hi[7:0]:
6082          data: val[0],
6083        }
6084    }
6085}
6086
6087impl From<LcoFreq433Hi> for u8 {
6088    fn from(value: LcoFreq433Hi) -> Self {
6089        Self::from_le_bytes(value.to_le_bytes())
6090    }
6091}
6092
6093impl From<u8> for LcoFreq433Hi {
6094    fn from(value: u8) -> Self {
6095        Self::from_le_bytes(&value.to_le_bytes())
6096    }
6097}
6098
6099// ==== `LCO_FREQ_433_LO` Layout Conversion Functions ==========================
6100
6101impl ToBytes<1> for LcoFreq433Lo {
6102    #[allow(clippy::cast_possible_truncation)]
6103    fn to_le_bytes(&self) -> [u8; 1] {
6104        let mut val: [u8; 1] = [0; 1];
6105        // DATA @ LcoFreq433Lo[7:0]:
6106        val[0] |= self.data as u8;
6107        val
6108    }
6109}
6110
6111impl FromBytes<1> for LcoFreq433Lo {
6112    fn from_le_bytes(val: &[u8; 1]) -> Self {
6113        Self {
6114          // DATA @ LcoFreq433Lo[7:0]:
6115          data: val[0],
6116        }
6117    }
6118}
6119
6120impl From<LcoFreq433Lo> for u8 {
6121    fn from(value: LcoFreq433Lo) -> Self {
6122        Self::from_le_bytes(value.to_le_bytes())
6123    }
6124}
6125
6126impl From<u8> for LcoFreq433Lo {
6127    fn from(value: u8) -> Self {
6128        Self::from_le_bytes(&value.to_le_bytes())
6129    }
6130}
6131
6132// ==== `LCO_FREQ_868_HI` Layout Conversion Functions ==========================
6133
6134impl ToBytes<1> for LcoFreq868Hi {
6135    #[allow(clippy::cast_possible_truncation)]
6136    fn to_le_bytes(&self) -> [u8; 1] {
6137        let mut val: [u8; 1] = [0; 1];
6138        // DATA @ LcoFreq868Hi[7:0]:
6139        val[0] |= self.data as u8;
6140        val
6141    }
6142}
6143
6144impl FromBytes<1> for LcoFreq868Hi {
6145    fn from_le_bytes(val: &[u8; 1]) -> Self {
6146        Self {
6147          // DATA @ LcoFreq868Hi[7:0]:
6148          data: val[0],
6149        }
6150    }
6151}
6152
6153impl From<LcoFreq868Hi> for u8 {
6154    fn from(value: LcoFreq868Hi) -> Self {
6155        Self::from_le_bytes(value.to_le_bytes())
6156    }
6157}
6158
6159impl From<u8> for LcoFreq868Hi {
6160    fn from(value: u8) -> Self {
6161        Self::from_le_bytes(&value.to_le_bytes())
6162    }
6163}
6164
6165// ==== `LCO_FREQ_868_LO` Layout Conversion Functions ==========================
6166
6167impl ToBytes<1> for LcoFreq868Lo {
6168    #[allow(clippy::cast_possible_truncation)]
6169    fn to_le_bytes(&self) -> [u8; 1] {
6170        let mut val: [u8; 1] = [0; 1];
6171        // DATA @ LcoFreq868Lo[7:0]:
6172        val[0] |= self.data as u8;
6173        val
6174    }
6175}
6176
6177impl FromBytes<1> for LcoFreq868Lo {
6178    fn from_le_bytes(val: &[u8; 1]) -> Self {
6179        Self {
6180          // DATA @ LcoFreq868Lo[7:0]:
6181          data: val[0],
6182        }
6183    }
6184}
6185
6186impl From<LcoFreq868Lo> for u8 {
6187    fn from(value: LcoFreq868Lo) -> Self {
6188        Self::from_le_bytes(value.to_le_bytes())
6189    }
6190}
6191
6192impl From<u8> for LcoFreq868Lo {
6193    fn from(value: u8) -> Self {
6194        Self::from_le_bytes(&value.to_le_bytes())
6195    }
6196}
6197
6198// ==== `LC_TG_ENA` Layout Conversion Functions ================================
6199
6200impl ToBytes<1> for LcTgEna {
6201    #[allow(clippy::cast_possible_truncation)]
6202    fn to_le_bytes(&self) -> [u8; 1] {
6203        let mut val: [u8; 1] = [0; 1];
6204        // DATA @ LcTgEna[0]:
6205        val[0] |= (u8::from(self.data) & 0x1) as u8;
6206        val
6207    }
6208}
6209
6210impl FromBytes<1> for LcTgEna {
6211    fn from_le_bytes(val: &[u8; 1]) -> Self {
6212        Self {
6213          // DATA @ LcTgEna[0]:
6214          data: val[0] & 0x1 != 0,
6215        }
6216    }
6217}
6218
6219impl From<LcTgEna> for u8 {
6220    fn from(value: LcTgEna) -> Self {
6221        Self::from_le_bytes(value.to_le_bytes())
6222    }
6223}
6224
6225impl From<u8> for LcTgEna {
6226    fn from(value: u8) -> Self {
6227        Self::from_le_bytes(&value.to_le_bytes())
6228    }
6229}
6230
6231// ==== `LDO_XTAL_CTRL` Layout Conversion Functions ============================
6232
6233impl ToBytes<1> for LdoXtalCtrl {
6234    #[allow(clippy::cast_possible_truncation)]
6235    fn to_le_bytes(&self) -> [u8; 1] {
6236        let mut val: [u8; 1] = [0; 1];
6237        // INT @ LdoXtalCtrl[1:0]:
6238        val[0] |= 0x3; // Fixed value.
6239        // LDO_ENA_NFA @ LdoXtalCtrl[5]:
6240        val[0] |= ((u8::from(self.ldo_ena_nfa) << 5) & 0x20) as u8;
6241        // XTAL_OSC_BYP @ LdoXtalCtrl[3]:
6242        val[0] |= ((u8::from(self.xtal_osc_byp) << 3) & 0x8) as u8;
6243        val
6244    }
6245}
6246
6247impl FromBytes<1> for LdoXtalCtrl {
6248    fn from_le_bytes(val: &[u8; 1]) -> Self {
6249        Self {
6250          // LDO_ENA_NFA @ LdoXtalCtrl[5]:
6251          ldo_ena_nfa: (val[0] & 0x20) >> 5 != 0,
6252          // XTAL_OSC_BYP @ LdoXtalCtrl[3]:
6253          xtal_osc_byp: (val[0] & 0x8) >> 3 != 0,
6254        }
6255    }
6256}
6257
6258impl From<LdoXtalCtrl> for u8 {
6259    fn from(value: LdoXtalCtrl) -> Self {
6260        Self::from_le_bytes(value.to_le_bytes())
6261    }
6262}
6263
6264impl From<u8> for LdoXtalCtrl {
6265    fn from(value: u8) -> Self {
6266        Self::from_le_bytes(&value.to_le_bytes())
6267    }
6268}
6269
6270// ==== `MUX_D_OUT_SEL` Layout Conversion Functions ============================
6271
6272impl ToBytes<1> for MuxDOutSel {
6273    #[allow(clippy::cast_possible_truncation)]
6274    fn to_le_bytes(&self) -> [u8; 1] {
6275        let mut val: [u8; 1] = [0; 1];
6276        // OUT @ MuxDOutSel[3:0]:
6277        let out: [u8; 1] = self.out.to_le_bytes();
6278        val[0] |= out[0] & 0xF;
6279        val
6280    }
6281}
6282
6283impl TryFromBytes<1> for MuxDOutSel {
6284    type Error = FromBytesError;
6285    fn try_from_le_bytes(val: &[u8; 1]) -> Result<Self, Self::Error> {
6286        // OUT @ MuxDOutSel[3:0]:
6287        let mut out: [u8; 1] = [0; 1];
6288        out[0] |= val[0] & 0xF;
6289        Ok(Self {
6290          // OUT @ MuxDOutSel[3:0]:
6291          out: Out::try_from_le_bytes(&out)?,
6292        })
6293    }
6294}
6295
6296impl From<MuxDOutSel> for u8 {
6297    fn from(value: MuxDOutSel) -> Self {
6298        Self::from_le_bytes(value.to_le_bytes())
6299    }
6300}
6301
6302impl TryFrom<u8> for MuxDOutSel {
6303    type Error = FromBytesError;
6304    fn try_from(value: u8) -> Result<Self, Self::Error> {
6305        Self::try_from_le_bytes(&value.to_le_bytes())
6306    }
6307}
6308
6309// ==== `NFA2G4_FAST` Layout Conversion Functions ==============================
6310
6311impl ToBytes<1> for Nfa2g4Fast {
6312    #[allow(clippy::cast_possible_truncation)]
6313    fn to_le_bytes(&self) -> [u8; 1] {
6314        let mut val: [u8; 1] = [0; 1];
6315        // DATA @ Nfa2g4Fast[2:0]:
6316        let data: [u8; 1] = self.data.to_le_bytes();
6317        val[0] |= data[0] & 0x7;
6318        val
6319    }
6320}
6321
6322impl FromBytes<1> for Nfa2g4Fast {
6323    fn from_le_bytes(val: &[u8; 1]) -> Self {
6324        // DATA @ Nfa2g4Fast[2:0]:
6325        let mut data: [u8; 1] = [0; 1];
6326        data[0] |= val[0] & 0x7;
6327        Self {
6328          // DATA @ Nfa2g4Fast[2:0]:
6329          data: SampleRate::from_masked_le_bytes(&data),
6330        }
6331    }
6332}
6333
6334impl From<Nfa2g4Fast> for u8 {
6335    fn from(value: Nfa2g4Fast) -> Self {
6336        Self::from_le_bytes(value.to_le_bytes())
6337    }
6338}
6339
6340impl From<u8> for Nfa2g4Fast {
6341    fn from(value: u8) -> Self {
6342        Self::from_le_bytes(&value.to_le_bytes())
6343    }
6344}
6345
6346// ==== `NFA2G4_SLOW` Layout Conversion Functions ==============================
6347
6348impl ToBytes<1> for Nfa2g4Slow {
6349    #[allow(clippy::cast_possible_truncation)]
6350    fn to_le_bytes(&self) -> [u8; 1] {
6351        let mut val: [u8; 1] = [0; 1];
6352        // DATA @ Nfa2g4Slow[2:0]:
6353        let data: [u8; 1] = self.data.to_le_bytes();
6354        val[0] |= data[0] & 0x7;
6355        val
6356    }
6357}
6358
6359impl FromBytes<1> for Nfa2g4Slow {
6360    fn from_le_bytes(val: &[u8; 1]) -> Self {
6361        // DATA @ Nfa2g4Slow[2:0]:
6362        let mut data: [u8; 1] = [0; 1];
6363        data[0] |= val[0] & 0x7;
6364        Self {
6365          // DATA @ Nfa2g4Slow[2:0]:
6366          data: SampleRate::from_masked_le_bytes(&data),
6367        }
6368    }
6369}
6370
6371impl From<Nfa2g4Slow> for u8 {
6372    fn from(value: Nfa2g4Slow) -> Self {
6373        Self::from_le_bytes(value.to_le_bytes())
6374    }
6375}
6376
6377impl From<u8> for Nfa2g4Slow {
6378    fn from(value: u8) -> Self {
6379        Self::from_le_bytes(&value.to_le_bytes())
6380    }
6381}
6382
6383// ==== `NFA433_FAST` Layout Conversion Functions ==============================
6384
6385impl ToBytes<1> for Nfa433Fast {
6386    #[allow(clippy::cast_possible_truncation)]
6387    fn to_le_bytes(&self) -> [u8; 1] {
6388        let mut val: [u8; 1] = [0; 1];
6389        // DATA @ Nfa433Fast[2:0]:
6390        let data: [u8; 1] = self.data.to_le_bytes();
6391        val[0] |= data[0] & 0x7;
6392        val
6393    }
6394}
6395
6396impl FromBytes<1> for Nfa433Fast {
6397    fn from_le_bytes(val: &[u8; 1]) -> Self {
6398        // DATA @ Nfa433Fast[2:0]:
6399        let mut data: [u8; 1] = [0; 1];
6400        data[0] |= val[0] & 0x7;
6401        Self {
6402          // DATA @ Nfa433Fast[2:0]:
6403          data: SampleRate::from_masked_le_bytes(&data),
6404        }
6405    }
6406}
6407
6408impl From<Nfa433Fast> for u8 {
6409    fn from(value: Nfa433Fast) -> Self {
6410        Self::from_le_bytes(value.to_le_bytes())
6411    }
6412}
6413
6414impl From<u8> for Nfa433Fast {
6415    fn from(value: u8) -> Self {
6416        Self::from_le_bytes(&value.to_le_bytes())
6417    }
6418}
6419
6420// ==== `NFA433_SLOW` Layout Conversion Functions ==============================
6421
6422impl ToBytes<1> for Nfa433Slow {
6423    #[allow(clippy::cast_possible_truncation)]
6424    fn to_le_bytes(&self) -> [u8; 1] {
6425        let mut val: [u8; 1] = [0; 1];
6426        // DATA @ Nfa433Slow[2:0]:
6427        let data: [u8; 1] = self.data.to_le_bytes();
6428        val[0] |= data[0] & 0x7;
6429        val
6430    }
6431}
6432
6433impl FromBytes<1> for Nfa433Slow {
6434    fn from_le_bytes(val: &[u8; 1]) -> Self {
6435        // DATA @ Nfa433Slow[2:0]:
6436        let mut data: [u8; 1] = [0; 1];
6437        data[0] |= val[0] & 0x7;
6438        Self {
6439          // DATA @ Nfa433Slow[2:0]:
6440          data: SampleRate::from_masked_le_bytes(&data),
6441        }
6442    }
6443}
6444
6445impl From<Nfa433Slow> for u8 {
6446    fn from(value: Nfa433Slow) -> Self {
6447        Self::from_le_bytes(value.to_le_bytes())
6448    }
6449}
6450
6451impl From<u8> for Nfa433Slow {
6452    fn from(value: u8) -> Self {
6453        Self::from_le_bytes(&value.to_le_bytes())
6454    }
6455}
6456
6457// ==== `NFA868_FAST` Layout Conversion Functions ==============================
6458
6459impl ToBytes<1> for Nfa868Fast {
6460    #[allow(clippy::cast_possible_truncation)]
6461    fn to_le_bytes(&self) -> [u8; 1] {
6462        let mut val: [u8; 1] = [0; 1];
6463        // DATA @ Nfa868Fast[2:0]:
6464        let data: [u8; 1] = self.data.to_le_bytes();
6465        val[0] |= data[0] & 0x7;
6466        val
6467    }
6468}
6469
6470impl FromBytes<1> for Nfa868Fast {
6471    fn from_le_bytes(val: &[u8; 1]) -> Self {
6472        // DATA @ Nfa868Fast[2:0]:
6473        let mut data: [u8; 1] = [0; 1];
6474        data[0] |= val[0] & 0x7;
6475        Self {
6476          // DATA @ Nfa868Fast[2:0]:
6477          data: SampleRate::from_masked_le_bytes(&data),
6478        }
6479    }
6480}
6481
6482impl From<Nfa868Fast> for u8 {
6483    fn from(value: Nfa868Fast) -> Self {
6484        Self::from_le_bytes(value.to_le_bytes())
6485    }
6486}
6487
6488impl From<u8> for Nfa868Fast {
6489    fn from(value: u8) -> Self {
6490        Self::from_le_bytes(&value.to_le_bytes())
6491    }
6492}
6493
6494// ==== `NFA868_SLOW` Layout Conversion Functions ==============================
6495
6496impl ToBytes<1> for Nfa868Slow {
6497    #[allow(clippy::cast_possible_truncation)]
6498    fn to_le_bytes(&self) -> [u8; 1] {
6499        let mut val: [u8; 1] = [0; 1];
6500        // DATA @ Nfa868Slow[2:0]:
6501        let data: [u8; 1] = self.data.to_le_bytes();
6502        val[0] |= data[0] & 0x7;
6503        val
6504    }
6505}
6506
6507impl FromBytes<1> for Nfa868Slow {
6508    fn from_le_bytes(val: &[u8; 1]) -> Self {
6509        // DATA @ Nfa868Slow[2:0]:
6510        let mut data: [u8; 1] = [0; 1];
6511        data[0] |= val[0] & 0x7;
6512        Self {
6513          // DATA @ Nfa868Slow[2:0]:
6514          data: SampleRate::from_masked_le_bytes(&data),
6515        }
6516    }
6517}
6518
6519impl From<Nfa868Slow> for u8 {
6520    fn from(value: Nfa868Slow) -> Self {
6521        Self::from_le_bytes(value.to_le_bytes())
6522    }
6523}
6524
6525impl From<u8> for Nfa868Slow {
6526    fn from(value: u8) -> Self {
6527        Self::from_le_bytes(&value.to_le_bytes())
6528    }
6529}
6530
6531// ==== `N_LCO_TARGET_2G4_HI` Layout Conversion Functions ======================
6532
6533impl ToBytes<1> for NLcoTarget2g4Hi {
6534    #[allow(clippy::cast_possible_truncation)]
6535    fn to_le_bytes(&self) -> [u8; 1] {
6536        let mut val: [u8; 1] = [0; 1];
6537        // DATA @ NLcoTarget2g4Hi[7:0]:
6538        val[0] |= self.data as u8;
6539        val
6540    }
6541}
6542
6543impl FromBytes<1> for NLcoTarget2g4Hi {
6544    fn from_le_bytes(val: &[u8; 1]) -> Self {
6545        Self {
6546          // DATA @ NLcoTarget2g4Hi[7:0]:
6547          data: val[0],
6548        }
6549    }
6550}
6551
6552impl From<NLcoTarget2g4Hi> for u8 {
6553    fn from(value: NLcoTarget2g4Hi) -> Self {
6554        Self::from_le_bytes(value.to_le_bytes())
6555    }
6556}
6557
6558impl From<u8> for NLcoTarget2g4Hi {
6559    fn from(value: u8) -> Self {
6560        Self::from_le_bytes(&value.to_le_bytes())
6561    }
6562}
6563
6564// ==== `N_LCO_TARGET_2G4_LO` Layout Conversion Functions ======================
6565
6566impl ToBytes<1> for NLcoTarget2g4Lo {
6567    #[allow(clippy::cast_possible_truncation)]
6568    fn to_le_bytes(&self) -> [u8; 1] {
6569        let mut val: [u8; 1] = [0; 1];
6570        // DATA @ NLcoTarget2g4Lo[7:0]:
6571        val[0] |= self.data as u8;
6572        val
6573    }
6574}
6575
6576impl FromBytes<1> for NLcoTarget2g4Lo {
6577    fn from_le_bytes(val: &[u8; 1]) -> Self {
6578        Self {
6579          // DATA @ NLcoTarget2g4Lo[7:0]:
6580          data: val[0],
6581        }
6582    }
6583}
6584
6585impl From<NLcoTarget2g4Lo> for u8 {
6586    fn from(value: NLcoTarget2g4Lo) -> Self {
6587        Self::from_le_bytes(value.to_le_bytes())
6588    }
6589}
6590
6591impl From<u8> for NLcoTarget2g4Lo {
6592    fn from(value: u8) -> Self {
6593        Self::from_le_bytes(&value.to_le_bytes())
6594    }
6595}
6596
6597// ==== `N_LCO_TARGET_433_HI` Layout Conversion Functions ======================
6598
6599impl ToBytes<1> for NLcoTarget433Hi {
6600    #[allow(clippy::cast_possible_truncation)]
6601    fn to_le_bytes(&self) -> [u8; 1] {
6602        let mut val: [u8; 1] = [0; 1];
6603        // DATA @ NLcoTarget433Hi[7:0]:
6604        val[0] |= self.data as u8;
6605        val
6606    }
6607}
6608
6609impl FromBytes<1> for NLcoTarget433Hi {
6610    fn from_le_bytes(val: &[u8; 1]) -> Self {
6611        Self {
6612          // DATA @ NLcoTarget433Hi[7:0]:
6613          data: val[0],
6614        }
6615    }
6616}
6617
6618impl From<NLcoTarget433Hi> for u8 {
6619    fn from(value: NLcoTarget433Hi) -> Self {
6620        Self::from_le_bytes(value.to_le_bytes())
6621    }
6622}
6623
6624impl From<u8> for NLcoTarget433Hi {
6625    fn from(value: u8) -> Self {
6626        Self::from_le_bytes(&value.to_le_bytes())
6627    }
6628}
6629
6630// ==== `N_LCO_TARGET_433_LO` Layout Conversion Functions ======================
6631
6632impl ToBytes<1> for NLcoTarget433Lo {
6633    #[allow(clippy::cast_possible_truncation)]
6634    fn to_le_bytes(&self) -> [u8; 1] {
6635        let mut val: [u8; 1] = [0; 1];
6636        // DATA @ NLcoTarget433Lo[7:0]:
6637        val[0] |= self.data as u8;
6638        val
6639    }
6640}
6641
6642impl FromBytes<1> for NLcoTarget433Lo {
6643    fn from_le_bytes(val: &[u8; 1]) -> Self {
6644        Self {
6645          // DATA @ NLcoTarget433Lo[7:0]:
6646          data: val[0],
6647        }
6648    }
6649}
6650
6651impl From<NLcoTarget433Lo> for u8 {
6652    fn from(value: NLcoTarget433Lo) -> Self {
6653        Self::from_le_bytes(value.to_le_bytes())
6654    }
6655}
6656
6657impl From<u8> for NLcoTarget433Lo {
6658    fn from(value: u8) -> Self {
6659        Self::from_le_bytes(&value.to_le_bytes())
6660    }
6661}
6662
6663// ==== `N_LCO_TARGET_868_HI` Layout Conversion Functions ======================
6664
6665impl ToBytes<1> for NLcoTarget868Hi {
6666    #[allow(clippy::cast_possible_truncation)]
6667    fn to_le_bytes(&self) -> [u8; 1] {
6668        let mut val: [u8; 1] = [0; 1];
6669        // DATA @ NLcoTarget868Hi[7:0]:
6670        val[0] |= self.data as u8;
6671        val
6672    }
6673}
6674
6675impl FromBytes<1> for NLcoTarget868Hi {
6676    fn from_le_bytes(val: &[u8; 1]) -> Self {
6677        Self {
6678          // DATA @ NLcoTarget868Hi[7:0]:
6679          data: val[0],
6680        }
6681    }
6682}
6683
6684impl From<NLcoTarget868Hi> for u8 {
6685    fn from(value: NLcoTarget868Hi) -> Self {
6686        Self::from_le_bytes(value.to_le_bytes())
6687    }
6688}
6689
6690impl From<u8> for NLcoTarget868Hi {
6691    fn from(value: u8) -> Self {
6692        Self::from_le_bytes(&value.to_le_bytes())
6693    }
6694}
6695
6696// ==== `N_LCO_TARGET_868_LO` Layout Conversion Functions ======================
6697
6698impl ToBytes<1> for NLcoTarget868Lo {
6699    #[allow(clippy::cast_possible_truncation)]
6700    fn to_le_bytes(&self) -> [u8; 1] {
6701        let mut val: [u8; 1] = [0; 1];
6702        // DATA @ NLcoTarget868Lo[7:0]:
6703        val[0] |= self.data as u8;
6704        val
6705    }
6706}
6707
6708impl FromBytes<1> for NLcoTarget868Lo {
6709    fn from_le_bytes(val: &[u8; 1]) -> Self {
6710        Self {
6711          // DATA @ NLcoTarget868Lo[7:0]:
6712          data: val[0],
6713        }
6714    }
6715}
6716
6717impl From<NLcoTarget868Lo> for u8 {
6718    fn from(value: NLcoTarget868Lo) -> Self {
6719        Self::from_le_bytes(value.to_le_bytes())
6720    }
6721}
6722
6723impl From<u8> for NLcoTarget868Lo {
6724    fn from(value: u8) -> Self {
6725        Self::from_le_bytes(&value.to_le_bytes())
6726    }
6727}
6728
6729// ==== `N_SPG_TARGET` Layout Conversion Functions =============================
6730
6731impl ToBytes<1> for NSpgTarget {
6732    #[allow(clippy::cast_possible_truncation)]
6733    fn to_le_bytes(&self) -> [u8; 1] {
6734        let mut val: [u8; 1] = [0; 1];
6735        // DATA @ NSpgTarget[7:0]:
6736        val[0] |= self.data as u8;
6737        val
6738    }
6739}
6740
6741impl FromBytes<1> for NSpgTarget {
6742    fn from_le_bytes(val: &[u8; 1]) -> Self {
6743        Self {
6744          // DATA @ NSpgTarget[7:0]:
6745          data: val[0],
6746        }
6747    }
6748}
6749
6750impl From<NSpgTarget> for u8 {
6751    fn from(value: NSpgTarget) -> Self {
6752        Self::from_le_bytes(value.to_le_bytes())
6753    }
6754}
6755
6756impl From<u8> for NSpgTarget {
6757    fn from(value: u8) -> Self {
6758        Self::from_le_bytes(&value.to_le_bytes())
6759    }
6760}
6761
6762// ==== `RTC` Layout Conversion Functions ======================================
6763
6764impl ToBytes<1> for Rtc {
6765    #[allow(clippy::cast_possible_truncation)]
6766    fn to_le_bytes(&self) -> [u8; 1] {
6767        let mut val: [u8; 1] = [0; 1];
6768        // RTCLG0 @ Rtc[2]:
6769        val[0] |= ((u8::from(self.rtclg0) << 2) & 0x4) as u8;
6770        // RTCLG1 @ Rtc[3]:
6771        val[0] |= ((u8::from(self.rtclg1) << 3) & 0x8) as u8;
6772        // RTCSH0 @ Rtc[0]:
6773        val[0] |= (u8::from(self.rtcsh0) & 0x1) as u8;
6774        // RTCSH1 @ Rtc[1]:
6775        val[0] |= ((u8::from(self.rtcsh1) << 1) & 0x2) as u8;
6776        val
6777    }
6778}
6779
6780impl FromBytes<1> for Rtc {
6781    fn from_le_bytes(val: &[u8; 1]) -> Self {
6782        Self {
6783          // RTCLG0 @ Rtc[2]:
6784          rtclg0: (val[0] & 0x4) >> 2 != 0,
6785          // RTCLG1 @ Rtc[3]:
6786          rtclg1: (val[0] & 0x8) >> 3 != 0,
6787          // RTCSH0 @ Rtc[0]:
6788          rtcsh0: val[0] & 0x1 != 0,
6789          // RTCSH1 @ Rtc[1]:
6790          rtcsh1: (val[0] & 0x2) >> 1 != 0,
6791        }
6792    }
6793}
6794
6795impl From<Rtc> for u8 {
6796    fn from(value: Rtc) -> Self {
6797        Self::from_le_bytes(value.to_le_bytes())
6798    }
6799}
6800
6801impl From<u8> for Rtc {
6802    fn from(value: u8) -> Self {
6803        Self::from_le_bytes(&value.to_le_bytes())
6804    }
6805}
6806
6807// ==== `RTCLG0_THRESH_0` Layout Conversion Functions ==========================
6808
6809impl ToBytes<1> for Rtclg0Thresh0 {
6810    #[allow(clippy::cast_possible_truncation)]
6811    fn to_le_bytes(&self) -> [u8; 1] {
6812        let mut val: [u8; 1] = [0; 1];
6813        // DATA @ Rtclg0Thresh0[7:0]:
6814        val[0] |= self.data as u8;
6815        val
6816    }
6817}
6818
6819impl FromBytes<1> for Rtclg0Thresh0 {
6820    fn from_le_bytes(val: &[u8; 1]) -> Self {
6821        Self {
6822          // DATA @ Rtclg0Thresh0[7:0]:
6823          data: val[0],
6824        }
6825    }
6826}
6827
6828impl From<Rtclg0Thresh0> for u8 {
6829    fn from(value: Rtclg0Thresh0) -> Self {
6830        Self::from_le_bytes(value.to_le_bytes())
6831    }
6832}
6833
6834impl From<u8> for Rtclg0Thresh0 {
6835    fn from(value: u8) -> Self {
6836        Self::from_le_bytes(&value.to_le_bytes())
6837    }
6838}
6839
6840// ==== `RTCLG0_THRESH_1` Layout Conversion Functions ==========================
6841
6842impl ToBytes<1> for Rtclg0Thresh1 {
6843    #[allow(clippy::cast_possible_truncation)]
6844    fn to_le_bytes(&self) -> [u8; 1] {
6845        let mut val: [u8; 1] = [0; 1];
6846        // DATA @ Rtclg0Thresh1[7:0]:
6847        val[0] |= self.data as u8;
6848        val
6849    }
6850}
6851
6852impl FromBytes<1> for Rtclg0Thresh1 {
6853    fn from_le_bytes(val: &[u8; 1]) -> Self {
6854        Self {
6855          // DATA @ Rtclg0Thresh1[7:0]:
6856          data: val[0],
6857        }
6858    }
6859}
6860
6861impl From<Rtclg0Thresh1> for u8 {
6862    fn from(value: Rtclg0Thresh1) -> Self {
6863        Self::from_le_bytes(value.to_le_bytes())
6864    }
6865}
6866
6867impl From<u8> for Rtclg0Thresh1 {
6868    fn from(value: u8) -> Self {
6869        Self::from_le_bytes(&value.to_le_bytes())
6870    }
6871}
6872
6873// ==== `RTCLG0_THRESH_2` Layout Conversion Functions ==========================
6874
6875impl ToBytes<1> for Rtclg0Thresh2 {
6876    #[allow(clippy::cast_possible_truncation)]
6877    fn to_le_bytes(&self) -> [u8; 1] {
6878        let mut val: [u8; 1] = [0; 1];
6879        // DATA @ Rtclg0Thresh2[7:0]:
6880        val[0] |= self.data as u8;
6881        val
6882    }
6883}
6884
6885impl FromBytes<1> for Rtclg0Thresh2 {
6886    fn from_le_bytes(val: &[u8; 1]) -> Self {
6887        Self {
6888          // DATA @ Rtclg0Thresh2[7:0]:
6889          data: val[0],
6890        }
6891    }
6892}
6893
6894impl From<Rtclg0Thresh2> for u8 {
6895    fn from(value: Rtclg0Thresh2) -> Self {
6896        Self::from_le_bytes(value.to_le_bytes())
6897    }
6898}
6899
6900impl From<u8> for Rtclg0Thresh2 {
6901    fn from(value: u8) -> Self {
6902        Self::from_le_bytes(&value.to_le_bytes())
6903    }
6904}
6905
6906// ==== `RTCLG0_THRESH_3` Layout Conversion Functions ==========================
6907
6908impl ToBytes<1> for Rtclg0Thresh3 {
6909    #[allow(clippy::cast_possible_truncation)]
6910    fn to_le_bytes(&self) -> [u8; 1] {
6911        let mut val: [u8; 1] = [0; 1];
6912        // DATA @ Rtclg0Thresh3[7:0]:
6913        val[0] |= self.data as u8;
6914        val
6915    }
6916}
6917
6918impl FromBytes<1> for Rtclg0Thresh3 {
6919    fn from_le_bytes(val: &[u8; 1]) -> Self {
6920        Self {
6921          // DATA @ Rtclg0Thresh3[7:0]:
6922          data: val[0],
6923        }
6924    }
6925}
6926
6927impl From<Rtclg0Thresh3> for u8 {
6928    fn from(value: Rtclg0Thresh3) -> Self {
6929        Self::from_le_bytes(value.to_le_bytes())
6930    }
6931}
6932
6933impl From<u8> for Rtclg0Thresh3 {
6934    fn from(value: u8) -> Self {
6935        Self::from_le_bytes(&value.to_le_bytes())
6936    }
6937}
6938
6939// ==== `RTCLG0_THRESH_4` Layout Conversion Functions ==========================
6940
6941impl ToBytes<1> for Rtclg0Thresh4 {
6942    #[allow(clippy::cast_possible_truncation)]
6943    fn to_le_bytes(&self) -> [u8; 1] {
6944        let mut val: [u8; 1] = [0; 1];
6945        // DATA @ Rtclg0Thresh4[7:0]:
6946        val[0] |= self.data as u8;
6947        val
6948    }
6949}
6950
6951impl FromBytes<1> for Rtclg0Thresh4 {
6952    fn from_le_bytes(val: &[u8; 1]) -> Self {
6953        Self {
6954          // DATA @ Rtclg0Thresh4[7:0]:
6955          data: val[0],
6956        }
6957    }
6958}
6959
6960impl From<Rtclg0Thresh4> for u8 {
6961    fn from(value: Rtclg0Thresh4) -> Self {
6962        Self::from_le_bytes(value.to_le_bytes())
6963    }
6964}
6965
6966impl From<u8> for Rtclg0Thresh4 {
6967    fn from(value: u8) -> Self {
6968        Self::from_le_bytes(&value.to_le_bytes())
6969    }
6970}
6971
6972// ==== `RTCLG1_THRESH_0` Layout Conversion Functions ==========================
6973
6974impl ToBytes<1> for Rtclg1Thresh0 {
6975    #[allow(clippy::cast_possible_truncation)]
6976    fn to_le_bytes(&self) -> [u8; 1] {
6977        let mut val: [u8; 1] = [0; 1];
6978        // DATA @ Rtclg1Thresh0[7:0]:
6979        val[0] |= self.data as u8;
6980        val
6981    }
6982}
6983
6984impl FromBytes<1> for Rtclg1Thresh0 {
6985    fn from_le_bytes(val: &[u8; 1]) -> Self {
6986        Self {
6987          // DATA @ Rtclg1Thresh0[7:0]:
6988          data: val[0],
6989        }
6990    }
6991}
6992
6993impl From<Rtclg1Thresh0> for u8 {
6994    fn from(value: Rtclg1Thresh0) -> Self {
6995        Self::from_le_bytes(value.to_le_bytes())
6996    }
6997}
6998
6999impl From<u8> for Rtclg1Thresh0 {
7000    fn from(value: u8) -> Self {
7001        Self::from_le_bytes(&value.to_le_bytes())
7002    }
7003}
7004
7005// ==== `RTCLG1_THRESH_1` Layout Conversion Functions ==========================
7006
7007impl ToBytes<1> for Rtclg1Thresh1 {
7008    #[allow(clippy::cast_possible_truncation)]
7009    fn to_le_bytes(&self) -> [u8; 1] {
7010        let mut val: [u8; 1] = [0; 1];
7011        // DATA @ Rtclg1Thresh1[7:0]:
7012        val[0] |= self.data as u8;
7013        val
7014    }
7015}
7016
7017impl FromBytes<1> for Rtclg1Thresh1 {
7018    fn from_le_bytes(val: &[u8; 1]) -> Self {
7019        Self {
7020          // DATA @ Rtclg1Thresh1[7:0]:
7021          data: val[0],
7022        }
7023    }
7024}
7025
7026impl From<Rtclg1Thresh1> for u8 {
7027    fn from(value: Rtclg1Thresh1) -> Self {
7028        Self::from_le_bytes(value.to_le_bytes())
7029    }
7030}
7031
7032impl From<u8> for Rtclg1Thresh1 {
7033    fn from(value: u8) -> Self {
7034        Self::from_le_bytes(&value.to_le_bytes())
7035    }
7036}
7037
7038// ==== `RTCLG1_THRESH_2` Layout Conversion Functions ==========================
7039
7040impl ToBytes<1> for Rtclg1Thresh2 {
7041    #[allow(clippy::cast_possible_truncation)]
7042    fn to_le_bytes(&self) -> [u8; 1] {
7043        let mut val: [u8; 1] = [0; 1];
7044        // DATA @ Rtclg1Thresh2[7:0]:
7045        val[0] |= self.data as u8;
7046        val
7047    }
7048}
7049
7050impl FromBytes<1> for Rtclg1Thresh2 {
7051    fn from_le_bytes(val: &[u8; 1]) -> Self {
7052        Self {
7053          // DATA @ Rtclg1Thresh2[7:0]:
7054          data: val[0],
7055        }
7056    }
7057}
7058
7059impl From<Rtclg1Thresh2> for u8 {
7060    fn from(value: Rtclg1Thresh2) -> Self {
7061        Self::from_le_bytes(value.to_le_bytes())
7062    }
7063}
7064
7065impl From<u8> for Rtclg1Thresh2 {
7066    fn from(value: u8) -> Self {
7067        Self::from_le_bytes(&value.to_le_bytes())
7068    }
7069}
7070
7071// ==== `RTCLG1_THRESH_3` Layout Conversion Functions ==========================
7072
7073impl ToBytes<1> for Rtclg1Thresh3 {
7074    #[allow(clippy::cast_possible_truncation)]
7075    fn to_le_bytes(&self) -> [u8; 1] {
7076        let mut val: [u8; 1] = [0; 1];
7077        // DATA @ Rtclg1Thresh3[7:0]:
7078        val[0] |= self.data as u8;
7079        val
7080    }
7081}
7082
7083impl FromBytes<1> for Rtclg1Thresh3 {
7084    fn from_le_bytes(val: &[u8; 1]) -> Self {
7085        Self {
7086          // DATA @ Rtclg1Thresh3[7:0]:
7087          data: val[0],
7088        }
7089    }
7090}
7091
7092impl From<Rtclg1Thresh3> for u8 {
7093    fn from(value: Rtclg1Thresh3) -> Self {
7094        Self::from_le_bytes(value.to_le_bytes())
7095    }
7096}
7097
7098impl From<u8> for Rtclg1Thresh3 {
7099    fn from(value: u8) -> Self {
7100        Self::from_le_bytes(&value.to_le_bytes())
7101    }
7102}
7103
7104// ==== `RTCLG1_THRESH_4` Layout Conversion Functions ==========================
7105
7106impl ToBytes<1> for Rtclg1Thresh4 {
7107    #[allow(clippy::cast_possible_truncation)]
7108    fn to_le_bytes(&self) -> [u8; 1] {
7109        let mut val: [u8; 1] = [0; 1];
7110        // DATA @ Rtclg1Thresh4[7:0]:
7111        val[0] |= self.data as u8;
7112        val
7113    }
7114}
7115
7116impl FromBytes<1> for Rtclg1Thresh4 {
7117    fn from_le_bytes(val: &[u8; 1]) -> Self {
7118        Self {
7119          // DATA @ Rtclg1Thresh4[7:0]:
7120          data: val[0],
7121        }
7122    }
7123}
7124
7125impl From<Rtclg1Thresh4> for u8 {
7126    fn from(value: Rtclg1Thresh4) -> Self {
7127        Self::from_le_bytes(value.to_le_bytes())
7128    }
7129}
7130
7131impl From<u8> for Rtclg1Thresh4 {
7132    fn from(value: u8) -> Self {
7133        Self::from_le_bytes(&value.to_le_bytes())
7134    }
7135}
7136
7137// ==== `RTCSH0_THRESH_HI` Layout Conversion Functions =========================
7138
7139impl ToBytes<1> for Rtcsh0ThreshHi {
7140    #[allow(clippy::cast_possible_truncation)]
7141    fn to_le_bytes(&self) -> [u8; 1] {
7142        let mut val: [u8; 1] = [0; 1];
7143        // DATA @ Rtcsh0ThreshHi[7:0]:
7144        val[0] |= self.data as u8;
7145        val
7146    }
7147}
7148
7149impl FromBytes<1> for Rtcsh0ThreshHi {
7150    fn from_le_bytes(val: &[u8; 1]) -> Self {
7151        Self {
7152          // DATA @ Rtcsh0ThreshHi[7:0]:
7153          data: val[0],
7154        }
7155    }
7156}
7157
7158impl From<Rtcsh0ThreshHi> for u8 {
7159    fn from(value: Rtcsh0ThreshHi) -> Self {
7160        Self::from_le_bytes(value.to_le_bytes())
7161    }
7162}
7163
7164impl From<u8> for Rtcsh0ThreshHi {
7165    fn from(value: u8) -> Self {
7166        Self::from_le_bytes(&value.to_le_bytes())
7167    }
7168}
7169
7170// ==== `RTCSH0_THRESH_LO` Layout Conversion Functions =========================
7171
7172impl ToBytes<1> for Rtcsh0ThreshLo {
7173    #[allow(clippy::cast_possible_truncation)]
7174    fn to_le_bytes(&self) -> [u8; 1] {
7175        let mut val: [u8; 1] = [0; 1];
7176        // DATA @ Rtcsh0ThreshLo[7:0]:
7177        val[0] |= self.data as u8;
7178        val
7179    }
7180}
7181
7182impl FromBytes<1> for Rtcsh0ThreshLo {
7183    fn from_le_bytes(val: &[u8; 1]) -> Self {
7184        Self {
7185          // DATA @ Rtcsh0ThreshLo[7:0]:
7186          data: val[0],
7187        }
7188    }
7189}
7190
7191impl From<Rtcsh0ThreshLo> for u8 {
7192    fn from(value: Rtcsh0ThreshLo) -> Self {
7193        Self::from_le_bytes(value.to_le_bytes())
7194    }
7195}
7196
7197impl From<u8> for Rtcsh0ThreshLo {
7198    fn from(value: u8) -> Self {
7199        Self::from_le_bytes(&value.to_le_bytes())
7200    }
7201}
7202
7203// ==== `RTCSH1_THRESH_HI` Layout Conversion Functions =========================
7204
7205impl ToBytes<1> for Rtcsh1ThreshHi {
7206    #[allow(clippy::cast_possible_truncation)]
7207    fn to_le_bytes(&self) -> [u8; 1] {
7208        let mut val: [u8; 1] = [0; 1];
7209        // DATA @ Rtcsh1ThreshHi[7:0]:
7210        val[0] |= self.data as u8;
7211        val
7212    }
7213}
7214
7215impl FromBytes<1> for Rtcsh1ThreshHi {
7216    fn from_le_bytes(val: &[u8; 1]) -> Self {
7217        Self {
7218          // DATA @ Rtcsh1ThreshHi[7:0]:
7219          data: val[0],
7220        }
7221    }
7222}
7223
7224impl From<Rtcsh1ThreshHi> for u8 {
7225    fn from(value: Rtcsh1ThreshHi) -> Self {
7226        Self::from_le_bytes(value.to_le_bytes())
7227    }
7228}
7229
7230impl From<u8> for Rtcsh1ThreshHi {
7231    fn from(value: u8) -> Self {
7232        Self::from_le_bytes(&value.to_le_bytes())
7233    }
7234}
7235
7236// ==== `RTCSH1_THRESH_LO` Layout Conversion Functions =========================
7237
7238impl ToBytes<1> for Rtcsh1ThreshLo {
7239    #[allow(clippy::cast_possible_truncation)]
7240    fn to_le_bytes(&self) -> [u8; 1] {
7241        let mut val: [u8; 1] = [0; 1];
7242        // DATA @ Rtcsh1ThreshLo[7:0]:
7243        val[0] |= self.data as u8;
7244        val
7245    }
7246}
7247
7248impl FromBytes<1> for Rtcsh1ThreshLo {
7249    fn from_le_bytes(val: &[u8; 1]) -> Self {
7250        Self {
7251          // DATA @ Rtcsh1ThreshLo[7:0]:
7252          data: val[0],
7253        }
7254    }
7255}
7256
7257impl From<Rtcsh1ThreshLo> for u8 {
7258    fn from(value: Rtcsh1ThreshLo) -> Self {
7259        Self::from_le_bytes(value.to_le_bytes())
7260    }
7261}
7262
7263impl From<u8> for Rtcsh1ThreshLo {
7264    fn from(value: u8) -> Self {
7265        Self::from_le_bytes(&value.to_le_bytes())
7266    }
7267}
7268
7269// ==== `RTC_CLR` Layout Conversion Functions ==================================
7270
7271impl ToBytes<1> for RtcClr {
7272    #[allow(clippy::cast_possible_truncation)]
7273    fn to_le_bytes(&self) -> [u8; 1] {
7274        let mut val: [u8; 1] = [0; 1];
7275        // RTC_CLR @ RtcClr[3:0]:
7276        let rtc_clr: [u8; 1] = self.rtc_clr.to_le_bytes();
7277        val[0] |= rtc_clr[0] & 0xF;
7278        val
7279    }
7280}
7281
7282impl FromBytes<1> for RtcClr {
7283    fn from_le_bytes(val: &[u8; 1]) -> Self {
7284        // RTC_CLR @ RtcClr[3:0]:
7285        let mut rtc_clr: [u8; 1] = [0; 1];
7286        rtc_clr[0] |= val[0] & 0xF;
7287        Self {
7288          // RTC_CLR @ RtcClr[3:0]:
7289          rtc_clr: Rtc::from_le_bytes(&rtc_clr),
7290        }
7291    }
7292}
7293
7294impl From<RtcClr> for u8 {
7295    fn from(value: RtcClr) -> Self {
7296        Self::from_le_bytes(value.to_le_bytes())
7297    }
7298}
7299
7300impl From<u8> for RtcClr {
7301    fn from(value: u8) -> Self {
7302        Self::from_le_bytes(&value.to_le_bytes())
7303    }
7304}
7305
7306// ==== `RTC_SELECT` Layout Conversion Functions ===============================
7307
7308impl ToBytes<1> for RtcSelect {
7309    #[allow(clippy::cast_possible_truncation)]
7310    fn to_le_bytes(&self) -> [u8; 1] {
7311        let mut val: [u8; 1] = [0; 1];
7312        // CYCLTOP @ RtcSelect[4]:
7313        val[0] |= ((u8::from(self.cycltop) << 4) & 0x10) as u8;
7314        // RTC_SELECT @ RtcSelect[3:0]:
7315        let rtc_select: [u8; 1] = self.rtc_select.to_le_bytes();
7316        val[0] |= rtc_select[0] & 0xF;
7317        val
7318    }
7319}
7320
7321impl FromBytes<1> for RtcSelect {
7322    fn from_le_bytes(val: &[u8; 1]) -> Self {
7323        // RTC_SELECT @ RtcSelect[3:0]:
7324        let mut rtc_select: [u8; 1] = [0; 1];
7325        rtc_select[0] |= val[0] & 0xF;
7326        Self {
7327          // CYCLTOP @ RtcSelect[4]:
7328          cycltop: (val[0] & 0x10) >> 4 != 0,
7329          // RTC_SELECT @ RtcSelect[3:0]:
7330          rtc_select: Rtc::from_le_bytes(&rtc_select),
7331        }
7332    }
7333}
7334
7335impl From<RtcSelect> for u8 {
7336    fn from(value: RtcSelect) -> Self {
7337        Self::from_le_bytes(value.to_le_bytes())
7338    }
7339}
7340
7341impl From<u8> for RtcSelect {
7342    fn from(value: u8) -> Self {
7343        Self::from_le_bytes(&value.to_le_bytes())
7344    }
7345}
7346
7347// ==== `RTC_STATUS` Layout Conversion Functions ===============================
7348
7349impl ToBytes<1> for RtcStatus {
7350    #[allow(clippy::cast_possible_truncation)]
7351    fn to_le_bytes(&self) -> [u8; 1] {
7352        let mut val: [u8; 1] = [0; 1];
7353        // RTC_SELECT @ RtcStatus[3:0]:
7354        let rtc_select: [u8; 1] = self.rtc_select.to_le_bytes();
7355        val[0] |= rtc_select[0] & 0xF;
7356        val
7357    }
7358}
7359
7360impl FromBytes<1> for RtcStatus {
7361    fn from_le_bytes(val: &[u8; 1]) -> Self {
7362        // RTC_SELECT @ RtcStatus[3:0]:
7363        let mut rtc_select: [u8; 1] = [0; 1];
7364        rtc_select[0] |= val[0] & 0xF;
7365        Self {
7366          // RTC_SELECT @ RtcStatus[3:0]:
7367          rtc_select: Rtc::from_le_bytes(&rtc_select),
7368        }
7369    }
7370}
7371
7372impl From<RtcStatus> for u8 {
7373    fn from(value: RtcStatus) -> Self {
7374        Self::from_le_bytes(value.to_le_bytes())
7375    }
7376}
7377
7378impl From<u8> for RtcStatus {
7379    fn from(value: u8) -> Self {
7380        Self::from_le_bytes(&value.to_le_bytes())
7381    }
7382}
7383
7384// ==== `RX_FIFO_0_2G4` Layout Conversion Functions ============================
7385
7386impl ToBytes<1> for RxFifo02g4 {
7387    #[allow(clippy::cast_possible_truncation)]
7388    fn to_le_bytes(&self) -> [u8; 1] {
7389        let mut val: [u8; 1] = [0; 1];
7390        // DATA @ RxFifo02g4[7:0]:
7391        val[0] |= self.data as u8;
7392        val
7393    }
7394}
7395
7396impl FromBytes<1> for RxFifo02g4 {
7397    fn from_le_bytes(val: &[u8; 1]) -> Self {
7398        Self {
7399          // DATA @ RxFifo02g4[7:0]:
7400          data: val[0],
7401        }
7402    }
7403}
7404
7405impl From<RxFifo02g4> for u8 {
7406    fn from(value: RxFifo02g4) -> Self {
7407        Self::from_le_bytes(value.to_le_bytes())
7408    }
7409}
7410
7411impl From<u8> for RxFifo02g4 {
7412    fn from(value: u8) -> Self {
7413        Self::from_le_bytes(&value.to_le_bytes())
7414    }
7415}
7416
7417// ==== `RX_FIFO_0_433` Layout Conversion Functions ============================
7418
7419impl ToBytes<1> for RxFifo0433 {
7420    #[allow(clippy::cast_possible_truncation)]
7421    fn to_le_bytes(&self) -> [u8; 1] {
7422        let mut val: [u8; 1] = [0; 1];
7423        // DATA @ RxFifo0433[7:0]:
7424        val[0] |= self.data as u8;
7425        val
7426    }
7427}
7428
7429impl FromBytes<1> for RxFifo0433 {
7430    fn from_le_bytes(val: &[u8; 1]) -> Self {
7431        Self {
7432          // DATA @ RxFifo0433[7:0]:
7433          data: val[0],
7434        }
7435    }
7436}
7437
7438impl From<RxFifo0433> for u8 {
7439    fn from(value: RxFifo0433) -> Self {
7440        Self::from_le_bytes(value.to_le_bytes())
7441    }
7442}
7443
7444impl From<u8> for RxFifo0433 {
7445    fn from(value: u8) -> Self {
7446        Self::from_le_bytes(&value.to_le_bytes())
7447    }
7448}
7449
7450// ==== `RX_FIFO_0_868` Layout Conversion Functions ============================
7451
7452impl ToBytes<1> for RxFifo0868 {
7453    #[allow(clippy::cast_possible_truncation)]
7454    fn to_le_bytes(&self) -> [u8; 1] {
7455        let mut val: [u8; 1] = [0; 1];
7456        // DATA @ RxFifo0868[7:0]:
7457        val[0] |= self.data as u8;
7458        val
7459    }
7460}
7461
7462impl FromBytes<1> for RxFifo0868 {
7463    fn from_le_bytes(val: &[u8; 1]) -> Self {
7464        Self {
7465          // DATA @ RxFifo0868[7:0]:
7466          data: val[0],
7467        }
7468    }
7469}
7470
7471impl From<RxFifo0868> for u8 {
7472    fn from(value: RxFifo0868) -> Self {
7473        Self::from_le_bytes(value.to_le_bytes())
7474    }
7475}
7476
7477impl From<u8> for RxFifo0868 {
7478    fn from(value: u8) -> Self {
7479        Self::from_le_bytes(&value.to_le_bytes())
7480    }
7481}
7482
7483// ==== `RX_FIFO_1_2G4` Layout Conversion Functions ============================
7484
7485impl ToBytes<1> for RxFifo12g4 {
7486    #[allow(clippy::cast_possible_truncation)]
7487    fn to_le_bytes(&self) -> [u8; 1] {
7488        let mut val: [u8; 1] = [0; 1];
7489        // DATA @ RxFifo12g4[7:0]:
7490        val[0] |= self.data as u8;
7491        val
7492    }
7493}
7494
7495impl FromBytes<1> for RxFifo12g4 {
7496    fn from_le_bytes(val: &[u8; 1]) -> Self {
7497        Self {
7498          // DATA @ RxFifo12g4[7:0]:
7499          data: val[0],
7500        }
7501    }
7502}
7503
7504impl From<RxFifo12g4> for u8 {
7505    fn from(value: RxFifo12g4) -> Self {
7506        Self::from_le_bytes(value.to_le_bytes())
7507    }
7508}
7509
7510impl From<u8> for RxFifo12g4 {
7511    fn from(value: u8) -> Self {
7512        Self::from_le_bytes(&value.to_le_bytes())
7513    }
7514}
7515
7516// ==== `RX_FIFO_1_433` Layout Conversion Functions ============================
7517
7518impl ToBytes<1> for RxFifo1433 {
7519    #[allow(clippy::cast_possible_truncation)]
7520    fn to_le_bytes(&self) -> [u8; 1] {
7521        let mut val: [u8; 1] = [0; 1];
7522        // DATA @ RxFifo1433[7:0]:
7523        val[0] |= self.data as u8;
7524        val
7525    }
7526}
7527
7528impl FromBytes<1> for RxFifo1433 {
7529    fn from_le_bytes(val: &[u8; 1]) -> Self {
7530        Self {
7531          // DATA @ RxFifo1433[7:0]:
7532          data: val[0],
7533        }
7534    }
7535}
7536
7537impl From<RxFifo1433> for u8 {
7538    fn from(value: RxFifo1433) -> Self {
7539        Self::from_le_bytes(value.to_le_bytes())
7540    }
7541}
7542
7543impl From<u8> for RxFifo1433 {
7544    fn from(value: u8) -> Self {
7545        Self::from_le_bytes(&value.to_le_bytes())
7546    }
7547}
7548
7549// ==== `RX_FIFO_1_868` Layout Conversion Functions ============================
7550
7551impl ToBytes<1> for RxFifo1868 {
7552    #[allow(clippy::cast_possible_truncation)]
7553    fn to_le_bytes(&self) -> [u8; 1] {
7554        let mut val: [u8; 1] = [0; 1];
7555        // DATA @ RxFifo1868[7:0]:
7556        val[0] |= self.data as u8;
7557        val
7558    }
7559}
7560
7561impl FromBytes<1> for RxFifo1868 {
7562    fn from_le_bytes(val: &[u8; 1]) -> Self {
7563        Self {
7564          // DATA @ RxFifo1868[7:0]:
7565          data: val[0],
7566        }
7567    }
7568}
7569
7570impl From<RxFifo1868> for u8 {
7571    fn from(value: RxFifo1868) -> Self {
7572        Self::from_le_bytes(value.to_le_bytes())
7573    }
7574}
7575
7576impl From<u8> for RxFifo1868 {
7577    fn from(value: u8) -> Self {
7578        Self::from_le_bytes(&value.to_le_bytes())
7579    }
7580}
7581
7582// ==== `RX_FIFO_2_2G4` Layout Conversion Functions ============================
7583
7584impl ToBytes<1> for RxFifo22g4 {
7585    #[allow(clippy::cast_possible_truncation)]
7586    fn to_le_bytes(&self) -> [u8; 1] {
7587        let mut val: [u8; 1] = [0; 1];
7588        // DATA @ RxFifo22g4[7:0]:
7589        val[0] |= self.data as u8;
7590        val
7591    }
7592}
7593
7594impl FromBytes<1> for RxFifo22g4 {
7595    fn from_le_bytes(val: &[u8; 1]) -> Self {
7596        Self {
7597          // DATA @ RxFifo22g4[7:0]:
7598          data: val[0],
7599        }
7600    }
7601}
7602
7603impl From<RxFifo22g4> for u8 {
7604    fn from(value: RxFifo22g4) -> Self {
7605        Self::from_le_bytes(value.to_le_bytes())
7606    }
7607}
7608
7609impl From<u8> for RxFifo22g4 {
7610    fn from(value: u8) -> Self {
7611        Self::from_le_bytes(&value.to_le_bytes())
7612    }
7613}
7614
7615// ==== `RX_FIFO_2_433` Layout Conversion Functions ============================
7616
7617impl ToBytes<1> for RxFifo2433 {
7618    #[allow(clippy::cast_possible_truncation)]
7619    fn to_le_bytes(&self) -> [u8; 1] {
7620        let mut val: [u8; 1] = [0; 1];
7621        // DATA @ RxFifo2433[7:0]:
7622        val[0] |= self.data as u8;
7623        val
7624    }
7625}
7626
7627impl FromBytes<1> for RxFifo2433 {
7628    fn from_le_bytes(val: &[u8; 1]) -> Self {
7629        Self {
7630          // DATA @ RxFifo2433[7:0]:
7631          data: val[0],
7632        }
7633    }
7634}
7635
7636impl From<RxFifo2433> for u8 {
7637    fn from(value: RxFifo2433) -> Self {
7638        Self::from_le_bytes(value.to_le_bytes())
7639    }
7640}
7641
7642impl From<u8> for RxFifo2433 {
7643    fn from(value: u8) -> Self {
7644        Self::from_le_bytes(&value.to_le_bytes())
7645    }
7646}
7647
7648// ==== `RX_FIFO_2_868` Layout Conversion Functions ============================
7649
7650impl ToBytes<1> for RxFifo2868 {
7651    #[allow(clippy::cast_possible_truncation)]
7652    fn to_le_bytes(&self) -> [u8; 1] {
7653        let mut val: [u8; 1] = [0; 1];
7654        // DATA @ RxFifo2868[7:0]:
7655        val[0] |= self.data as u8;
7656        val
7657    }
7658}
7659
7660impl FromBytes<1> for RxFifo2868 {
7661    fn from_le_bytes(val: &[u8; 1]) -> Self {
7662        Self {
7663          // DATA @ RxFifo2868[7:0]:
7664          data: val[0],
7665        }
7666    }
7667}
7668
7669impl From<RxFifo2868> for u8 {
7670    fn from(value: RxFifo2868) -> Self {
7671        Self::from_le_bytes(value.to_le_bytes())
7672    }
7673}
7674
7675impl From<u8> for RxFifo2868 {
7676    fn from(value: u8) -> Self {
7677        Self::from_le_bytes(&value.to_le_bytes())
7678    }
7679}
7680
7681// ==== `RX_FIFO_3_2G4` Layout Conversion Functions ============================
7682
7683impl ToBytes<1> for RxFifo32g4 {
7684    #[allow(clippy::cast_possible_truncation)]
7685    fn to_le_bytes(&self) -> [u8; 1] {
7686        let mut val: [u8; 1] = [0; 1];
7687        // DATA @ RxFifo32g4[7:0]:
7688        val[0] |= self.data as u8;
7689        val
7690    }
7691}
7692
7693impl FromBytes<1> for RxFifo32g4 {
7694    fn from_le_bytes(val: &[u8; 1]) -> Self {
7695        Self {
7696          // DATA @ RxFifo32g4[7:0]:
7697          data: val[0],
7698        }
7699    }
7700}
7701
7702impl From<RxFifo32g4> for u8 {
7703    fn from(value: RxFifo32g4) -> Self {
7704        Self::from_le_bytes(value.to_le_bytes())
7705    }
7706}
7707
7708impl From<u8> for RxFifo32g4 {
7709    fn from(value: u8) -> Self {
7710        Self::from_le_bytes(&value.to_le_bytes())
7711    }
7712}
7713
7714// ==== `RX_FIFO_3_433` Layout Conversion Functions ============================
7715
7716impl ToBytes<1> for RxFifo3433 {
7717    #[allow(clippy::cast_possible_truncation)]
7718    fn to_le_bytes(&self) -> [u8; 1] {
7719        let mut val: [u8; 1] = [0; 1];
7720        // DATA @ RxFifo3433[7:0]:
7721        val[0] |= self.data as u8;
7722        val
7723    }
7724}
7725
7726impl FromBytes<1> for RxFifo3433 {
7727    fn from_le_bytes(val: &[u8; 1]) -> Self {
7728        Self {
7729          // DATA @ RxFifo3433[7:0]:
7730          data: val[0],
7731        }
7732    }
7733}
7734
7735impl From<RxFifo3433> for u8 {
7736    fn from(value: RxFifo3433) -> Self {
7737        Self::from_le_bytes(value.to_le_bytes())
7738    }
7739}
7740
7741impl From<u8> for RxFifo3433 {
7742    fn from(value: u8) -> Self {
7743        Self::from_le_bytes(&value.to_le_bytes())
7744    }
7745}
7746
7747// ==== `RX_FIFO_3_868` Layout Conversion Functions ============================
7748
7749impl ToBytes<1> for RxFifo3868 {
7750    #[allow(clippy::cast_possible_truncation)]
7751    fn to_le_bytes(&self) -> [u8; 1] {
7752        let mut val: [u8; 1] = [0; 1];
7753        // DATA @ RxFifo3868[7:0]:
7754        val[0] |= self.data as u8;
7755        val
7756    }
7757}
7758
7759impl FromBytes<1> for RxFifo3868 {
7760    fn from_le_bytes(val: &[u8; 1]) -> Self {
7761        Self {
7762          // DATA @ RxFifo3868[7:0]:
7763          data: val[0],
7764        }
7765    }
7766}
7767
7768impl From<RxFifo3868> for u8 {
7769    fn from(value: RxFifo3868) -> Self {
7770        Self::from_le_bytes(value.to_le_bytes())
7771    }
7772}
7773
7774impl From<u8> for RxFifo3868 {
7775    fn from(value: u8) -> Self {
7776        Self::from_le_bytes(&value.to_le_bytes())
7777    }
7778}
7779
7780// ==== `RX_FIFO_4_2G4` Layout Conversion Functions ============================
7781
7782impl ToBytes<1> for RxFifo42g4 {
7783    #[allow(clippy::cast_possible_truncation)]
7784    fn to_le_bytes(&self) -> [u8; 1] {
7785        let mut val: [u8; 1] = [0; 1];
7786        // DATA @ RxFifo42g4[7:0]:
7787        val[0] |= self.data as u8;
7788        val
7789    }
7790}
7791
7792impl FromBytes<1> for RxFifo42g4 {
7793    fn from_le_bytes(val: &[u8; 1]) -> Self {
7794        Self {
7795          // DATA @ RxFifo42g4[7:0]:
7796          data: val[0],
7797        }
7798    }
7799}
7800
7801impl From<RxFifo42g4> for u8 {
7802    fn from(value: RxFifo42g4) -> Self {
7803        Self::from_le_bytes(value.to_le_bytes())
7804    }
7805}
7806
7807impl From<u8> for RxFifo42g4 {
7808    fn from(value: u8) -> Self {
7809        Self::from_le_bytes(&value.to_le_bytes())
7810    }
7811}
7812
7813// ==== `RX_FIFO_4_433` Layout Conversion Functions ============================
7814
7815impl ToBytes<1> for RxFifo4433 {
7816    #[allow(clippy::cast_possible_truncation)]
7817    fn to_le_bytes(&self) -> [u8; 1] {
7818        let mut val: [u8; 1] = [0; 1];
7819        // DATA @ RxFifo4433[7:0]:
7820        val[0] |= self.data as u8;
7821        val
7822    }
7823}
7824
7825impl FromBytes<1> for RxFifo4433 {
7826    fn from_le_bytes(val: &[u8; 1]) -> Self {
7827        Self {
7828          // DATA @ RxFifo4433[7:0]:
7829          data: val[0],
7830        }
7831    }
7832}
7833
7834impl From<RxFifo4433> for u8 {
7835    fn from(value: RxFifo4433) -> Self {
7836        Self::from_le_bytes(value.to_le_bytes())
7837    }
7838}
7839
7840impl From<u8> for RxFifo4433 {
7841    fn from(value: u8) -> Self {
7842        Self::from_le_bytes(&value.to_le_bytes())
7843    }
7844}
7845
7846// ==== `RX_FIFO_4_868` Layout Conversion Functions ============================
7847
7848impl ToBytes<1> for RxFifo4868 {
7849    #[allow(clippy::cast_possible_truncation)]
7850    fn to_le_bytes(&self) -> [u8; 1] {
7851        let mut val: [u8; 1] = [0; 1];
7852        // DATA @ RxFifo4868[7:0]:
7853        val[0] |= self.data as u8;
7854        val
7855    }
7856}
7857
7858impl FromBytes<1> for RxFifo4868 {
7859    fn from_le_bytes(val: &[u8; 1]) -> Self {
7860        Self {
7861          // DATA @ RxFifo4868[7:0]:
7862          data: val[0],
7863        }
7864    }
7865}
7866
7867impl From<RxFifo4868> for u8 {
7868    fn from(value: RxFifo4868) -> Self {
7869        Self::from_le_bytes(value.to_le_bytes())
7870    }
7871}
7872
7873impl From<u8> for RxFifo4868 {
7874    fn from(value: u8) -> Self {
7875        Self::from_le_bytes(&value.to_le_bytes())
7876    }
7877}
7878
7879// ==== `RX_FIFO_5_2G4` Layout Conversion Functions ============================
7880
7881impl ToBytes<1> for RxFifo52g4 {
7882    #[allow(clippy::cast_possible_truncation)]
7883    fn to_le_bytes(&self) -> [u8; 1] {
7884        let mut val: [u8; 1] = [0; 1];
7885        // DATA @ RxFifo52g4[7:0]:
7886        val[0] |= self.data as u8;
7887        val
7888    }
7889}
7890
7891impl FromBytes<1> for RxFifo52g4 {
7892    fn from_le_bytes(val: &[u8; 1]) -> Self {
7893        Self {
7894          // DATA @ RxFifo52g4[7:0]:
7895          data: val[0],
7896        }
7897    }
7898}
7899
7900impl From<RxFifo52g4> for u8 {
7901    fn from(value: RxFifo52g4) -> Self {
7902        Self::from_le_bytes(value.to_le_bytes())
7903    }
7904}
7905
7906impl From<u8> for RxFifo52g4 {
7907    fn from(value: u8) -> Self {
7908        Self::from_le_bytes(&value.to_le_bytes())
7909    }
7910}
7911
7912// ==== `RX_FIFO_5_433` Layout Conversion Functions ============================
7913
7914impl ToBytes<1> for RxFifo5433 {
7915    #[allow(clippy::cast_possible_truncation)]
7916    fn to_le_bytes(&self) -> [u8; 1] {
7917        let mut val: [u8; 1] = [0; 1];
7918        // DATA @ RxFifo5433[7:0]:
7919        val[0] |= self.data as u8;
7920        val
7921    }
7922}
7923
7924impl FromBytes<1> for RxFifo5433 {
7925    fn from_le_bytes(val: &[u8; 1]) -> Self {
7926        Self {
7927          // DATA @ RxFifo5433[7:0]:
7928          data: val[0],
7929        }
7930    }
7931}
7932
7933impl From<RxFifo5433> for u8 {
7934    fn from(value: RxFifo5433) -> Self {
7935        Self::from_le_bytes(value.to_le_bytes())
7936    }
7937}
7938
7939impl From<u8> for RxFifo5433 {
7940    fn from(value: u8) -> Self {
7941        Self::from_le_bytes(&value.to_le_bytes())
7942    }
7943}
7944
7945// ==== `RX_FIFO_5_868` Layout Conversion Functions ============================
7946
7947impl ToBytes<1> for RxFifo5868 {
7948    #[allow(clippy::cast_possible_truncation)]
7949    fn to_le_bytes(&self) -> [u8; 1] {
7950        let mut val: [u8; 1] = [0; 1];
7951        // DATA @ RxFifo5868[7:0]:
7952        val[0] |= self.data as u8;
7953        val
7954    }
7955}
7956
7957impl FromBytes<1> for RxFifo5868 {
7958    fn from_le_bytes(val: &[u8; 1]) -> Self {
7959        Self {
7960          // DATA @ RxFifo5868[7:0]:
7961          data: val[0],
7962        }
7963    }
7964}
7965
7966impl From<RxFifo5868> for u8 {
7967    fn from(value: RxFifo5868) -> Self {
7968        Self::from_le_bytes(value.to_le_bytes())
7969    }
7970}
7971
7972impl From<u8> for RxFifo5868 {
7973    fn from(value: u8) -> Self {
7974        Self::from_le_bytes(&value.to_le_bytes())
7975    }
7976}
7977
7978// ==== `VERSION` Layout Conversion Functions ==================================
7979
7980impl ToBytes<1> for Version {
7981    #[allow(clippy::cast_possible_truncation)]
7982    fn to_le_bytes(&self) -> [u8; 1] {
7983        let mut val: [u8; 1] = [0; 1];
7984        // VERSION_NUMBER @ Version[7:0]:
7985        val[0] |= 0x41; // Fixed value.
7986        val
7987    }
7988}
7989
7990impl FromBytes<1> for Version {
7991    fn from_le_bytes(_val: &[u8; 1]) -> Self {
7992        Self {
7993        }
7994    }
7995}
7996
7997impl From<Version> for u8 {
7998    fn from(value: Version) -> Self {
7999        Self::from_le_bytes(value.to_le_bytes())
8000    }
8001}
8002
8003impl From<u8> for Version {
8004    fn from(value: u8) -> Self {
8005        Self::from_le_bytes(&value.to_le_bytes())
8006    }
8007}
8008
8009// ==== `XTAL_GOOD` Layout Conversion Functions ================================
8010
8011impl ToBytes<1> for XtalGood {
8012    #[allow(clippy::cast_possible_truncation)]
8013    fn to_le_bytes(&self) -> [u8; 1] {
8014        let mut val: [u8; 1] = [0; 1];
8015        // DATA @ XtalGood[0]:
8016        val[0] |= (u8::from(self.data) & 0x1) as u8;
8017        val
8018    }
8019}
8020
8021impl FromBytes<1> for XtalGood {
8022    fn from_le_bytes(val: &[u8; 1]) -> Self {
8023        Self {
8024          // DATA @ XtalGood[0]:
8025          data: val[0] & 0x1 != 0,
8026        }
8027    }
8028}
8029
8030impl From<XtalGood> for u8 {
8031    fn from(value: XtalGood) -> Self {
8032        Self::from_le_bytes(value.to_le_bytes())
8033    }
8034}
8035
8036impl From<u8> for XtalGood {
8037    fn from(value: u8) -> Self {
8038        Self::from_le_bytes(&value.to_le_bytes())
8039    }
8040}
8041
8042// ==== `XTAL_OSC_CTRL` Layout Conversion Functions ============================
8043
8044impl ToBytes<1> for XtalOscCtrl {
8045    #[allow(clippy::cast_possible_truncation)]
8046    fn to_le_bytes(&self) -> [u8; 1] {
8047        let mut val: [u8; 1] = [0; 1];
8048        // DATA @ XtalOscCtrl[0]:
8049        val[0] |= (u8::from(self.data) & 0x1) as u8;
8050        val
8051    }
8052}
8053
8054impl FromBytes<1> for XtalOscCtrl {
8055    fn from_le_bytes(val: &[u8; 1]) -> Self {
8056        Self {
8057          // DATA @ XtalOscCtrl[0]:
8058          data: val[0] & 0x1 != 0,
8059        }
8060    }
8061}
8062
8063impl From<XtalOscCtrl> for u8 {
8064    fn from(value: XtalOscCtrl) -> Self {
8065        Self::from_le_bytes(value.to_le_bytes())
8066    }
8067}
8068
8069impl From<u8> for XtalOscCtrl {
8070    fn from(value: u8) -> Self {
8071        Self::from_le_bytes(&value.to_le_bytes())
8072    }
8073}