1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use crate::{
raw,
typestates::init_state,
peripherals::syscon,
};
crate::wrap_stateful_peripheral!(Gpio, GPIO);
impl Gpio {
pub fn enabled(mut self, syscon: &mut syscon::Syscon) -> Gpio<init_state::Enabled> {
syscon.enable_clock(&mut self.raw);
Gpio {
raw: self.raw,
_state: init_state::Enabled(()),
}
}
pub fn disabled(mut self, syscon: &mut syscon::Syscon) -> Gpio<init_state::Disabled> {
syscon.disable_clock(&mut self.raw);
Gpio {
raw: self.raw,
_state: init_state::Disabled,
}
}
}