Use cortex-m InterruptNumber iso bare_metal Nr

This commit is contained in:
Jorgeig 2021-08-10 17:51:10 +08:00
parent 356f53ddc3
commit 9bcb32329f
6 changed files with 16 additions and 16 deletions

View file

@ -13,7 +13,7 @@ license = "MIT OR Apache-2.0"
name = "cortex-m-rtic"
readme = "README.md"
repository = "https://github.com/rtic-rs/cortex-m-rtic"
version = "0.5.7"
version = "0.5.8"
[lib]
name = "rtic"
@ -51,7 +51,7 @@ name = "types"
required-features = ["__v7"]
[dependencies]
cortex-m = "0.6.2"
cortex-m = "0.7.3"
cortex-m-rtic-macros = { path = "macros", version = "0.5.3" }
rtic-core = "0.3.0"
cortex-m-rt = "0.6.9"

View file

@ -7,7 +7,7 @@ publish = false
version = "0.0.0-alpha.0"
[dependencies]
bare-metal = "0.2.4"
cortex-m = "0.7.3"
[dependencies.cortex-m-rtic]
path = ".."

View file

@ -7,7 +7,7 @@ use core::{
ops::{Add, Sub},
};
use bare_metal::Nr;
use cortex_m::interrupt::InterruptNumber;
use rtic::{Fraction, Monotonic, MultiCore};
// both cores have the exact same interrupts
@ -16,7 +16,7 @@ pub use Interrupt_0 as Interrupt_1;
// Fake priority bits
pub const NVIC_PRIO_BITS: u8 = 3;
pub fn xpend(_core: u8, _interrupt: impl Nr) {}
pub fn xpend(_core: u8, _interrupt: impl InterruptNumber) {}
/// Fake monotonic timer
pub struct MT;
@ -92,8 +92,8 @@ pub enum Interrupt_0 {
I7 = 7,
}
unsafe impl Nr for Interrupt_0 {
fn nr(&self) -> u8 {
*self as u8
unsafe impl InterruptNumber for Interrupt_0 {
fn number(self) -> u16 {
self as u16
}
}

View file

@ -7,7 +7,7 @@ publish = false
version = "0.0.0-alpha.0"
[dependencies]
bare-metal = "0.2.4"
cortex-m = "0.7.3"
[dependencies.cortex-m-rtic]
path = ".."

View file

@ -7,7 +7,7 @@ use core::{
ops::{Add, Sub},
};
use bare_metal::Nr;
use cortex_m::interrupt::InterruptNumber;
use rtic::{Fraction, Monotonic, MultiCore};
// both cores have the exact same interrupts
@ -16,7 +16,7 @@ pub use Interrupt_0 as Interrupt_1;
// Fake priority bits
pub const NVIC_PRIO_BITS: u8 = 3;
pub fn xpend(_core: u8, _interrupt: impl Nr) {}
pub fn xpend(_core: u8, _interrupt: impl InterruptNumber) {}
/// Fake monotonic timer
pub struct MT;
@ -92,8 +92,8 @@ pub enum Interrupt_0 {
I7 = 7,
}
unsafe impl Nr for Interrupt_0 {
fn nr(&self) -> u8 {
*self as u8
unsafe impl InterruptNumber for Interrupt_0 {
fn number(self) -> u16 {
self as u16
}
}

View file

@ -45,7 +45,7 @@
use core::ops::Sub;
use cortex_m::{
interrupt::Nr,
interrupt::InterruptNumber,
peripheral::{CBP, CPUID, DCB, DWT, FPB, FPU, ITM, MPU, NVIC, SCB, TPIU},
};
#[cfg(all(not(feature = "heterogeneous"), not(feature = "homogeneous")))]
@ -170,7 +170,7 @@ pub trait MultiCore {}
/// [`NVIC::pend`](../cortex_m/peripheral/struct.NVIC.html#method.pend)
pub fn pend<I>(interrupt: I)
where
I: Nr,
I: InterruptNumber,
{
NVIC::pend(interrupt)
}