i2c-v2: Use new interrupts macro

This commit is contained in:
Thales Fragoso 2021-07-29 19:13:57 -03:00
parent c1bb83d29d
commit 64a3ebd183
2 changed files with 7 additions and 7 deletions

View File

@ -25,7 +25,7 @@ pub(crate) mod sealed {
use crate::rcc::RccPeripheral; use crate::rcc::RccPeripheral;
pub trait Instance: RccPeripheral { pub trait Instance: RccPeripheral {
fn regs() -> &'static crate::pac::i2c::I2c; fn regs() -> crate::pac::i2c::I2c;
fn state_number() -> usize; fn state_number() -> usize;
} }
@ -77,11 +77,11 @@ macro_rules! i2c_state {
}; };
} }
crate::pac::peripherals!( crate::pac::interrupts!(
(i2c, $inst:ident) => { ($inst:ident, i2c, $block:ident, EV, $irq:ident) => {
impl sealed::Instance for peripherals::$inst { impl sealed::Instance for peripherals::$inst {
fn regs() -> &'static crate::pac::i2c::I2c { fn regs() -> crate::pac::i2c::I2c {
&crate::pac::$inst crate::pac::$inst
} }
fn state_number() -> usize { fn state_number() -> usize {
@ -90,7 +90,7 @@ crate::pac::peripherals!(
} }
impl Instance for peripherals::$inst { impl Instance for peripherals::$inst {
type Interrupt = crate::interrupt::$inst; type Interrupt = crate::interrupt::$irq;
} }
}; };

View File

@ -5,7 +5,7 @@ use core::task::Poll;
use atomic_polyfill::{AtomicUsize, Ordering}; use atomic_polyfill::{AtomicUsize, Ordering};
use embassy::interrupt::InterruptExt; use embassy::interrupt::InterruptExt;
use embassy::util::{AtomicWaker, OnDrop, Unborrow}; use embassy::util::{AtomicWaker, OnDrop, Unborrow};
use embassy_extras::unborrow; use embassy_hal_common::unborrow;
use embedded_hal::blocking::i2c::Read; use embedded_hal::blocking::i2c::Read;
use embedded_hal::blocking::i2c::Write; use embedded_hal::blocking::i2c::Write;
use embedded_hal::blocking::i2c::WriteRead; use embedded_hal::blocking::i2c::WriteRead;