1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use crate::clock::EicClock;
use crate::pac;

pub mod pin;

pub struct EIC {
    eic: pac::EIC,
}

impl EIC {
    pub fn init(pm: &mut pac::PM, _clock: EicClock, eic: pac::EIC) -> Self {
        pm.apbamask.modify(|_, w| w.eic_().set_bit());

        eic.ctrl.modify(|_, w| w.enable().set_bit());
        while eic.status.read().syncbusy().bit_is_set() {
            cortex_m::asm::nop();
        }

        EIC { eic }
    }
}