Make interrupt module more standard.
- Move typelevel interrupts to a special-purpose mod: `embassy_xx::interrupt::typelevel`. - Reexport the PAC interrupt enum in `embassy_xx::interrupt`. This has a few advantages: - The `embassy_xx::interrupt` module is now more "standard". - It works with `cortex-m` functions for manipulating interrupts, for example. - It works with RTIC. - the interrupt enum allows holding value that can be "any interrupt at runtime", this can't be done with typelevel irqs. - When "const-generics on enums" is stable, we can remove the typelevel interrupts without disruptive changes to `embassy_xx::interrupt`.
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
use stm32_metapac::timer::vals;
|
||||
|
||||
use crate::interrupt::Interrupt;
|
||||
use crate::interrupt;
|
||||
use crate::rcc::sealed::RccPeripheral as __RccPeri;
|
||||
use crate::rcc::RccPeripheral;
|
||||
use crate::time::Hertz;
|
||||
@ -13,7 +13,7 @@ pub mod low_level {
|
||||
pub(crate) mod sealed {
|
||||
use super::*;
|
||||
pub trait Basic16bitInstance: RccPeripheral {
|
||||
type Interrupt: Interrupt;
|
||||
type Interrupt: interrupt::typelevel::Interrupt;
|
||||
|
||||
fn regs() -> crate::pac::timer::TimBasic;
|
||||
|
||||
@ -57,7 +57,7 @@ pub trait Basic16bitInstance: sealed::Basic16bitInstance + 'static {}
|
||||
macro_rules! impl_basic_16bit_timer {
|
||||
($inst:ident, $irq:ident) => {
|
||||
impl sealed::Basic16bitInstance for crate::peripherals::$inst {
|
||||
type Interrupt = crate::interrupt::$irq;
|
||||
type Interrupt = crate::interrupt::typelevel::$irq;
|
||||
|
||||
fn regs() -> crate::pac::timer::TimBasic {
|
||||
crate::pac::timer::TimBasic(crate::pac::$inst.0)
|
||||
|
Reference in New Issue
Block a user