use nrf52::chip::Nrf52DefaultPeripherals;
pub struct Nrf52832DefaultPeripherals<'a> {
pub nrf52: Nrf52DefaultPeripherals<'a>,
pub gpio_port: crate::gpio::Port<'a, { crate::gpio::NUM_PINS }>,
}
impl<'a> Nrf52832DefaultPeripherals<'a> {
pub unsafe fn new() -> Self {
Self {
nrf52: Nrf52DefaultPeripherals::new(),
gpio_port: crate::gpio::nrf52832_gpio_create(),
}
}
pub fn init(&'static self) {
self.nrf52.init();
}
}
impl<'a> kernel::platform::chip::InterruptService for Nrf52832DefaultPeripherals<'a> {
unsafe fn service_interrupt(&self, interrupt: u32) -> bool {
match interrupt {
nrf52::peripheral_interrupts::GPIOTE => self.gpio_port.handle_interrupt(),
_ => return self.nrf52.service_interrupt(interrupt),
}
true
}
}