rustfmt...
This commit is contained in:
parent
e0cdc356cc
commit
9531b7422b
@ -107,11 +107,7 @@ fn generate_code() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate timers
|
// Generate timers
|
||||||
for peripheral in METADATA
|
for peripheral in METADATA.peripherals.iter().filter(|p| p.name.starts_with("TIM")) {
|
||||||
.peripherals
|
|
||||||
.iter()
|
|
||||||
.filter(|p| p.name.starts_with("TIM"))
|
|
||||||
{
|
|
||||||
let name = Ident::new(&peripheral.name, Span::call_site());
|
let name = Ident::new(&peripheral.name, Span::call_site());
|
||||||
let timers = &*TIMERS;
|
let timers = &*TIMERS;
|
||||||
|
|
||||||
@ -225,8 +221,7 @@ fn time_driver(singletons: &[String], cfgs: &mut CfgSet) {
|
|||||||
// TODO: 32-bit timers are not considered yet
|
// TODO: 32-bit timers are not considered yet
|
||||||
[
|
[
|
||||||
// 16-bit, 2 channel
|
// 16-bit, 2 channel
|
||||||
"TIMG0", "TIMG1", "TIMG2", "TIMG3",
|
"TIMG0", "TIMG1", "TIMG2", "TIMG3", // 16-bit, 2 channel with shadow registers
|
||||||
// 16-bit, 2 channel with shadow registers
|
|
||||||
"TIMG4", "TIMG5", "TIMG6", "TIMG7", // 16-bit, 4 channel
|
"TIMG4", "TIMG5", "TIMG6", "TIMG7", // 16-bit, 4 channel
|
||||||
"TIMG14", // 16-bit with QEI
|
"TIMG14", // 16-bit with QEI
|
||||||
"TIMG8", "TIMG9", "TIMG10", "TIMG11", // Advanced timers
|
"TIMG8", "TIMG9", "TIMG10", "TIMG11", // Advanced timers
|
||||||
|
|||||||
@ -7,13 +7,12 @@ use core::task::{Context, Poll};
|
|||||||
|
|
||||||
use embassy_hal_internal::{impl_peripheral, into_ref, Peripheral, PeripheralRef};
|
use embassy_hal_internal::{impl_peripheral, into_ref, Peripheral, PeripheralRef};
|
||||||
use embassy_sync::waitqueue::AtomicWaker;
|
use embassy_sync::waitqueue::AtomicWaker;
|
||||||
|
|
||||||
|
use crate::pac::gpio::vals::*;
|
||||||
|
use crate::pac::gpio::{self};
|
||||||
#[cfg(all(feature = "rt", feature = "mspm0c110x"))]
|
#[cfg(all(feature = "rt", feature = "mspm0c110x"))]
|
||||||
use crate::pac::interrupt;
|
use crate::pac::interrupt;
|
||||||
|
use crate::pac::{self};
|
||||||
use crate::pac::{
|
|
||||||
self,
|
|
||||||
gpio::{self, vals::*},
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Represents a digital input or output level.
|
/// Represents a digital input or output level.
|
||||||
#[derive(Debug, Eq, PartialEq, Clone, Copy)]
|
#[derive(Debug, Eq, PartialEq, Clone, Copy)]
|
||||||
@ -88,9 +87,7 @@ impl<'d> Flex<'d> {
|
|||||||
into_ref!(pin);
|
into_ref!(pin);
|
||||||
|
|
||||||
// Pin will be in disconnected state.
|
// Pin will be in disconnected state.
|
||||||
Self {
|
Self { pin: pin.map_into() }
|
||||||
pin: pin.map_into(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the pin's pull.
|
/// Set the pin's pull.
|
||||||
@ -974,14 +971,7 @@ impl<'d> Future for InputFuture<'d> {
|
|||||||
waker.register(cx.waker());
|
waker.register(cx.waker());
|
||||||
|
|
||||||
// The interrupt handler will mask the interrupt if the event has occurred.
|
// The interrupt handler will mask the interrupt if the event has occurred.
|
||||||
if self
|
if self.pin.block().cpu_int().ris().read().dio(self.pin.bit_index()) {
|
||||||
.pin
|
|
||||||
.block()
|
|
||||||
.cpu_int()
|
|
||||||
.ris()
|
|
||||||
.read()
|
|
||||||
.dio(self.pin.bit_index())
|
|
||||||
{
|
|
||||||
return Poll::Ready(());
|
return Poll::Ready(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,6 @@
|
|||||||
#![no_std]
|
#![no_std]
|
||||||
// Doc feature labels can be tested locally by running RUSTDOCFLAGS="--cfg=docsrs" cargo +nightly doc
|
// Doc feature labels can be tested locally by running RUSTDOCFLAGS="--cfg=docsrs" cargo +nightly doc
|
||||||
#![cfg_attr(
|
#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg_hide), doc(cfg_hide(doc, docsrs)))]
|
||||||
docsrs,
|
|
||||||
feature(doc_auto_cfg, doc_cfg_hide),
|
|
||||||
doc(cfg_hide(doc, docsrs))
|
|
||||||
)]
|
|
||||||
|
|
||||||
// This mod MUST go first, so that the others see its macros.
|
// This mod MUST go first, so that the others see its macros.
|
||||||
pub(crate) mod fmt;
|
pub(crate) mod fmt;
|
||||||
@ -40,6 +36,7 @@ pub(crate) mod _generated {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reexports
|
// Reexports
|
||||||
|
pub(crate) use _generated::gpio_pincm;
|
||||||
pub use _generated::{peripherals, Peripherals};
|
pub use _generated::{peripherals, Peripherals};
|
||||||
pub use embassy_hal_internal::{into_ref, Peripheral, PeripheralRef};
|
pub use embassy_hal_internal::{into_ref, Peripheral, PeripheralRef};
|
||||||
#[cfg(feature = "unstable-pac")]
|
#[cfg(feature = "unstable-pac")]
|
||||||
@ -48,8 +45,6 @@ pub use mspm0_metapac as pac;
|
|||||||
pub(crate) use mspm0_metapac as pac;
|
pub(crate) use mspm0_metapac as pac;
|
||||||
|
|
||||||
pub use crate::_generated::interrupt;
|
pub use crate::_generated::interrupt;
|
||||||
pub(crate) use _generated::gpio_pincm;
|
|
||||||
|
|
||||||
|
|
||||||
/// `embassy-mspm0` global configuration.
|
/// `embassy-mspm0` global configuration.
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
|
|||||||
@ -1,19 +1,13 @@
|
|||||||
use core::{
|
use core::cell::{Cell, RefCell};
|
||||||
cell::{Cell, RefCell},
|
use core::sync::atomic::{compiler_fence, AtomicU32, Ordering};
|
||||||
sync::atomic::{compiler_fence, AtomicU32, Ordering},
|
use core::task::Waker;
|
||||||
task::Waker,
|
|
||||||
};
|
|
||||||
|
|
||||||
use critical_section::{CriticalSection, Mutex};
|
use critical_section::{CriticalSection, Mutex};
|
||||||
use embassy_time_driver::Driver;
|
use embassy_time_driver::Driver;
|
||||||
use embassy_time_queue_utils::Queue;
|
use embassy_time_queue_utils::Queue;
|
||||||
use mspm0_metapac::{
|
use mspm0_metapac::interrupt;
|
||||||
interrupt,
|
use mspm0_metapac::tim::vals::{Cm, Cvae, CxC, EvtCfg, PwrenKey, Ratio, Repeat, ResetKey};
|
||||||
tim::{
|
use mspm0_metapac::tim::{Counterregs16, Tim};
|
||||||
vals::{Cm, Cvae, CxC, EvtCfg, PwrenKey, Ratio, Repeat, ResetKey},
|
|
||||||
Counterregs16, Tim,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::peripherals;
|
use crate::peripherals;
|
||||||
use crate::timer::SealedTimer;
|
use crate::timer::SealedTimer;
|
||||||
@ -244,18 +238,10 @@ impl TimxDriver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn trigger_alarm(&self, cs: CriticalSection) {
|
fn trigger_alarm(&self, cs: CriticalSection) {
|
||||||
let mut next = self
|
let mut next = self.queue.borrow(cs).borrow_mut().next_expiration(self.now());
|
||||||
.queue
|
|
||||||
.borrow(cs)
|
|
||||||
.borrow_mut()
|
|
||||||
.next_expiration(self.now());
|
|
||||||
|
|
||||||
while !self.set_alarm(cs, next) {
|
while !self.set_alarm(cs, next) {
|
||||||
next = self
|
next = self.queue.borrow(cs).borrow_mut().next_expiration(self.now());
|
||||||
.queue
|
|
||||||
.borrow(cs)
|
|
||||||
.borrow_mut()
|
|
||||||
.next_expiration(self.now());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user