aboutsummaryrefslogtreecommitdiff
path: root/embassy-mspm0/src
diff options
context:
space:
mode:
authori509VCB <[email protected]>2025-05-13 21:55:50 -0500
committeri509VCB <[email protected]>2025-05-13 21:55:50 -0500
commitf41e8c45f68ca31819ea1b1eae5fbd019bf8f318 (patch)
treee283bb7f4d3a8366838b7201547c79e4b37add40 /embassy-mspm0/src
parent5caa4ac51bacb8444ca6b3caafb7d0ba66e39310 (diff)
mspm0: generate feature per chip + package
Diffstat (limited to 'embassy-mspm0/src')
-rw-r--r--embassy-mspm0/src/gpio.rs4
-rw-r--r--embassy-mspm0/src/int_group/g150x.rs51
-rw-r--r--embassy-mspm0/src/lib.rs17
3 files changed, 64 insertions, 8 deletions
diff --git a/embassy-mspm0/src/gpio.rs b/embassy-mspm0/src/gpio.rs
index 3f895d962..3c824b0e6 100644
--- a/embassy-mspm0/src/gpio.rs
+++ b/embassy-mspm0/src/gpio.rs
@@ -10,7 +10,7 @@ use embassy_sync::waitqueue::AtomicWaker;
10 10
11use crate::pac::gpio::vals::*; 11use crate::pac::gpio::vals::*;
12use crate::pac::gpio::{self}; 12use crate::pac::gpio::{self};
13#[cfg(all(feature = "rt", feature = "mspm0c110x"))] 13#[cfg(all(feature = "rt", mspm0c110x))]
14use crate::pac::interrupt; 14use crate::pac::interrupt;
15use crate::pac::{self}; 15use crate::pac::{self};
16 16
@@ -1120,7 +1120,7 @@ impl Iterator for BitIter {
1120} 1120}
1121 1121
1122// C110x has a dedicated interrupt just for GPIOA, as it does not have a GROUP1 interrupt. 1122// C110x has a dedicated interrupt just for GPIOA, as it does not have a GROUP1 interrupt.
1123#[cfg(all(feature = "rt", feature = "mspm0c110x"))] 1123#[cfg(all(feature = "rt", mspm0c110x))]
1124#[interrupt] 1124#[interrupt]
1125fn GPIOA() { 1125fn GPIOA() {
1126 gpioa_interrupt(); 1126 gpioa_interrupt();
diff --git a/embassy-mspm0/src/int_group/g150x.rs b/embassy-mspm0/src/int_group/g150x.rs
new file mode 100644
index 000000000..706ba2078
--- /dev/null
+++ b/embassy-mspm0/src/int_group/g150x.rs
@@ -0,0 +1,51 @@
1use crate::pac;
2use crate::pac::interrupt;
3
4#[cfg(feature = "rt")]
5#[interrupt]
6fn GROUP0() {
7 use mspm0_metapac::Group0;
8
9 let group = pac::CPUSS.int_group(0);
10
11 // Must subtract by 1 since NO_INTR is value 0
12 let iidx = group.iidx().read().stat().to_bits() - 1;
13
14 let Ok(group) = pac::Group0::try_from(iidx as u8) else {
15 debug!("Invalid IIDX for group 0: {}", iidx);
16 return;
17 };
18
19 match group {
20 Group0::WWDT0 => todo!("implement WWDT0"),
21 Group0::WWDT1 => todo!("implement WWDT1"),
22 Group0::DEBUGSS => todo!("implement DEBUGSS"),
23 Group0::FLASHCTL => todo!("implement FLASHCTL"),
24 Group0::SYSCTL => todo!("implement SYSCTL"),
25 }
26}
27
28#[cfg(feature = "rt")]
29#[interrupt]
30fn GROUP1() {
31 use mspm0_metapac::Group1;
32
33 let group = pac::CPUSS.int_group(1);
34
35 // Must subtract by 1 since NO_INTR is value 0
36 let iidx = group.iidx().read().stat().to_bits() - 1;
37
38 let Ok(group) = pac::Group1::try_from(iidx as u8) else {
39 debug!("Invalid IIDX for group 1: {}", iidx);
40 return;
41 };
42
43 match group {
44 Group1::GPIOA => crate::gpio::gpioa_interrupt(),
45 Group1::GPIOB => crate::gpio::gpiob_interrupt(),
46 Group1::COMP0 => todo!("implement COMP0"),
47 Group1::COMP1 => todo!("implement COMP1"),
48 Group1::COMP2 => todo!("implement COMP2"),
49 Group1::TRNG => todo!("implement TRNG"),
50 }
51}
diff --git a/embassy-mspm0/src/lib.rs b/embassy-mspm0/src/lib.rs
index e8f5971d5..df2d83cc0 100644
--- a/embassy-mspm0/src/lib.rs
+++ b/embassy-mspm0/src/lib.rs
@@ -1,6 +1,11 @@
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(docsrs, feature(doc_auto_cfg, doc_cfg_hide), doc(cfg_hide(doc, docsrs)))] 3#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg_hide), doc(cfg_hide(doc, docsrs)))]
4#![cfg_attr(
5 docsrs,
6 doc = "<div style='padding:30px;background:#810;color:#fff;text-align:center;'><p>You might want to <a href='https://docs.embassy.dev/embassy-mspm0'>browse the `embassy-mspm0` documentation on the Embassy website</a> instead.</p><p>The documentation here on `docs.rs` is built for a single chip only, while on the Embassy website you can pick your exact chip from the top menu. Available peripherals and their APIs change depending on the chip.</p></div>\n\n"
7)]
8#![doc = include_str!("../README.md")]
4 9
5// This mod MUST go first, so that the others see its macros. 10// This mod MUST go first, so that the others see its macros.
6pub(crate) mod fmt; 11pub(crate) mod fmt;
@@ -35,11 +40,11 @@ pub mod mode {
35mod time_driver; 40mod time_driver;
36 41
37// Interrupt group handlers. 42// Interrupt group handlers.
38#[cfg_attr(feature = "mspm0c110x", path = "int_group/c110x.rs")] 43#[cfg_attr(mspm0c110x, path = "int_group/c110x.rs")]
39#[cfg_attr(feature = "mspm0g350x", path = "int_group/g350x.rs")] 44#[cfg_attr(mspm0g350x, path = "int_group/g350x.rs")]
40#[cfg_attr(feature = "mspm0g351x", path = "int_group/g351x.rs")] 45#[cfg_attr(mspm0g351x, path = "int_group/g351x.rs")]
41#[cfg_attr(feature = "mspm0l130x", path = "int_group/l130x.rs")] 46#[cfg_attr(mspm0l130x, path = "int_group/l130x.rs")]
42#[cfg_attr(feature = "mspm0l222x", path = "int_group/l222x.rs")] 47#[cfg_attr(mspm0l222x, path = "int_group/l222x.rs")]
43mod int_group; 48mod int_group;
44 49
45pub(crate) mod _generated { 50pub(crate) mod _generated {
@@ -109,7 +114,7 @@ pub fn init(_config: Config) -> Peripherals {
109 114
110 _generated::enable_group_interrupts(cs); 115 _generated::enable_group_interrupts(cs);
111 116
112 #[cfg(feature = "mspm0c110x")] 117 #[cfg(mspm0c110x)]
113 unsafe { 118 unsafe {
114 use crate::_generated::interrupt::typelevel::Interrupt; 119 use crate::_generated::interrupt::typelevel::Interrupt;
115 crate::interrupt::typelevel::GPIOA::enable(); 120 crate::interrupt::typelevel::GPIOA::enable();