peripherals/example/field_type.rs
1//! Example of generated field type API
2//!
3//! Take a look at the source of this module to see the macro invocation used.
4
5crate::field_type! {
6 /// An enum
7 enum Mode [u8, u16] {
8 A = 0,
9 B = 1,
10 C = 2,
11 D = 3,
12 }
13}
14
15crate::field_type! {
16 /// A newtype struct
17 struct Data [u8, u16] (u8);
18}
19
20crate::field_type! {
21 /// An enum with two variants. It implements `Not`
22 enum State [u8, u16] {
23 Low = 0,
24 High = 1,
25 }
26}
27
28crate::field_type! {
29 /// A newtype struct over a bool. It implements `Not`
30 struct Status [u8, u16] (bool);
31}