1#![no_std]
2
3#[doc(hidden)]
4#[macro_export]
5macro_rules! wire_enum {
6 ($vis:vis enum $name:ident { $($variant:ident = $value:expr,)+ }) => {
7 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
8 #[repr(u8)]
9 #[non_exhaustive]
10 $vis enum $name {
11 $($variant = $value,)+
12 }
13
14 impl $name {
15 $vis const ALL: &'static [Self] = &[$(Self::$variant,)+];
16
17 #[must_use]
18 $vis const fn from_u8(value: u8) -> Option<Self> {
19 $(if value == $value {
20 return Some(Self::$variant);
21 })+
22 None
23 }
24
25 #[must_use]
26 $vis const fn as_u8(self) -> u8 {
27 self as u8
28 }
29 }
30
31 impl ::core::convert::TryFrom<u8> for $name {
32 type Error = u8;
33
34 fn try_from(value: u8) -> ::core::result::Result<Self, u8> {
35 Self::from_u8(value).ok_or(value)
36 }
37 }
38 };
39}
40
41mod cmd;
42mod error;
43pub mod fpga_update;
44mod frame;
45pub mod layout;
46mod mode;
47pub mod params;
48pub mod payload;
49mod telemetry;
50pub mod update;
51
52pub use cmd::Cmd;
53pub use error::{Error, describe_device_error};
54pub use frame::{DEVICE_TO_HOST_BYTES, HOST_TO_DEVICE_BYTES, PAYLOAD_BYTES};
55pub use mode::Mode;
56pub use telemetry::Telemetry;