1#![allow(clippy::unnecessary_cast)]
2#![allow(clippy::module_name_repetitions)]
3#![allow(unused_imports)]
4use core::convert::Infallible;
127use core::fmt::{Debug, Display};
128
129pub 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
141pub 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
155pub 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
167impl<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
185pub 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
197impl<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#[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
224pub 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#[derive(Debug, PartialEq)]
269pub struct Nfa433Slow {
270 pub data: SampleRate,
272}
273
274impl Register<1, u8> for Nfa433Slow {
276 const ADDRESS: u8 = 0x0;
277 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x5]));
278}
279
280impl Default for Nfa433Slow {
282 fn default() -> Self {
283 Self {
284 data: SampleRate::Sr1024,
285 }
286 }
287}
288
289#[derive(Debug, PartialEq)]
299pub struct Nfa433Fast {
300 pub data: SampleRate,
302}
303
304impl Register<1, u8> for Nfa433Fast {
306 const ADDRESS: u8 = 0x1;
307 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
308}
309
310impl Default for Nfa433Fast {
312 fn default() -> Self {
313 Self {
314 data: SampleRate::Sr32768,
315 }
316 }
317}
318
319#[derive(Debug, PartialEq)]
329pub struct Nfa868Slow {
330 pub data: SampleRate,
332}
333
334impl Register<1, u8> for Nfa868Slow {
336 const ADDRESS: u8 = 0x2;
337 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x5]));
338}
339
340impl Default for Nfa868Slow {
342 fn default() -> Self {
343 Self {
344 data: SampleRate::Sr1024,
345 }
346 }
347}
348
349#[derive(Debug, PartialEq)]
359pub struct Nfa868Fast {
360 pub data: SampleRate,
362}
363
364impl Register<1, u8> for Nfa868Fast {
366 const ADDRESS: u8 = 0x3;
367 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
368}
369
370impl Default for Nfa868Fast {
372 fn default() -> Self {
373 Self {
374 data: SampleRate::Sr32768,
375 }
376 }
377}
378
379#[derive(Debug, PartialEq)]
389pub struct Nfa2g4Slow {
390 pub data: SampleRate,
392}
393
394impl Register<1, u8> for Nfa2g4Slow {
396 const ADDRESS: u8 = 0x4;
397 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x5]));
398}
399
400impl Default for Nfa2g4Slow {
402 fn default() -> Self {
403 Self {
404 data: SampleRate::Sr1024,
405 }
406 }
407}
408
409#[derive(Debug, PartialEq)]
419pub struct Nfa2g4Fast {
420 pub data: SampleRate,
422}
423
424impl Register<1, u8> for Nfa2g4Fast {
426 const ADDRESS: u8 = 0x5;
427 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
428}
429
430impl Default for Nfa2g4Fast {
432 fn default() -> Self {
433 Self {
434 data: SampleRate::Sr32768,
435 }
436 }
437}
438
439#[derive(Debug, PartialEq)]
449pub struct CalibStatus {
450 pub cal_in_prog: bool,
454 pub lco_cal_in_prog: bool,
458 pub offset_cal_in_prog: bool,
462 pub spg_cal_in_prog: bool,
466}
467
468impl Register<1, u8> for CalibStatus {
470 const ADDRESS: u8 = 0x6;
471 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
472}
473
474impl 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#[derive(Debug, PartialEq)]
496pub struct CalibCtrl {
497 pub cal_start: bool,
501 pub lco_cal: bool,
505 pub offset_cal: bool,
509 pub spg_cal: bool,
513}
514
515impl Register<1, u8> for CalibCtrl {
517 const ADDRESS: u8 = 0x7;
518 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0xE]));
519}
520
521impl 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#[derive(Debug, PartialEq)]
543pub struct NSpgTarget {
544 pub data: u8,
546}
547
548impl Register<1, u8> for NSpgTarget {
550 const ADDRESS: u8 = 0x9;
551 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x31]));
552}
553
554impl Default for NSpgTarget {
556 fn default() -> Self {
557 Self {
558 data: 0x31,
559 }
560 }
561}
562
563#[derive(Debug, PartialEq)]
573pub struct NLcoTarget433Hi {
574 pub data: u8,
576}
577
578impl Register<1, u8> for NLcoTarget433Hi {
580 const ADDRESS: u8 = 0xB;
581 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0xE]));
582}
583
584impl Default for NLcoTarget433Hi {
586 fn default() -> Self {
587 Self {
588 data: 0xE,
589 }
590 }
591}
592
593#[derive(Debug, PartialEq)]
603pub struct NLcoTarget433Lo {
604 pub data: u8,
606}
607
608impl Register<1, u8> for NLcoTarget433Lo {
610 const ADDRESS: u8 = 0xC;
611 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x20]));
612}
613
614impl Default for NLcoTarget433Lo {
616 fn default() -> Self {
617 Self {
618 data: 0x20,
619 }
620 }
621}
622
623#[derive(Debug, PartialEq)]
633pub struct NLcoTarget868Hi {
634 pub data: u8,
636}
637
638impl Register<1, u8> for NLcoTarget868Hi {
640 const ADDRESS: u8 = 0xD;
641 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0xD]));
642}
643
644impl Default for NLcoTarget868Hi {
646 fn default() -> Self {
647 Self {
648 data: 0xD,
649 }
650 }
651}
652
653#[derive(Debug, PartialEq)]
663pub struct NLcoTarget868Lo {
664 pub data: u8,
666}
667
668impl Register<1, u8> for NLcoTarget868Lo {
670 const ADDRESS: u8 = 0xE;
671 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x87]));
672}
673
674impl Default for NLcoTarget868Lo {
676 fn default() -> Self {
677 Self {
678 data: 0x87,
679 }
680 }
681}
682
683#[derive(Debug, PartialEq)]
693pub struct NLcoTarget2g4Hi {
694 pub data: u8,
696}
697
698impl Register<1, u8> for NLcoTarget2g4Hi {
700 const ADDRESS: u8 = 0xF;
701 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x12]));
702}
703
704impl Default for NLcoTarget2g4Hi {
706 fn default() -> Self {
707 Self {
708 data: 0x12,
709 }
710 }
711}
712
713#[derive(Debug, PartialEq)]
723pub struct NLcoTarget2g4Lo {
724 pub data: u8,
726}
727
728impl Register<1, u8> for NLcoTarget2g4Lo {
730 const ADDRESS: u8 = 0x10;
731 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0xCE]));
732}
733
734impl Default for NLcoTarget2g4Lo {
736 fn default() -> Self {
737 Self {
738 data: 0xCE,
739 }
740 }
741}
742
743#[derive(Debug, PartialEq)]
753pub struct LcoFreq433Hi {
754 pub data: u8,
756}
757
758impl Register<1, u8> for LcoFreq433Hi {
760 const ADDRESS: u8 = 0x14;
761 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
762}
763
764impl Default for LcoFreq433Hi {
766 fn default() -> Self {
767 Self {
768 data: 0x0,
769 }
770 }
771}
772
773#[derive(Debug, PartialEq)]
783pub struct LcoFreq433Lo {
784 pub data: u8,
786}
787
788impl Register<1, u8> for LcoFreq433Lo {
790 const ADDRESS: u8 = 0x15;
791 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
792}
793
794impl Default for LcoFreq433Lo {
796 fn default() -> Self {
797 Self {
798 data: 0x0,
799 }
800 }
801}
802
803#[derive(Debug, PartialEq)]
813pub struct LcoFreq868Hi {
814 pub data: u8,
816}
817
818impl Register<1, u8> for LcoFreq868Hi {
820 const ADDRESS: u8 = 0x16;
821 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
822}
823
824impl Default for LcoFreq868Hi {
826 fn default() -> Self {
827 Self {
828 data: 0x0,
829 }
830 }
831}
832
833#[derive(Debug, PartialEq)]
843pub struct LcoFreq868Lo {
844 pub data: u8,
846}
847
848impl Register<1, u8> for LcoFreq868Lo {
850 const ADDRESS: u8 = 0x17;
851 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
852}
853
854impl Default for LcoFreq868Lo {
856 fn default() -> Self {
857 Self {
858 data: 0x0,
859 }
860 }
861}
862
863#[derive(Debug, PartialEq)]
873pub struct LcoFreq2g4Hi {
874 pub data: u8,
876}
877
878impl Register<1, u8> for LcoFreq2g4Hi {
880 const ADDRESS: u8 = 0x18;
881 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
882}
883
884impl Default for LcoFreq2g4Hi {
886 fn default() -> Self {
887 Self {
888 data: 0x0,
889 }
890 }
891}
892
893#[derive(Debug, PartialEq)]
903pub struct LcoFreq2g4Lo {
904 pub data: u8,
906}
907
908impl Register<1, u8> for LcoFreq2g4Lo {
910 const ADDRESS: u8 = 0x19;
911 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
912}
913
914impl Default for LcoFreq2g4Lo {
916 fn default() -> Self {
917 Self {
918 data: 0x0,
919 }
920 }
921}
922
923#[derive(Debug, PartialEq)]
933pub struct DCornerCtrl {
934 pub data: u8,
936}
937
938impl Register<1, u8> for DCornerCtrl {
940 const ADDRESS: u8 = 0x23;
941 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
942}
943
944impl Default for DCornerCtrl {
946 fn default() -> Self {
947 Self {
948 data: 0x0,
949 }
950 }
951}
952
953#[derive(Debug, PartialEq)]
963pub struct BandBranchCtrl {
964 pub active_bands: Bands,
968 pub active_branches: Branches,
972}
973
974impl Register<1, u8> for BandBranchCtrl {
976 const ADDRESS: u8 = 0x24;
977 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x77]));
978}
979
980impl 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#[derive(Debug, PartialEq)]
1008pub struct CodeSelect {
1009 pub a: BinCode,
1013 pub b: BinCode,
1017}
1018
1019impl Register<1, u8> for CodeSelect {
1021 const ADDRESS: u8 = 0x28;
1022 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x10]));
1023}
1024
1025impl Default for CodeSelect {
1027 fn default() -> Self {
1028 Self {
1029 a: BinCode::A,
1030 b: BinCode::B,
1031 }
1032 }
1033}
1034
1035#[derive(Debug, PartialEq)]
1045pub struct KorrelThreshA {
1046 pub data: u8,
1048}
1049
1050impl Register<1, u8> for KorrelThreshA {
1052 const ADDRESS: u8 = 0x29;
1053 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x1A]));
1054}
1055
1056impl Default for KorrelThreshA {
1058 fn default() -> Self {
1059 Self {
1060 data: 0x1A,
1061 }
1062 }
1063}
1064
1065#[derive(Debug, PartialEq)]
1075pub struct KorrelThreshB {
1076 pub data: u8,
1078}
1079
1080impl Register<1, u8> for KorrelThreshB {
1082 const ADDRESS: u8 = 0x2A;
1083 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x1A]));
1084}
1085
1086impl Default for KorrelThreshB {
1088 fn default() -> Self {
1089 Self {
1090 data: 0x1A,
1091 }
1092 }
1093}
1094
1095#[derive(Debug, PartialEq)]
1103pub struct KorrelState {
1104 pub korrel_branches_a: Branches,
1108 pub korrel_branches_b: Branches,
1112 pub korrel_branches_latest: KorrelBranchesLatest,
1116}
1117
1118#[derive(Clone, Copy, Debug, PartialEq)]
1121pub enum KorrelBranchesLatest {
1122 Band2g4, Band433, Band868, }
1129
1130impl Register<1, u8> for KorrelState {
1132 const ADDRESS: u8 = 0x2B;
1133 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0xC0]));
1134}
1135
1136#[derive(Debug, PartialEq)]
1146pub struct KorrelVal {
1147 pub a: u8,
1151 pub b: u8,
1155}
1156
1157impl Register<1, u8> for KorrelVal {
1159 const ADDRESS: u8 = 0x2C;
1160 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1161}
1162
1163impl Default for KorrelVal {
1165 fn default() -> Self {
1166 Self {
1167 a: 0x0,
1168 b: 0x0,
1169 }
1170 }
1171}
1172
1173#[derive(Debug, PartialEq)]
1183pub struct FddEnable {
1184 pub fdd_bands: Bands,
1186}
1187
1188impl Register<1, u8> for FddEnable {
1190 const ADDRESS: u8 = 0x2D;
1191 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x7]));
1192}
1193
1194impl 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#[derive(Debug, PartialEq)]
1217pub struct FddActive {
1218 pub band_2g4: FddMode,
1220 pub band_433: FddMode,
1222 pub band_868: FddMode,
1224}
1225
1226impl Register<1, u8> for FddActive {
1228 const ADDRESS: u8 = 0x2E;
1229 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1230}
1231
1232impl 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#[derive(Debug, PartialEq)]
1253pub struct FoQuit {
1254 pub quit_bands: Bands,
1256}
1257
1258impl Register<1, u8> for FoQuit {
1260 const ADDRESS: u8 = 0x2F;
1261 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1262}
1263
1264impl 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#[derive(Debug, PartialEq)]
1287pub struct FddExitCond {
1288 pub band_2g4: ExitCond,
1290 pub band_433: ExitCond,
1292 pub band_868: ExitCond,
1294}
1295
1296impl Register<1, u8> for FddExitCond {
1298 const ADDRESS: u8 = 0x30;
1299 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1300}
1301
1302impl 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#[derive(Debug, PartialEq)]
1323pub struct IrqSelect {
1324 pub irq_select: IrqSource,
1326}
1327
1328impl Register<1, u8> for IrqSelect {
1330 const ADDRESS: u8 = 0x31;
1331 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x1]));
1332}
1333
1334impl 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#[derive(Debug, PartialEq)]
1362pub struct IrqStatus {
1363 pub irq_status: IrqSource,
1365}
1366
1367impl Register<1, u8> for IrqStatus {
1369 const ADDRESS: u8 = 0x32;
1370 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1371}
1372
1373impl 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#[derive(Debug, PartialEq)]
1401pub struct IrqClr {
1402 pub irq_clr: IrqSource,
1404}
1405
1406impl Register<1, u8> for IrqClr {
1408 const ADDRESS: u8 = 0x33;
1409 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1410}
1411
1412impl 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#[derive(Debug, PartialEq)]
1440pub struct IrqSet {
1441 pub irq_set: IrqSource,
1443}
1444
1445impl Register<1, u8> for IrqSet {
1447 const ADDRESS: u8 = 0x34;
1448 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1449}
1450
1451impl 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#[derive(Debug, PartialEq)]
1479pub struct IdHi {
1480 pub data: u8,
1482}
1483
1484impl Register<1, u8> for IdHi {
1486 const ADDRESS: u8 = 0x35;
1487 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x7D]));
1488}
1489
1490impl Default for IdHi {
1492 fn default() -> Self {
1493 Self {
1494 data: 0x7D,
1495 }
1496 }
1497}
1498
1499#[derive(Debug, PartialEq)]
1509pub struct IdLo {
1510 pub data: u8,
1512}
1513
1514impl Register<1, u8> for IdLo {
1516 const ADDRESS: u8 = 0x36;
1517 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0xA8]));
1518}
1519
1520impl Default for IdLo {
1522 fn default() -> Self {
1523 Self {
1524 data: 0xA8,
1525 }
1526 }
1527}
1528
1529#[derive(Debug, PartialEq)]
1539pub struct IdmEnable {
1540 pub match_bands: Bands,
1542}
1543
1544impl Register<1, u8> for IdmEnable {
1546 const ADDRESS: u8 = 0x37;
1547 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x7]));
1548}
1549
1550impl 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#[derive(Debug, PartialEq)]
1573pub struct IdmCtrl {
1574 pub ctrl: Ctrl,
1576}
1577
1578#[derive(Clone, Copy, Debug, PartialEq)]
1580pub enum Ctrl {
1581 BroadOnly, IndGroup, IndGroupBroad, IndOnly, }
1590
1591impl Register<1, u8> for IdmCtrl {
1593 const ADDRESS: u8 = 0x38;
1594 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1595}
1596
1597impl Default for IdmCtrl {
1599 fn default() -> Self {
1600 Self {
1601 ctrl: Ctrl::IndOnly,
1602 }
1603 }
1604}
1605
1606#[derive(Debug, PartialEq)]
1616pub struct IdmClr {
1617 pub branch: bool,
1619}
1620
1621impl Register<1, u8> for IdmClr {
1623 const ADDRESS: u8 = 0x39;
1624 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1625}
1626
1627impl Default for IdmClr {
1629 fn default() -> Self {
1630 Self {
1631 branch: false,
1632 }
1633 }
1634}
1635
1636#[derive(Debug, PartialEq)]
1646pub struct IdmBand {
1647 pub data: Data,
1649}
1650
1651#[derive(Clone, Copy, Debug, PartialEq)]
1653pub enum Data {
1654 Band2g4, Band433, Band868, }
1658
1659impl Register<1, u8> for IdmBand {
1661 const ADDRESS: u8 = 0x3A;
1662 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x3]));
1663}
1664
1665#[derive(Debug, PartialEq)]
1675pub struct IdmReason {
1676 pub reason: Reason,
1678}
1679
1680#[derive(Clone, Copy, Debug, PartialEq)]
1682pub enum Reason {
1683 BroadMatch, GroupMatch, IndMatch, Unknown, }
1692
1693impl Register<1, u8> for IdmReason {
1695 const ADDRESS: u8 = 0x3B;
1696 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1697}
1698
1699impl Default for IdmReason {
1701 fn default() -> Self {
1702 Self {
1703 reason: Reason::Unknown,
1704 }
1705 }
1706}
1707
1708#[derive(Debug, PartialEq)]
1718pub struct RtcSelect {
1719 pub cycltop: bool,
1723 pub rtc_select: Rtc,
1725}
1726
1727impl Register<1, u8> for RtcSelect {
1729 const ADDRESS: u8 = 0x3C;
1730 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1731}
1732
1733impl 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#[derive(Debug, PartialEq)]
1758pub struct RtcStatus {
1759 pub rtc_select: Rtc,
1761}
1762
1763impl Register<1, u8> for RtcStatus {
1765 const ADDRESS: u8 = 0x3D;
1766 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1767}
1768
1769impl 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#[derive(Debug, PartialEq)]
1793pub struct RtcClr {
1794 pub rtc_clr: Rtc,
1796}
1797
1798impl Register<1, u8> for RtcClr {
1800 const ADDRESS: u8 = 0x3E;
1801 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1802}
1803
1804impl 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#[derive(Debug, PartialEq)]
1828pub struct Rtcsh0ThreshHi {
1829 pub data: u8,
1831}
1832
1833impl Register<1, u8> for Rtcsh0ThreshHi {
1835 const ADDRESS: u8 = 0x3F;
1836 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1837}
1838
1839impl Default for Rtcsh0ThreshHi {
1841 fn default() -> Self {
1842 Self {
1843 data: 0x0,
1844 }
1845 }
1846}
1847
1848#[derive(Debug, PartialEq)]
1858pub struct Rtcsh0ThreshLo {
1859 pub data: u8,
1861}
1862
1863impl Register<1, u8> for Rtcsh0ThreshLo {
1865 const ADDRESS: u8 = 0x40;
1866 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1867}
1868
1869impl Default for Rtcsh0ThreshLo {
1871 fn default() -> Self {
1872 Self {
1873 data: 0x0,
1874 }
1875 }
1876}
1877
1878#[derive(Debug, PartialEq)]
1888pub struct Rtcsh1ThreshHi {
1889 pub data: u8,
1891}
1892
1893impl Register<1, u8> for Rtcsh1ThreshHi {
1895 const ADDRESS: u8 = 0x41;
1896 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1897}
1898
1899impl Default for Rtcsh1ThreshHi {
1901 fn default() -> Self {
1902 Self {
1903 data: 0x0,
1904 }
1905 }
1906}
1907
1908#[derive(Debug, PartialEq)]
1918pub struct Rtcsh1ThreshLo {
1919 pub data: u8,
1921}
1922
1923impl Register<1, u8> for Rtcsh1ThreshLo {
1925 const ADDRESS: u8 = 0x42;
1926 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1927}
1928
1929impl Default for Rtcsh1ThreshLo {
1931 fn default() -> Self {
1932 Self {
1933 data: 0x0,
1934 }
1935 }
1936}
1937
1938#[derive(Debug, PartialEq)]
1948pub struct Rtclg0Thresh4 {
1949 pub data: u8,
1951}
1952
1953impl Register<1, u8> for Rtclg0Thresh4 {
1955 const ADDRESS: u8 = 0x43;
1956 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1957}
1958
1959impl Default for Rtclg0Thresh4 {
1961 fn default() -> Self {
1962 Self {
1963 data: 0x0,
1964 }
1965 }
1966}
1967
1968#[derive(Debug, PartialEq)]
1978pub struct Rtclg0Thresh3 {
1979 pub data: u8,
1981}
1982
1983impl Register<1, u8> for Rtclg0Thresh3 {
1985 const ADDRESS: u8 = 0x44;
1986 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
1987}
1988
1989impl Default for Rtclg0Thresh3 {
1991 fn default() -> Self {
1992 Self {
1993 data: 0x0,
1994 }
1995 }
1996}
1997
1998#[derive(Debug, PartialEq)]
2008pub struct Rtclg0Thresh2 {
2009 pub data: u8,
2011}
2012
2013impl Register<1, u8> for Rtclg0Thresh2 {
2015 const ADDRESS: u8 = 0x45;
2016 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2017}
2018
2019impl Default for Rtclg0Thresh2 {
2021 fn default() -> Self {
2022 Self {
2023 data: 0x0,
2024 }
2025 }
2026}
2027
2028#[derive(Debug, PartialEq)]
2038pub struct Rtclg0Thresh1 {
2039 pub data: u8,
2041}
2042
2043impl Register<1, u8> for Rtclg0Thresh1 {
2045 const ADDRESS: u8 = 0x46;
2046 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2047}
2048
2049impl Default for Rtclg0Thresh1 {
2051 fn default() -> Self {
2052 Self {
2053 data: 0x0,
2054 }
2055 }
2056}
2057
2058#[derive(Debug, PartialEq)]
2068pub struct Rtclg0Thresh0 {
2069 pub data: u8,
2071}
2072
2073impl Register<1, u8> for Rtclg0Thresh0 {
2075 const ADDRESS: u8 = 0x47;
2076 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2077}
2078
2079impl Default for Rtclg0Thresh0 {
2081 fn default() -> Self {
2082 Self {
2083 data: 0x0,
2084 }
2085 }
2086}
2087
2088#[derive(Debug, PartialEq)]
2098pub struct Rtclg1Thresh4 {
2099 pub data: u8,
2101}
2102
2103impl Register<1, u8> for Rtclg1Thresh4 {
2105 const ADDRESS: u8 = 0x48;
2106 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2107}
2108
2109impl Default for Rtclg1Thresh4 {
2111 fn default() -> Self {
2112 Self {
2113 data: 0x0,
2114 }
2115 }
2116}
2117
2118#[derive(Debug, PartialEq)]
2128pub struct Rtclg1Thresh3 {
2129 pub data: u8,
2131}
2132
2133impl Register<1, u8> for Rtclg1Thresh3 {
2135 const ADDRESS: u8 = 0x49;
2136 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2137}
2138
2139impl Default for Rtclg1Thresh3 {
2141 fn default() -> Self {
2142 Self {
2143 data: 0x0,
2144 }
2145 }
2146}
2147
2148#[derive(Debug, PartialEq)]
2158pub struct Rtclg1Thresh2 {
2159 pub data: u8,
2161}
2162
2163impl Register<1, u8> for Rtclg1Thresh2 {
2165 const ADDRESS: u8 = 0x4A;
2166 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2167}
2168
2169impl Default for Rtclg1Thresh2 {
2171 fn default() -> Self {
2172 Self {
2173 data: 0x0,
2174 }
2175 }
2176}
2177
2178#[derive(Debug, PartialEq)]
2188pub struct Rtclg1Thresh1 {
2189 pub data: u8,
2191}
2192
2193impl Register<1, u8> for Rtclg1Thresh1 {
2195 const ADDRESS: u8 = 0x4B;
2196 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2197}
2198
2199impl Default for Rtclg1Thresh1 {
2201 fn default() -> Self {
2202 Self {
2203 data: 0x0,
2204 }
2205 }
2206}
2207
2208#[derive(Debug, PartialEq)]
2218pub struct Rtclg1Thresh0 {
2219 pub data: u8,
2221}
2222
2223impl Register<1, u8> for Rtclg1Thresh0 {
2225 const ADDRESS: u8 = 0x4C;
2226 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2227}
2228
2229impl Default for Rtclg1Thresh0 {
2231 fn default() -> Self {
2232 Self {
2233 data: 0x0,
2234 }
2235 }
2236}
2237
2238#[derive(Debug, PartialEq)]
2248pub struct Cyclpresc {
2249 pub data: u8,
2251}
2252
2253impl Register<1, u8> for Cyclpresc {
2255 const ADDRESS: u8 = 0x4D;
2256 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2257}
2258
2259impl Default for Cyclpresc {
2261 fn default() -> Self {
2262 Self {
2263 data: 0x0,
2264 }
2265 }
2266}
2267
2268#[derive(Debug, PartialEq)]
2278pub struct CycltopHi {
2279 pub data: u8,
2281}
2282
2283impl Register<1, u8> for CycltopHi {
2285 const ADDRESS: u8 = 0x4E;
2286 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2287}
2288
2289impl Default for CycltopHi {
2291 fn default() -> Self {
2292 Self {
2293 data: 0x0,
2294 }
2295 }
2296}
2297
2298#[derive(Debug, PartialEq)]
2308pub struct CycltopLo {
2309 pub data: u8,
2311}
2312
2313impl Register<1, u8> for CycltopLo {
2315 const ADDRESS: u8 = 0x4F;
2316 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2317}
2318
2319impl Default for CycltopLo {
2321 fn default() -> Self {
2322 Self {
2323 data: 0x0,
2324 }
2325 }
2326}
2327
2328#[derive(Debug, PartialEq)]
2338pub struct Cntr404 {
2339 pub data: u8,
2341}
2342
2343impl Register<1, u8> for Cntr404 {
2345 const ADDRESS: u8 = 0x50;
2346 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2347}
2348
2349impl Default for Cntr404 {
2351 fn default() -> Self {
2352 Self {
2353 data: 0x0,
2354 }
2355 }
2356}
2357
2358#[derive(Debug, PartialEq)]
2368pub struct Cntr403 {
2369 pub data: u8,
2371}
2372
2373impl Register<1, u8> for Cntr403 {
2375 const ADDRESS: u8 = 0x51;
2376 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2377}
2378
2379impl Default for Cntr403 {
2381 fn default() -> Self {
2382 Self {
2383 data: 0x0,
2384 }
2385 }
2386}
2387
2388#[derive(Debug, PartialEq)]
2398pub struct Cntr402 {
2399 pub data: u8,
2401}
2402
2403impl Register<1, u8> for Cntr402 {
2405 const ADDRESS: u8 = 0x52;
2406 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2407}
2408
2409impl Default for Cntr402 {
2411 fn default() -> Self {
2412 Self {
2413 data: 0x0,
2414 }
2415 }
2416}
2417
2418#[derive(Debug, PartialEq)]
2428pub struct Cntr401 {
2429 pub data: u8,
2431}
2432
2433impl Register<1, u8> for Cntr401 {
2435 const ADDRESS: u8 = 0x53;
2436 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2437}
2438
2439impl Default for Cntr401 {
2441 fn default() -> Self {
2442 Self {
2443 data: 0x0,
2444 }
2445 }
2446}
2447
2448#[derive(Debug, PartialEq)]
2458pub struct Cntr400 {
2459 pub data: u8,
2461}
2462
2463impl Register<1, u8> for Cntr400 {
2465 const ADDRESS: u8 = 0x54;
2466 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2467}
2468
2469impl Default for Cntr400 {
2471 fn default() -> Self {
2472 Self {
2473 data: 0x0,
2474 }
2475 }
2476}
2477
2478#[derive(Debug, PartialEq)]
2488pub struct Cntr40Clr {
2489 pub clr: bool,
2491}
2492
2493impl Register<1, u8> for Cntr40Clr {
2495 const ADDRESS: u8 = 0x55;
2496 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2497}
2498
2499impl Default for Cntr40Clr {
2501 fn default() -> Self {
2502 Self {
2503 clr: false,
2504 }
2505 }
2506}
2507
2508#[derive(Debug, PartialEq)]
2518pub struct FifoLength {
2519 pub band_2g4: FifoLen,
2521 pub band_433: FifoLen,
2523 pub band_868: FifoLen,
2525}
2526
2527impl Register<1, u8> for FifoLength {
2529 const ADDRESS: u8 = 0x56;
2530 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x14]));
2531}
2532
2533impl 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#[derive(Debug, PartialEq)]
2554pub struct FifoCount433 {
2555 pub data: u8,
2557}
2558
2559impl Register<1, u8> for FifoCount433 {
2561 const ADDRESS: u8 = 0x57;
2562 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2563}
2564
2565impl Default for FifoCount433 {
2567 fn default() -> Self {
2568 Self {
2569 data: 0x0,
2570 }
2571 }
2572}
2573
2574#[derive(Debug, PartialEq)]
2584pub struct FifoCount868 {
2585 pub data: u8,
2587}
2588
2589impl Register<1, u8> for FifoCount868 {
2591 const ADDRESS: u8 = 0x58;
2592 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2593}
2594
2595impl Default for FifoCount868 {
2597 fn default() -> Self {
2598 Self {
2599 data: 0x0,
2600 }
2601 }
2602}
2603
2604#[derive(Debug, PartialEq)]
2614pub struct FifoCount2g4 {
2615 pub data: u8,
2617}
2618
2619impl Register<1, u8> for FifoCount2g4 {
2621 const ADDRESS: u8 = 0x59;
2622 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2623}
2624
2625impl Default for FifoCount2g4 {
2627 fn default() -> Self {
2628 Self {
2629 data: 0x0,
2630 }
2631 }
2632}
2633
2634#[derive(Debug, PartialEq)]
2644pub struct RxFifo5433 {
2645 pub data: u8,
2647}
2648
2649impl Register<1, u8> for RxFifo5433 {
2651 const ADDRESS: u8 = 0x5A;
2652 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2653}
2654
2655impl Default for RxFifo5433 {
2657 fn default() -> Self {
2658 Self {
2659 data: 0x0,
2660 }
2661 }
2662}
2663
2664#[derive(Debug, PartialEq)]
2674pub struct RxFifo4433 {
2675 pub data: u8,
2677}
2678
2679impl Register<1, u8> for RxFifo4433 {
2681 const ADDRESS: u8 = 0x5B;
2682 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2683}
2684
2685impl Default for RxFifo4433 {
2687 fn default() -> Self {
2688 Self {
2689 data: 0x0,
2690 }
2691 }
2692}
2693
2694#[derive(Debug, PartialEq)]
2704pub struct RxFifo3433 {
2705 pub data: u8,
2707}
2708
2709impl Register<1, u8> for RxFifo3433 {
2711 const ADDRESS: u8 = 0x5C;
2712 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2713}
2714
2715impl Default for RxFifo3433 {
2717 fn default() -> Self {
2718 Self {
2719 data: 0x0,
2720 }
2721 }
2722}
2723
2724#[derive(Debug, PartialEq)]
2734pub struct RxFifo2433 {
2735 pub data: u8,
2737}
2738
2739impl Register<1, u8> for RxFifo2433 {
2741 const ADDRESS: u8 = 0x5D;
2742 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2743}
2744
2745impl Default for RxFifo2433 {
2747 fn default() -> Self {
2748 Self {
2749 data: 0x0,
2750 }
2751 }
2752}
2753
2754#[derive(Debug, PartialEq)]
2764pub struct RxFifo1433 {
2765 pub data: u8,
2767}
2768
2769impl Register<1, u8> for RxFifo1433 {
2771 const ADDRESS: u8 = 0x5E;
2772 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2773}
2774
2775impl Default for RxFifo1433 {
2777 fn default() -> Self {
2778 Self {
2779 data: 0x0,
2780 }
2781 }
2782}
2783
2784#[derive(Debug, PartialEq)]
2794pub struct RxFifo0433 {
2795 pub data: u8,
2797}
2798
2799impl Register<1, u8> for RxFifo0433 {
2801 const ADDRESS: u8 = 0x5F;
2802 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2803}
2804
2805impl Default for RxFifo0433 {
2807 fn default() -> Self {
2808 Self {
2809 data: 0x0,
2810 }
2811 }
2812}
2813
2814#[derive(Debug, PartialEq)]
2824pub struct RxFifo5868 {
2825 pub data: u8,
2827}
2828
2829impl Register<1, u8> for RxFifo5868 {
2831 const ADDRESS: u8 = 0x60;
2832 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2833}
2834
2835impl Default for RxFifo5868 {
2837 fn default() -> Self {
2838 Self {
2839 data: 0x0,
2840 }
2841 }
2842}
2843
2844#[derive(Debug, PartialEq)]
2854pub struct RxFifo4868 {
2855 pub data: u8,
2857}
2858
2859impl Register<1, u8> for RxFifo4868 {
2861 const ADDRESS: u8 = 0x61;
2862 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2863}
2864
2865impl Default for RxFifo4868 {
2867 fn default() -> Self {
2868 Self {
2869 data: 0x0,
2870 }
2871 }
2872}
2873
2874#[derive(Debug, PartialEq)]
2884pub struct RxFifo3868 {
2885 pub data: u8,
2887}
2888
2889impl Register<1, u8> for RxFifo3868 {
2891 const ADDRESS: u8 = 0x62;
2892 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2893}
2894
2895impl Default for RxFifo3868 {
2897 fn default() -> Self {
2898 Self {
2899 data: 0x0,
2900 }
2901 }
2902}
2903
2904#[derive(Debug, PartialEq)]
2914pub struct RxFifo2868 {
2915 pub data: u8,
2917}
2918
2919impl Register<1, u8> for RxFifo2868 {
2921 const ADDRESS: u8 = 0x63;
2922 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2923}
2924
2925impl Default for RxFifo2868 {
2927 fn default() -> Self {
2928 Self {
2929 data: 0x0,
2930 }
2931 }
2932}
2933
2934#[derive(Debug, PartialEq)]
2944pub struct RxFifo1868 {
2945 pub data: u8,
2947}
2948
2949impl Register<1, u8> for RxFifo1868 {
2951 const ADDRESS: u8 = 0x64;
2952 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2953}
2954
2955impl Default for RxFifo1868 {
2957 fn default() -> Self {
2958 Self {
2959 data: 0x0,
2960 }
2961 }
2962}
2963
2964#[derive(Debug, PartialEq)]
2974pub struct RxFifo0868 {
2975 pub data: u8,
2977}
2978
2979impl Register<1, u8> for RxFifo0868 {
2981 const ADDRESS: u8 = 0x65;
2982 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
2983}
2984
2985impl Default for RxFifo0868 {
2987 fn default() -> Self {
2988 Self {
2989 data: 0x0,
2990 }
2991 }
2992}
2993
2994#[derive(Debug, PartialEq)]
3004pub struct RxFifo52g4 {
3005 pub data: u8,
3007}
3008
3009impl Register<1, u8> for RxFifo52g4 {
3011 const ADDRESS: u8 = 0x66;
3012 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
3013}
3014
3015impl Default for RxFifo52g4 {
3017 fn default() -> Self {
3018 Self {
3019 data: 0x0,
3020 }
3021 }
3022}
3023
3024#[derive(Debug, PartialEq)]
3034pub struct RxFifo42g4 {
3035 pub data: u8,
3037}
3038
3039impl Register<1, u8> for RxFifo42g4 {
3041 const ADDRESS: u8 = 0x67;
3042 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
3043}
3044
3045impl Default for RxFifo42g4 {
3047 fn default() -> Self {
3048 Self {
3049 data: 0x0,
3050 }
3051 }
3052}
3053
3054#[derive(Debug, PartialEq)]
3064pub struct RxFifo32g4 {
3065 pub data: u8,
3067}
3068
3069impl Register<1, u8> for RxFifo32g4 {
3071 const ADDRESS: u8 = 0x68;
3072 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
3073}
3074
3075impl Default for RxFifo32g4 {
3077 fn default() -> Self {
3078 Self {
3079 data: 0x0,
3080 }
3081 }
3082}
3083
3084#[derive(Debug, PartialEq)]
3094pub struct RxFifo22g4 {
3095 pub data: u8,
3097}
3098
3099impl Register<1, u8> for RxFifo22g4 {
3101 const ADDRESS: u8 = 0x69;
3102 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
3103}
3104
3105impl Default for RxFifo22g4 {
3107 fn default() -> Self {
3108 Self {
3109 data: 0x0,
3110 }
3111 }
3112}
3113
3114#[derive(Debug, PartialEq)]
3124pub struct RxFifo12g4 {
3125 pub data: u8,
3127}
3128
3129impl Register<1, u8> for RxFifo12g4 {
3131 const ADDRESS: u8 = 0x6A;
3132 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
3133}
3134
3135impl Default for RxFifo12g4 {
3137 fn default() -> Self {
3138 Self {
3139 data: 0x0,
3140 }
3141 }
3142}
3143
3144#[derive(Debug, PartialEq)]
3154pub struct RxFifo02g4 {
3155 pub data: u8,
3157}
3158
3159impl Register<1, u8> for RxFifo02g4 {
3161 const ADDRESS: u8 = 0x6B;
3162 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
3163}
3164
3165impl Default for RxFifo02g4 {
3167 fn default() -> Self {
3168 Self {
3169 data: 0x0,
3170 }
3171 }
3172}
3173
3174#[derive(Debug, PartialEq)]
3184pub struct ActualNfa433 {
3185 pub fast: SampleRate,
3187 pub slow: SampleRate,
3189}
3190
3191impl Register<1, u8> for ActualNfa433 {
3193 const ADDRESS: u8 = 0x6C;
3194 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x25]));
3195}
3196
3197impl Default for ActualNfa433 {
3199 fn default() -> Self {
3200 Self {
3201 fast: SampleRate::Sr8192,
3202 slow: SampleRate::Sr1024,
3203 }
3204 }
3205}
3206
3207#[derive(Debug, PartialEq)]
3217pub struct ActualNfa868 {
3218 pub fast: SampleRate,
3220 pub slow: SampleRate,
3222}
3223
3224impl Register<1, u8> for ActualNfa868 {
3226 const ADDRESS: u8 = 0x6D;
3227 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x15]));
3228}
3229
3230impl Default for ActualNfa868 {
3232 fn default() -> Self {
3233 Self {
3234 fast: SampleRate::Sr16384,
3235 slow: SampleRate::Sr1024,
3236 }
3237 }
3238}
3239
3240#[derive(Debug, PartialEq)]
3250pub struct ActualNfa2g4 {
3251 pub fast: SampleRate,
3253 pub slow: SampleRate,
3255}
3256
3257impl Register<1, u8> for ActualNfa2g4 {
3259 const ADDRESS: u8 = 0x6E;
3260 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x25]));
3261}
3262
3263impl Default for ActualNfa2g4 {
3265 fn default() -> Self {
3266 Self {
3267 fast: SampleRate::Sr8192,
3268 slow: SampleRate::Sr1024,
3269 }
3270 }
3271}
3272
3273#[derive(Debug, PartialEq)]
3283pub struct ActualBandselect {
3284 pub selected_bands: Bands,
3286}
3287
3288impl Register<1, u8> for ActualBandselect {
3290 const ADDRESS: u8 = 0x6F;
3291 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x7]));
3292}
3293
3294impl 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#[derive(Debug, PartialEq)]
3317pub struct Genpurp1 {
3318 pub data: u8,
3320}
3321
3322impl Register<1, u8> for Genpurp1 {
3324 const ADDRESS: u8 = 0x71;
3325 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
3326}
3327
3328impl Default for Genpurp1 {
3330 fn default() -> Self {
3331 Self {
3332 data: 0x0,
3333 }
3334 }
3335}
3336
3337#[derive(Debug, PartialEq)]
3347pub struct XtalOscCtrl {
3348 pub data: bool,
3350}
3351
3352impl Register<1, u8> for XtalOscCtrl {
3354 const ADDRESS: u8 = 0x73;
3355 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x1]));
3356}
3357
3358impl Default for XtalOscCtrl {
3360 fn default() -> Self {
3361 Self {
3362 data: true,
3363 }
3364 }
3365}
3366
3367#[derive(Debug, PartialEq)]
3380pub struct LdoXtalCtrl {
3381 pub ldo_ena_nfa: bool,
3385 pub xtal_osc_byp: bool,
3389}
3390
3391impl Register<1, u8> for LdoXtalCtrl {
3393 const ADDRESS: u8 = 0x74;
3394 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x3]));
3395}
3396
3397impl Default for LdoXtalCtrl {
3399 fn default() -> Self {
3400 Self {
3401 ldo_ena_nfa: false,
3402 xtal_osc_byp: false,
3403 }
3404 }
3405}
3406
3407#[derive(Debug, PartialEq)]
3417pub struct MuxDOutSel {
3418 pub out: Out,
3420}
3421
3422#[derive(Clone, Copy, Debug, PartialEq)]
3424pub enum Out {
3425 Clk32IrqEvent, IdmWupA433, IrqEvent1, Rx2g4, Rx433, Rx868, WupA2g4RxActive, WupA433RxActive, WupA868RxActive, WupAB2g4, WupAB868, }
3448
3449impl Register<1, u8> for MuxDOutSel {
3451 const ADDRESS: u8 = 0x75;
3452 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0xF]));
3453}
3454
3455impl Default for MuxDOutSel {
3457 fn default() -> Self {
3458 Self {
3459 out: Out::IrqEvent1,
3460 }
3461 }
3462}
3463
3464#[derive(Debug, PartialEq)]
3474pub struct LcTgEna {
3475 pub data: bool,
3477}
3478
3479impl Register<1, u8> for LcTgEna {
3481 const ADDRESS: u8 = 0x76;
3482 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x1]));
3483}
3484
3485impl Default for LcTgEna {
3487 fn default() -> Self {
3488 Self {
3489 data: true,
3490 }
3491 }
3492}
3493
3494#[derive(Debug, PartialEq)]
3504pub struct XtalGood {
3505 pub data: bool,
3507}
3508
3509impl Register<1, u8> for XtalGood {
3511 const ADDRESS: u8 = 0x77;
3512 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
3513}
3514
3515impl Default for XtalGood {
3517 fn default() -> Self {
3518 Self {
3519 data: false,
3520 }
3521 }
3522}
3523
3524#[derive(Debug, PartialEq)]
3534pub struct CompThreshW {
3535 pub data: u8,
3537}
3538
3539impl Register<1, u8> for CompThreshW {
3541 const ADDRESS: u8 = 0x78;
3542 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
3543}
3544
3545impl Default for CompThreshW {
3547 fn default() -> Self {
3548 Self {
3549 data: 0x0,
3550 }
3551 }
3552}
3553
3554#[derive(Debug, PartialEq)]
3564pub struct KorrelSvClear {
3565 pub data: bool,
3567}
3568
3569impl Register<1, u8> for KorrelSvClear {
3571 const ADDRESS: u8 = 0x7C;
3572 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x0]));
3573}
3574
3575impl Default for KorrelSvClear {
3577 fn default() -> Self {
3578 Self {
3579 data: false,
3580 }
3581 }
3582}
3583
3584#[derive(Debug, PartialEq)]
3597pub struct Version {
3598}
3599
3600impl Register<1, u8> for Version {
3602 const ADDRESS: u8 = 0x7F;
3603 const RESET_VAL: Option<ResetVal<1>> = Some(ResetVal::LittleEndian([0x41]));
3604}
3605
3606impl Default for Version {
3608 fn default() -> Self {
3609 Self {
3610 }
3611 }
3612}
3613
3614#[derive(Clone, Copy, Debug, PartialEq)]
3617pub enum BinCode {
3618 A, AInv, ASeq, B, BInv, BSeq, C, D, One16, One24, One31, One8, Ooozzz, Oozz, Zero31, Zozo, }
3651
3652#[derive(Clone, Copy, Debug, PartialEq)]
3653pub enum ExitCond {
3654 ForceQuit, IdFail, NoReason, Timeout, }
3663
3664#[derive(Clone, Copy, Debug, PartialEq)]
3665pub enum FddMode {
3666 Fast, Slow, }
3671
3672#[derive(Clone, Copy, Debug, PartialEq)]
3673pub enum FifoLen {
3674 Bit16, Bit24, Bit32, Bit40, }
3683
3684#[derive(Clone, Copy, Debug, PartialEq)]
3685pub enum SampleRate {
3686 Sr0256, Sr0512, Sr16384, Sr1024, Sr2048, Sr32768, Sr4096, Sr8192, }
3703
3704#[derive(Debug, PartialEq)]
3708pub struct Bands {
3709 pub band_2g4: bool,
3713 pub band_433: bool,
3717 pub band_868: bool,
3721}
3722
3723#[derive(Debug, PartialEq)]
3727pub struct Branches {
3728 pub medium: bool,
3732 pub strong: bool,
3736 pub weak: bool,
3740}
3741
3742#[derive(Debug, PartialEq)]
3746pub struct IrqSource {
3747 pub correl_match: bool,
3751 pub cyclic_timer_alarm: bool,
3755 pub fifo_full: bool,
3759 pub fifo_overflow: bool,
3763 pub id_match: bool,
3767 pub id_match_and_fifo_full: bool,
3771 pub id_match_and_ldr: bool,
3775 pub rtc_timer_alarm: bool,
3779}
3780
3781#[derive(Debug, PartialEq)]
3785pub struct Rtc {
3786 pub rtclg0: bool,
3790 pub rtclg1: bool,
3794 pub rtcsh0: bool,
3798 pub rtcsh1: bool,
3802}
3803
3804impl 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
3866impl 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
3904impl 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
3929impl 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
3967impl 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
4001impl 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
4039impl 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
4064impl 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
4105impl 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
4143impl 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
4189impl 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 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 let mut selected_bands: [u8; 1] = [0; 1];
4206 selected_bands[0] |= val[0] & 0x7;
4207 Self {
4208 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
4226impl 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 let fast: [u8; 1] = self.fast.to_le_bytes();
4234 val[0] |= (fast[0] << 4) & 0x70;
4235 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 let mut fast: [u8; 1] = [0; 1];
4246 fast[0] |= (val[0] & 0x70) >> 4;
4247 let mut slow: [u8; 1] = [0; 1];
4249 slow[0] |= val[0] & 0x7;
4250 Self {
4251 fast: SampleRate::from_masked_le_bytes(&fast),
4253 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
4271impl 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 let fast: [u8; 1] = self.fast.to_le_bytes();
4279 val[0] |= (fast[0] << 4) & 0x70;
4280 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 let mut fast: [u8; 1] = [0; 1];
4291 fast[0] |= (val[0] & 0x70) >> 4;
4292 let mut slow: [u8; 1] = [0; 1];
4294 slow[0] |= val[0] & 0x7;
4295 Self {
4296 fast: SampleRate::from_masked_le_bytes(&fast),
4298 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
4316impl 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 let fast: [u8; 1] = self.fast.to_le_bytes();
4324 val[0] |= (fast[0] << 4) & 0x70;
4325 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 let mut fast: [u8; 1] = [0; 1];
4336 fast[0] |= (val[0] & 0x70) >> 4;
4337 let mut slow: [u8; 1] = [0; 1];
4339 slow[0] |= val[0] & 0x7;
4340 Self {
4341 fast: SampleRate::from_masked_le_bytes(&fast),
4343 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
4361impl 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 val[0] |= ((u8::from(self.band_2g4) << 2) & 0x4) as u8;
4369 val[0] |= (u8::from(self.band_433) & 0x1) as u8;
4371 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: (val[0] & 0x4) >> 2 != 0,
4382 band_433: val[0] & 0x1 != 0,
4384 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
4402impl 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 let active_bands: [u8; 1] = self.active_bands.to_le_bytes();
4410 val[0] |= (active_bands[0] << 4) & 0x70;
4411 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 let mut active_bands: [u8; 1] = [0; 1];
4422 active_bands[0] |= (val[0] & 0x70) >> 4;
4423 let mut active_branches: [u8; 1] = [0; 1];
4425 active_branches[0] |= val[0] & 0x7;
4426 Self {
4427 active_bands: Bands::from_le_bytes(&active_bands),
4429 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
4447impl 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 val[0] |= ((u8::from(self.medium) << 1) & 0x2) as u8;
4455 val[0] |= ((u8::from(self.strong) << 2) & 0x4) as u8;
4457 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: (val[0] & 0x2) >> 1 != 0,
4468 strong: (val[0] & 0x4) >> 2 != 0,
4470 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
4488impl 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 val[0] |= (u8::from(self.cal_start) & 0x1) as u8;
4496 val[0] |= ((u8::from(self.lco_cal) << 1) & 0x2) as u8;
4498 val[0] |= ((u8::from(self.offset_cal) << 3) & 0x8) as u8;
4500 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: val[0] & 0x1 != 0,
4511 lco_cal: (val[0] & 0x2) >> 1 != 0,
4513 offset_cal: (val[0] & 0x8) >> 3 != 0,
4515 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
4533impl 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 val[0] |= (u8::from(self.cal_in_prog) & 0x1) as u8;
4541 val[0] |= ((u8::from(self.lco_cal_in_prog) << 1) & 0x2) as u8;
4543 val[0] |= ((u8::from(self.offset_cal_in_prog) << 3) & 0x8) as u8;
4545 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: val[0] & 0x1 != 0,
4556 lco_cal_in_prog: (val[0] & 0x2) >> 1 != 0,
4558 offset_cal_in_prog: (val[0] & 0x8) >> 3 != 0,
4560 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
4578impl 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 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: 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
4611impl 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 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: 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
4644impl 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 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: 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
4677impl 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 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: 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
4710impl 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 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: 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
4743impl 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 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: 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
4776impl 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 let a: [u8; 1] = self.a.to_le_bytes();
4784 val[0] |= a[0] & 0xF;
4785 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 let mut a: [u8; 1] = [0; 1];
4796 a[0] |= val[0] & 0xF;
4797 let mut b: [u8; 1] = [0; 1];
4799 b[0] |= (val[0] & 0xF0) >> 4;
4800 Self {
4801 a: BinCode::from_masked_le_bytes(&a),
4803 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
4821impl 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 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: 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
4854impl 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 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: 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
4887impl 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 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: 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
4920impl 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 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: 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
4953impl 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 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: 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
4986impl 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 let band_2g4: [u8; 1] = self.band_2g4.to_le_bytes();
4994 val[0] |= band_2g4[0] & 0x1;
4995 let band_433: [u8; 1] = self.band_433.to_le_bytes();
4997 val[0] |= (band_433[0] << 2) & 0x4;
4998 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 let mut band_2g4: [u8; 1] = [0; 1];
5009 band_2g4[0] |= val[0] & 0x1;
5010 let mut band_433: [u8; 1] = [0; 1];
5012 band_433[0] |= (val[0] & 0x4) >> 2;
5013 let mut band_868: [u8; 1] = [0; 1];
5015 band_868[0] |= (val[0] & 0x2) >> 1;
5016 Self {
5017 band_2g4: FddMode::from_masked_le_bytes(&band_2g4),
5019 band_433: FddMode::from_masked_le_bytes(&band_433),
5021 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
5039impl 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 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 let mut fdd_bands: [u8; 1] = [0; 1];
5056 fdd_bands[0] |= val[0] & 0x7;
5057 Self {
5058 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
5076impl 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 let band_2g4: [u8; 1] = self.band_2g4.to_le_bytes();
5084 val[0] |= (band_2g4[0] << 4) & 0x30;
5085 let band_433: [u8; 1] = self.band_433.to_le_bytes();
5087 val[0] |= band_433[0] & 0x3;
5088 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 let mut band_2g4: [u8; 1] = [0; 1];
5099 band_2g4[0] |= (val[0] & 0x30) >> 4;
5100 let mut band_433: [u8; 1] = [0; 1];
5102 band_433[0] |= val[0] & 0x3;
5103 let mut band_868: [u8; 1] = [0; 1];
5105 band_868[0] |= (val[0] & 0xC) >> 2;
5106 Self {
5107 band_2g4: ExitCond::from_masked_le_bytes(&band_2g4),
5109 band_433: ExitCond::from_masked_le_bytes(&band_433),
5111 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
5129impl 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 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: 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
5162impl 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 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: 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
5195impl 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 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: 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
5228impl 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 let band_2g4: [u8; 1] = self.band_2g4.to_le_bytes();
5236 val[0] |= (band_2g4[0] << 4) & 0x30;
5237 let band_433: [u8; 1] = self.band_433.to_le_bytes();
5239 val[0] |= band_433[0] & 0x3;
5240 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 let mut band_2g4: [u8; 1] = [0; 1];
5251 band_2g4[0] |= (val[0] & 0x30) >> 4;
5252 let mut band_433: [u8; 1] = [0; 1];
5254 band_433[0] |= val[0] & 0x3;
5255 let mut band_868: [u8; 1] = [0; 1];
5257 band_868[0] |= (val[0] & 0xC) >> 2;
5258 Self {
5259 band_2g4: FifoLen::from_masked_le_bytes(&band_2g4),
5261 band_433: FifoLen::from_masked_le_bytes(&band_433),
5263 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
5281impl 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 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 let mut quit_bands: [u8; 1] = [0; 1];
5298 quit_bands[0] |= val[0] & 0x7;
5299 Self {
5300 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
5318impl 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 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: 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
5351impl 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 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 let mut data: [u8; 1] = [0; 1];
5369 data[0] |= val[0] & 0x3;
5370 Ok(Self {
5371 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
5390impl 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 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: 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
5423impl 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 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 let mut ctrl: [u8; 1] = [0; 1];
5440 ctrl[0] |= val[0] & 0x3;
5441 Self {
5442 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
5460impl 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 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 let mut match_bands: [u8; 1] = [0; 1];
5477 match_bands[0] |= val[0] & 0x7;
5478 Self {
5479 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
5497impl 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 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 let mut reason: [u8; 1] = [0; 1];
5514 reason[0] |= val[0] & 0x3;
5515 Self {
5516 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
5534impl 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 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: 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
5567impl 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 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: 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
5600impl 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 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 let mut irq_clr: [u8; 1] = [0; 1];
5617 irq_clr[0] |= val[0];
5618 Self {
5619 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
5637impl 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 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 let mut irq_select: [u8; 1] = [0; 1];
5654 irq_select[0] |= val[0];
5655 Self {
5656 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
5674impl 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 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 let mut irq_set: [u8; 1] = [0; 1];
5691 irq_set[0] |= val[0];
5692 Self {
5693 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
5711impl 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 val[0] |= ((u8::from(self.correl_match) << 3) & 0x8) as u8;
5719 val[0] |= ((u8::from(self.cyclic_timer_alarm) << 7) & 0x80) as u8;
5721 val[0] |= ((u8::from(self.fifo_full) << 2) & 0x4) as u8;
5723 val[0] |= ((u8::from(self.fifo_overflow) << 1) & 0x2) as u8;
5725 val[0] |= (u8::from(self.id_match) & 0x1) as u8;
5727 val[0] |= ((u8::from(self.id_match_and_fifo_full) << 4) & 0x10) as u8;
5729 val[0] |= ((u8::from(self.id_match_and_ldr) << 5) & 0x20) as u8;
5731 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: (val[0] & 0x8) >> 3 != 0,
5742 cyclic_timer_alarm: (val[0] & 0x80) >> 7 != 0,
5744 fifo_full: (val[0] & 0x4) >> 2 != 0,
5746 fifo_overflow: (val[0] & 0x2) >> 1 != 0,
5748 id_match: val[0] & 0x1 != 0,
5750 id_match_and_fifo_full: (val[0] & 0x10) >> 4 != 0,
5752 id_match_and_ldr: (val[0] & 0x20) >> 5 != 0,
5754 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
5772impl 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 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 let mut irq_status: [u8; 1] = [0; 1];
5789 irq_status[0] |= val[0];
5790 Self {
5791 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
5809impl 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 let korrel_branches_a: [u8; 1] = self.korrel_branches_a.to_le_bytes();
5817 val[0] |= korrel_branches_a[0] & 0x7;
5818 let korrel_branches_b: [u8; 1] = self.korrel_branches_b.to_le_bytes();
5820 val[0] |= (korrel_branches_b[0] << 3) & 0x38;
5821 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 let mut korrel_branches_a: [u8; 1] = [0; 1];
5833 korrel_branches_a[0] |= val[0] & 0x7;
5834 let mut korrel_branches_b: [u8; 1] = [0; 1];
5836 korrel_branches_b[0] |= (val[0] & 0x38) >> 3;
5837 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: Branches::from_le_bytes(&korrel_branches_a),
5843 korrel_branches_b: Branches::from_le_bytes(&korrel_branches_b),
5845 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
5864impl 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 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: 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
5897impl 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 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: 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
5930impl 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 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: 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
5963impl 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 val[0] |= (self.a & 0xF) as u8;
5971 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: val[0] & 0xF,
5982 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
6000impl 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 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: 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
6033impl 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 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: 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
6066impl 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 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: 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
6099impl 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 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: 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
6132impl 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 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: 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
6165impl 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 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: 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
6198impl 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 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: 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
6231impl 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 val[0] |= 0x3; val[0] |= ((u8::from(self.ldo_ena_nfa) << 5) & 0x20) as u8;
6241 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: (val[0] & 0x20) >> 5 != 0,
6252 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
6270impl 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 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 let mut out: [u8; 1] = [0; 1];
6288 out[0] |= val[0] & 0xF;
6289 Ok(Self {
6290 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
6309impl 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 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 let mut data: [u8; 1] = [0; 1];
6326 data[0] |= val[0] & 0x7;
6327 Self {
6328 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
6346impl 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 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 let mut data: [u8; 1] = [0; 1];
6363 data[0] |= val[0] & 0x7;
6364 Self {
6365 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
6383impl 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 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 let mut data: [u8; 1] = [0; 1];
6400 data[0] |= val[0] & 0x7;
6401 Self {
6402 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
6420impl 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 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 let mut data: [u8; 1] = [0; 1];
6437 data[0] |= val[0] & 0x7;
6438 Self {
6439 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
6457impl 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 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 let mut data: [u8; 1] = [0; 1];
6474 data[0] |= val[0] & 0x7;
6475 Self {
6476 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
6494impl 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 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 let mut data: [u8; 1] = [0; 1];
6511 data[0] |= val[0] & 0x7;
6512 Self {
6513 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
6531impl 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 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: 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
6564impl 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 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: 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
6597impl 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 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: 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
6630impl 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 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: 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
6663impl 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 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: 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
6696impl 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 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: 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
6729impl 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 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: 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
6762impl 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 val[0] |= ((u8::from(self.rtclg0) << 2) & 0x4) as u8;
6770 val[0] |= ((u8::from(self.rtclg1) << 3) & 0x8) as u8;
6772 val[0] |= (u8::from(self.rtcsh0) & 0x1) as u8;
6774 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: (val[0] & 0x4) >> 2 != 0,
6785 rtclg1: (val[0] & 0x8) >> 3 != 0,
6787 rtcsh0: val[0] & 0x1 != 0,
6789 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
6807impl 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 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: 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
6840impl 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 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: 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
6873impl 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 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: 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
6906impl 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 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: 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
6939impl 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 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: 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
6972impl 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 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: 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
7005impl 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 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: 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
7038impl 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 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: 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
7071impl 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 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: 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
7104impl 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 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: 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
7137impl 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 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: 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
7170impl 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 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: 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
7203impl 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 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: 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
7236impl 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 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: 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
7269impl 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 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 let mut rtc_clr: [u8; 1] = [0; 1];
7286 rtc_clr[0] |= val[0] & 0xF;
7287 Self {
7288 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
7306impl 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 val[0] |= ((u8::from(self.cycltop) << 4) & 0x10) as u8;
7314 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 let mut rtc_select: [u8; 1] = [0; 1];
7325 rtc_select[0] |= val[0] & 0xF;
7326 Self {
7327 cycltop: (val[0] & 0x10) >> 4 != 0,
7329 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
7347impl 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 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 let mut rtc_select: [u8; 1] = [0; 1];
7364 rtc_select[0] |= val[0] & 0xF;
7365 Self {
7366 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
7384impl 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 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: 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
7417impl 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 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: 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
7450impl 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 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: 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
7483impl 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 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: 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
7516impl 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 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: 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
7549impl 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 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: 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
7582impl 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 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: 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
7615impl 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 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: 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
7648impl 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 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: 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
7681impl 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 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: 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
7714impl 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 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: 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
7747impl 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 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: 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
7780impl 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 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: 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
7813impl 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 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: 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
7846impl 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 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: 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
7879impl 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 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: 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
7912impl 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 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: 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
7945impl 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 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: 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
7978impl 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 val[0] |= 0x41; 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
8009impl 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 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: 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
8042impl 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 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: 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}