stm32: use critical_section instead of cortex_m::interrupt

This commit is contained in:
Dario Nieuwenhuis 2022-01-14 21:05:48 +01:00
parent ecda57dff1
commit 52e156b429
3 changed files with 12 additions and 12 deletions

View file

@ -148,7 +148,7 @@ pub struct ExtiInputFuture<'a> {
impl<'a> ExtiInputFuture<'a> {
fn new(pin: u8, port: u8, rising: bool, falling: bool) -> Self {
cortex_m::interrupt::free(|_| unsafe {
critical_section::with(|_| unsafe {
let pin = pin as usize;
exticr_regs()
.exticr(pin / 4)
@ -177,7 +177,7 @@ impl<'a> ExtiInputFuture<'a> {
impl<'a> Drop for ExtiInputFuture<'a> {
fn drop(&mut self) {
cortex_m::interrupt::free(|_| unsafe {
critical_section::with(|_| unsafe {
let pin = self.pin as _;
cpu_regs().imr(0).modify(|w| w.set_line(pin, false));
});

View file

@ -80,7 +80,7 @@ impl<'d, T: Pin> Input<'d, T> {
pub fn new(pin: impl Unborrow<Target = T> + 'd, pull: Pull) -> Self {
unborrow!(pin);
cortex_m::interrupt::free(|_| unsafe {
critical_section::with(|_| unsafe {
let r = pin.block();
let n = pin.pin() as usize;
#[cfg(gpio_v1)]
@ -117,7 +117,7 @@ impl<'d, T: Pin> Input<'d, T> {
impl<'d, T: Pin> Drop for Input<'d, T> {
fn drop(&mut self) {
cortex_m::interrupt::free(|_| unsafe {
critical_section::with(|_| unsafe {
let r = self.pin.block();
let n = self.pin.pin() as usize;
#[cfg(gpio_v1)]
@ -168,7 +168,7 @@ impl<'d, T: Pin> Output<'d, T> {
Level::Low => pin.set_low(),
}
cortex_m::interrupt::free(|_| unsafe {
critical_section::with(|_| unsafe {
let r = pin.block();
let n = pin.pin() as usize;
#[cfg(gpio_v1)]
@ -195,7 +195,7 @@ impl<'d, T: Pin> Output<'d, T> {
impl<'d, T: Pin> Drop for Output<'d, T> {
fn drop(&mut self) {
cortex_m::interrupt::free(|_| unsafe {
critical_section::with(|_| unsafe {
let r = self.pin.block();
let n = self.pin.pin() as usize;
#[cfg(gpio_v1)]
@ -265,7 +265,7 @@ impl<'d, T: Pin> OutputOpenDrain<'d, T> {
Level::Low => pin.set_low(),
}
cortex_m::interrupt::free(|_| unsafe {
critical_section::with(|_| unsafe {
let r = pin.block();
let n = pin.pin() as usize;
#[cfg(gpio_v1)]
@ -298,7 +298,7 @@ impl<'d, T: Pin> OutputOpenDrain<'d, T> {
impl<'d, T: Pin> Drop for OutputOpenDrain<'d, T> {
fn drop(&mut self) {
cortex_m::interrupt::free(|_| unsafe {
critical_section::with(|_| unsafe {
let r = self.pin.block();
let n = self.pin.pin() as usize;
#[cfg(gpio_v1)]

View file

@ -1254,7 +1254,7 @@ where
fn configure(&mut self) {
let (clk_pin, cmd_pin, d0_pin, d1_pin, d2_pin, d3_pin) = self;
cortex_m::interrupt::free(|_| unsafe {
critical_section::with(|_| unsafe {
// clk
let block = clk_pin.block();
let n = clk_pin.pin() as usize;
@ -1298,7 +1298,7 @@ where
let (clk_pin, cmd_pin, d0_pin, d1_pin, d2_pin, d3_pin) = self;
cortex_m::interrupt::free(|_| unsafe {
critical_section::with(|_| unsafe {
// clk
let n = clk_pin.pin().into();
clk_pin
@ -1400,7 +1400,7 @@ where
fn configure(&mut self) {
let (clk_pin, cmd_pin, d0_pin) = self;
cortex_m::interrupt::free(|_| unsafe {
critical_section::with(|_| unsafe {
// clk
let block = clk_pin.block();
let n = clk_pin.pin() as usize;
@ -1426,7 +1426,7 @@ where
let (clk_pin, cmd_pin, d0_pin) = self;
cortex_m::interrupt::free(|_| unsafe {
critical_section::with(|_| unsafe {
// clk
let n = clk_pin.pin().into();
clk_pin