lpc55_hal/typestates.rs
1/// Encodes the state of peripherals: Unknown, Enabled, or Disabled.
2///
3/// The default state of peripherals is `Unknown`, which is not
4/// quite zero cost, but since we may have been jumped to from a
5/// bootloader, we can't rely on reset state as per user manual.
6///
7/// The exception are peripherals which are "always on", such as `Syscon`.
8pub mod init_state {
9 pub trait InitState {}
10
11 /// Indicates that the state of the peripheral is not known
12 pub struct Unknown;
13 impl InitState for Unknown {}
14
15 /// Indicates that the hardware component is enabled
16 ///
17 /// This usually indicates that the hardware has been initialized and can be
18 /// used for its intended purpose. Contains an optional payload that APIs
19 /// can use to keep data that is only available while enabled.
20 ///
21 pub struct Enabled<T = ()>(pub T);
22 impl InitState for Enabled {}
23
24 /// Indicates that the hardware component is disabled
25 pub struct Disabled;
26 impl InitState for Disabled {}
27}
28
29pub mod pin;
30
31/// Using generics for this seems quite painful
32pub mod main_clock {
33
34 #[derive(Copy, Clone, Debug, PartialEq)]
35 pub enum MainClock {
36 // Unknown,
37 Fro12Mhz,
38 Fro96Mhz,
39 Pll0,
40 }
41 // pub trait MainClock {}
42
43 // pub struct Unknown;
44 // impl MainClock for Unknown {}
45
46 // pub struct Fro12Mhz;
47 // impl MainClock for Fro12Mhz {}
48
49 // pub struct Fro96Mhz;
50 // impl MainClock for Fro96Mhz {}
51}
52
53pub mod usbfs_mode {
54 pub trait UsbfsMode {}
55
56 pub struct Unknown;
57 impl UsbfsMode for Unknown {}
58
59 pub struct Device;
60 impl UsbfsMode for Device {}
61
62 pub struct Host;
63 impl UsbfsMode for Host {}
64}
65
66pub mod usbhs_mode {
67 pub trait UsbhsMode {}
68
69 pub struct Unknown;
70 impl UsbhsMode for Unknown {}
71
72 pub struct Device;
73 impl UsbhsMode for Device {}
74
75 pub struct Host;
76 impl UsbhsMode for Host {}
77}
78
79/// Application can only obtain this token from
80/// a frozen Clocks (clock-tree configuration)
81#[derive(Copy, Clone)]
82pub struct ClocksSupportFlexcommToken {
83 pub(crate) __: (),
84}
85
86/// Application can only obtain this token from
87/// a frozen Clocks (clock-tree configuration) for
88/// which USB clocks have been configured properly.
89#[derive(Copy, Clone)]
90pub struct ClocksSupportUsbfsToken {
91 pub(crate) __: (),
92}
93
94/// Application can only obtain this token from
95/// a frozen Clocks (clock-tree configuration) for
96/// which USB clocks have been configured properly.
97#[derive(Copy, Clone)]
98pub struct ClocksSupportUsbhsToken {
99 pub(crate) __: (),
100}
101
102/// Application can only obtain this token from
103/// a frozen Clocks (clock-tree configuration)
104#[derive(Copy, Clone)]
105pub struct ClocksSupportUtickToken {
106 pub(crate) __: (),
107}
108
109/// Application can only obtain this token from
110/// a frozen Clocks (clock-tree configuration)
111#[derive(Copy, Clone)]
112pub struct ClocksSupportTouchToken {
113 pub(crate) __: (),
114}
115
116/// Application can only obtain this token from
117/// a frozen Clocks (clock-tree configuration)
118#[derive(Copy, Clone)]
119pub struct ClocksSupport1MhzFroToken {
120 pub(crate) __: (),
121}
122
123/// Application can only obtain this token from
124/// a frozen Clocks (clock-tree configuration)
125#[derive(Copy, Clone)]
126pub struct ClocksSupport32KhzFroToken {
127 pub(crate) __: (),
128}
129
130pub mod flash_state {}
131
132pub mod reg_proxy;