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
32
33
use crate::{
    raw,
    peripherals::{
        syscon,
    },
    typestates::{
        init_state,
    }
};

crate::wrap_stateful_peripheral!(InputMux, INPUTMUX);

impl<State> InputMux<State> {
    pub fn enabled(mut self, syscon: &mut syscon::Syscon) -> InputMux<init_state::Enabled> {
        syscon.enable_clock(&mut self.raw);

        InputMux {
            raw: self.raw,
            _state: init_state::Enabled(()),
        }
    }

    pub fn disabled(mut self, syscon: &mut syscon::Syscon) -> InputMux<init_state::Disabled> {
        syscon.disable_clock(&mut self.raw);

        InputMux {
            raw: self.raw,
            _state: init_state::Disabled,
        }
    }

}