aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-mspm0/build.rs9
-rw-r--r--embassy-mspm0/src/gpio.rs22
-rw-r--r--embassy-mspm0/src/lib.rs9
-rw-r--r--embassy-mspm0/src/time_driver.rs30
4 files changed, 18 insertions, 52 deletions
diff --git a/embassy-mspm0/build.rs b/embassy-mspm0/build.rs
index ffbe15c56..8c6dd4a5c 100644
--- a/embassy-mspm0/build.rs
+++ b/embassy-mspm0/build.rs
@@ -107,11 +107,7 @@ fn generate_code() {
107 } 107 }
108 108
109 // Generate timers 109 // Generate timers
110 for peripheral in METADATA 110 for peripheral in METADATA.peripherals.iter().filter(|p| p.name.starts_with("TIM")) {
111 .peripherals
112 .iter()
113 .filter(|p| p.name.starts_with("TIM"))
114 {
115 let name = Ident::new(&peripheral.name, Span::call_site()); 111 let name = Ident::new(&peripheral.name, Span::call_site());
116 let timers = &*TIMERS; 112 let timers = &*TIMERS;
117 113
@@ -225,8 +221,7 @@ fn time_driver(singletons: &[String], cfgs: &mut CfgSet) {
225 // TODO: 32-bit timers are not considered yet 221 // TODO: 32-bit timers are not considered yet
226 [ 222 [
227 // 16-bit, 2 channel 223 // 16-bit, 2 channel
228 "TIMG0", "TIMG1", "TIMG2", "TIMG3", 224 "TIMG0", "TIMG1", "TIMG2", "TIMG3", // 16-bit, 2 channel with shadow registers
229 // 16-bit, 2 channel with shadow registers
230 "TIMG4", "TIMG5", "TIMG6", "TIMG7", // 16-bit, 4 channel 225 "TIMG4", "TIMG5", "TIMG6", "TIMG7", // 16-bit, 4 channel
231 "TIMG14", // 16-bit with QEI 226 "TIMG14", // 16-bit with QEI
232 "TIMG8", "TIMG9", "TIMG10", "TIMG11", // Advanced timers 227 "TIMG8", "TIMG9", "TIMG10", "TIMG11", // Advanced timers
diff --git a/embassy-mspm0/src/gpio.rs b/embassy-mspm0/src/gpio.rs
index fd4dc55ab..e1eb7eecf 100644
--- a/embassy-mspm0/src/gpio.rs
+++ b/embassy-mspm0/src/gpio.rs
@@ -7,13 +7,12 @@ use core::task::{Context, Poll};
7 7
8use embassy_hal_internal::{impl_peripheral, into_ref, Peripheral, PeripheralRef}; 8use embassy_hal_internal::{impl_peripheral, into_ref, Peripheral, PeripheralRef};
9use embassy_sync::waitqueue::AtomicWaker; 9use embassy_sync::waitqueue::AtomicWaker;
10
11use crate::pac::gpio::vals::*;
12use crate::pac::gpio::{self};
10#[cfg(all(feature = "rt", feature = "mspm0c110x"))] 13#[cfg(all(feature = "rt", feature = "mspm0c110x"))]
11use crate::pac::interrupt; 14use crate::pac::interrupt;
12 15use crate::pac::{self};
13use crate::pac::{
14 self,
15 gpio::{self, vals::*},
16};
17 16
18/// Represents a digital input or output level. 17/// Represents a digital input or output level.
19#[derive(Debug, Eq, PartialEq, Clone, Copy)] 18#[derive(Debug, Eq, PartialEq, Clone, Copy)]
@@ -88,9 +87,7 @@ impl<'d> Flex<'d> {
88 into_ref!(pin); 87 into_ref!(pin);
89 88
90 // Pin will be in disconnected state. 89 // Pin will be in disconnected state.
91 Self { 90 Self { pin: pin.map_into() }
92 pin: pin.map_into(),
93 }
94 } 91 }
95 92
96 /// Set the pin's pull. 93 /// Set the pin's pull.
@@ -974,14 +971,7 @@ impl<'d> Future for InputFuture<'d> {
974 waker.register(cx.waker()); 971 waker.register(cx.waker());
975 972
976 // The interrupt handler will mask the interrupt if the event has occurred. 973 // The interrupt handler will mask the interrupt if the event has occurred.
977 if self 974 if self.pin.block().cpu_int().ris().read().dio(self.pin.bit_index()) {
978 .pin
979 .block()
980 .cpu_int()
981 .ris()
982 .read()
983 .dio(self.pin.bit_index())
984 {
985 return Poll::Ready(()); 975 return Poll::Ready(());
986 } 976 }
987 977
diff --git a/embassy-mspm0/src/lib.rs b/embassy-mspm0/src/lib.rs
index ee629f063..1191b1010 100644
--- a/embassy-mspm0/src/lib.rs
+++ b/embassy-mspm0/src/lib.rs
@@ -1,10 +1,6 @@
1#![no_std] 1#![no_std]
2// Doc feature labels can be tested locally by running RUSTDOCFLAGS="--cfg=docsrs" cargo +nightly doc 2// Doc feature labels can be tested locally by running RUSTDOCFLAGS="--cfg=docsrs" cargo +nightly doc
3#![cfg_attr( 3#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg_hide), doc(cfg_hide(doc, docsrs)))]
4 docsrs,
5 feature(doc_auto_cfg, doc_cfg_hide),
6 doc(cfg_hide(doc, docsrs))
7)]
8 4
9// This mod MUST go first, so that the others see its macros. 5// This mod MUST go first, so that the others see its macros.
10pub(crate) mod fmt; 6pub(crate) mod fmt;
@@ -40,6 +36,7 @@ pub(crate) mod _generated {
40} 36}
41 37
42// Reexports 38// Reexports
39pub(crate) use _generated::gpio_pincm;
43pub use _generated::{peripherals, Peripherals}; 40pub use _generated::{peripherals, Peripherals};
44pub use embassy_hal_internal::{into_ref, Peripheral, PeripheralRef}; 41pub use embassy_hal_internal::{into_ref, Peripheral, PeripheralRef};
45#[cfg(feature = "unstable-pac")] 42#[cfg(feature = "unstable-pac")]
@@ -48,8 +45,6 @@ pub use mspm0_metapac as pac;
48pub(crate) use mspm0_metapac as pac; 45pub(crate) use mspm0_metapac as pac;
49 46
50pub use crate::_generated::interrupt; 47pub use crate::_generated::interrupt;
51pub(crate) use _generated::gpio_pincm;
52
53 48
54/// `embassy-mspm0` global configuration. 49/// `embassy-mspm0` global configuration.
55#[non_exhaustive] 50#[non_exhaustive]
diff --git a/embassy-mspm0/src/time_driver.rs b/embassy-mspm0/src/time_driver.rs
index 3af7a5edb..937ce58d4 100644
--- a/embassy-mspm0/src/time_driver.rs
+++ b/embassy-mspm0/src/time_driver.rs
@@ -1,19 +1,13 @@
1use core::{ 1use core::cell::{Cell, RefCell};
2 cell::{Cell, RefCell}, 2use core::sync::atomic::{compiler_fence, AtomicU32, Ordering};
3 sync::atomic::{compiler_fence, AtomicU32, Ordering}, 3use core::task::Waker;
4 task::Waker,
5};
6 4
7use critical_section::{CriticalSection, Mutex}; 5use critical_section::{CriticalSection, Mutex};
8use embassy_time_driver::Driver; 6use embassy_time_driver::Driver;
9use embassy_time_queue_utils::Queue; 7use embassy_time_queue_utils::Queue;
10use mspm0_metapac::{ 8use mspm0_metapac::interrupt;
11 interrupt, 9use mspm0_metapac::tim::vals::{Cm, Cvae, CxC, EvtCfg, PwrenKey, Ratio, Repeat, ResetKey};
12 tim::{ 10use mspm0_metapac::tim::{Counterregs16, Tim};
13 vals::{Cm, Cvae, CxC, EvtCfg, PwrenKey, Ratio, Repeat, ResetKey},
14 Counterregs16, Tim,
15 },
16};
17 11
18use crate::peripherals; 12use crate::peripherals;
19use crate::timer::SealedTimer; 13use crate::timer::SealedTimer;
@@ -244,18 +238,10 @@ impl TimxDriver {
244 } 238 }
245 239
246 fn trigger_alarm(&self, cs: CriticalSection) { 240 fn trigger_alarm(&self, cs: CriticalSection) {
247 let mut next = self 241 let mut next = self.queue.borrow(cs).borrow_mut().next_expiration(self.now());
248 .queue
249 .borrow(cs)
250 .borrow_mut()
251 .next_expiration(self.now());
252 242
253 while !self.set_alarm(cs, next) { 243 while !self.set_alarm(cs, next) {
254 next = self 244 next = self.queue.borrow(cs).borrow_mut().next_expiration(self.now());
255 .queue
256 .borrow(cs)
257 .borrow_mut()
258 .next_expiration(self.now());
259 } 245 }
260 } 246 }
261 247