diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-03-24 00:27:16 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-03-24 00:27:16 +0000 |
| commit | f15a11f4d69ea905e9feb944969f6b1d1f134e63 (patch) | |
| tree | 269a1b4235aaee507e4db02c19d9dfba0646c5e7 /embassy-mspm0/src | |
| parent | c9a07977971933b1d833093fea8c30ca1c6cccdf (diff) | |
| parent | 73c0bad8ad398c072215c8ff4382dffbe1a6a057 (diff) | |
Merge pull request #3994 from i509VCB/mspm0-generate-singletons
mspm0: generate all singletons
Diffstat (limited to 'embassy-mspm0/src')
| -rw-r--r-- | embassy-mspm0/src/lib.rs | 19 | ||||
| -rw-r--r-- | embassy-mspm0/src/time_driver.rs | 3 |
2 files changed, 22 insertions, 0 deletions
diff --git a/embassy-mspm0/src/lib.rs b/embassy-mspm0/src/lib.rs index 3128bb3c7..1df85a520 100644 --- a/embassy-mspm0/src/lib.rs +++ b/embassy-mspm0/src/lib.rs | |||
| @@ -8,6 +8,25 @@ pub(crate) mod fmt; | |||
| 8 | pub mod gpio; | 8 | pub mod gpio; |
| 9 | pub mod timer; | 9 | pub mod timer; |
| 10 | 10 | ||
| 11 | /// Operating modes for peripherals. | ||
| 12 | pub mod mode { | ||
| 13 | trait SealedMode {} | ||
| 14 | |||
| 15 | /// Operating mode for a peripheral. | ||
| 16 | #[allow(private_bounds)] | ||
| 17 | pub trait Mode: SealedMode {} | ||
| 18 | |||
| 19 | /// Blocking mode. | ||
| 20 | pub struct Blocking; | ||
| 21 | impl SealedMode for Blocking {} | ||
| 22 | impl Mode for Blocking {} | ||
| 23 | |||
| 24 | /// Async mode. | ||
| 25 | pub struct Async; | ||
| 26 | impl SealedMode for Async {} | ||
| 27 | impl Mode for Async {} | ||
| 28 | } | ||
| 29 | |||
| 11 | #[cfg(feature = "_time-driver")] | 30 | #[cfg(feature = "_time-driver")] |
| 12 | mod time_driver; | 31 | mod time_driver; |
| 13 | 32 | ||
diff --git a/embassy-mspm0/src/time_driver.rs b/embassy-mspm0/src/time_driver.rs index 937ce58d4..e80e89e55 100644 --- a/embassy-mspm0/src/time_driver.rs +++ b/embassy-mspm0/src/time_driver.rs | |||
| @@ -12,6 +12,9 @@ use mspm0_metapac::tim::{Counterregs16, Tim}; | |||
| 12 | use crate::peripherals; | 12 | use crate::peripherals; |
| 13 | use crate::timer::SealedTimer; | 13 | use crate::timer::SealedTimer; |
| 14 | 14 | ||
| 15 | #[cfg(any(time_driver_timg12, time_driver_timg13))] | ||
| 16 | compile_error!("TIMG12 and TIMG13 are not supported by the time driver yet"); | ||
| 17 | |||
| 15 | // Currently TIMG12 and TIMG13 are excluded because those are 32-bit timers. | 18 | // Currently TIMG12 and TIMG13 are excluded because those are 32-bit timers. |
| 16 | #[cfg(time_driver_timg0)] | 19 | #[cfg(time_driver_timg0)] |
| 17 | type T = peripherals::TIMG0; | 20 | type T = peripherals::TIMG0; |
