aboutsummaryrefslogtreecommitdiff
path: root/embassy-mspm0/src
diff options
context:
space:
mode:
authori509VCB <[email protected]>2025-10-02 17:02:20 -0500
committeri509VCB <[email protected]>2025-10-08 14:39:07 -0500
commitc6799c2921780254319d293d37f33161f5fd1832 (patch)
treeec566c03efa33467878cc5ddc73dc63069034b04 /embassy-mspm0/src
parent96b87658fc2c9cfd68358195c2dc03ebba2482a2 (diff)
mspm0: add mspm0h321x support
This also changes selection of GPIO interrupt type to be calculated by the buildscript. H321x is yet another exception with GPIOB being a physical interrupt rather than part of an interrupt group. H3215/6 are true 5V parts. I wonder if that is a first for an embassy hal
Diffstat (limited to 'embassy-mspm0/src')
-rw-r--r--embassy-mspm0/src/gpio.rs17
-rw-r--r--embassy-mspm0/src/i2c.rs4
2 files changed, 13 insertions, 8 deletions
diff --git a/embassy-mspm0/src/gpio.rs b/embassy-mspm0/src/gpio.rs
index 13da4f30b..d8eb42dc2 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", any(mspm0c110x, mspm0c1105_c1106, mspm0l110x)))] 13#[cfg(all(feature = "rt", any(gpioa_interrupt, gpiob_interrupt)))]
14use crate::pac::interrupt; 14use crate::pac::interrupt;
15use crate::pac::{self}; 15use crate::pac::{self};
16 16
@@ -1110,16 +1110,21 @@ fn irq_handler(gpio: gpio::Gpio, wakers: &[AtomicWaker; 32]) {
1110 } 1110 }
1111} 1111}
1112 1112
1113#[cfg(all(gpioa_interrupt, gpioa_group))]
1114compile_error!("gpioa_interrupt and gpioa_group are mutually exclusive cfgs");
1115#[cfg(all(gpiob_interrupt, gpiob_group))]
1116compile_error!("gpiob_interrupt and gpiob_group are mutually exclusive cfgs");
1117
1113// C110x and L110x have a dedicated interrupts just for GPIOA. 1118// C110x and L110x have a dedicated interrupts just for GPIOA.
1114// 1119//
1115// These chips do not have a GROUP1 interrupt. 1120// These chips do not have a GROUP1 interrupt.
1116#[cfg(all(feature = "rt", any(mspm0c110x, mspm0c1105_c1106, mspm0l110x)))] 1121#[cfg(all(feature = "rt", gpioa_interrupt))]
1117#[interrupt] 1122#[interrupt]
1118fn GPIOA() { 1123fn GPIOA() {
1119 irq_handler(pac::GPIOA, &PORTA_WAKERS); 1124 irq_handler(pac::GPIOA, &PORTA_WAKERS);
1120} 1125}
1121 1126
1122#[cfg(all(feature = "rt", mspm0c1105_c1106))] 1127#[cfg(all(feature = "rt", gpiob_interrupt))]
1123#[interrupt] 1128#[interrupt]
1124fn GPIOB() { 1129fn GPIOB() {
1125 irq_handler(pac::GPIOB, &PORTB_WAKERS); 1130 irq_handler(pac::GPIOB, &PORTB_WAKERS);
@@ -1129,21 +1134,21 @@ fn GPIOB() {
1129// 1134//
1130// Defining these as no_mangle is required so that the linker will pick these over the default handler. 1135// Defining these as no_mangle is required so that the linker will pick these over the default handler.
1131 1136
1132#[cfg(all(feature = "rt", not(any(mspm0c110x, mspm0c1105_c1106, mspm0l110x))))] 1137#[cfg(all(feature = "rt", gpioa_group))]
1133#[unsafe(no_mangle)] 1138#[unsafe(no_mangle)]
1134#[allow(non_snake_case)] 1139#[allow(non_snake_case)]
1135fn GPIOA() { 1140fn GPIOA() {
1136 irq_handler(pac::GPIOA, &PORTA_WAKERS); 1141 irq_handler(pac::GPIOA, &PORTA_WAKERS);
1137} 1142}
1138 1143
1139#[cfg(all(feature = "rt", gpio_pb, not(mspm0c1105_c1106)))] 1144#[cfg(all(feature = "rt", gpiob_group))]
1140#[unsafe(no_mangle)] 1145#[unsafe(no_mangle)]
1141#[allow(non_snake_case)] 1146#[allow(non_snake_case)]
1142fn GPIOB() { 1147fn GPIOB() {
1143 irq_handler(pac::GPIOB, &PORTB_WAKERS); 1148 irq_handler(pac::GPIOB, &PORTB_WAKERS);
1144} 1149}
1145 1150
1146#[cfg(all(feature = "rt", gpio_pc))] 1151#[cfg(all(feature = "rt", gpioc_group))]
1147#[allow(non_snake_case)] 1152#[allow(non_snake_case)]
1148#[unsafe(no_mangle)] 1153#[unsafe(no_mangle)]
1149fn GPIOC() { 1154fn GPIOC() {
diff --git a/embassy-mspm0/src/i2c.rs b/embassy-mspm0/src/i2c.rs
index a12b4b4a2..192527dd2 100644
--- a/embassy-mspm0/src/i2c.rs
+++ b/embassy-mspm0/src/i2c.rs
@@ -206,8 +206,8 @@ impl Config {
206 } 206 }
207 207
208 #[cfg(any( 208 #[cfg(any(
209 mspm0g110x, mspm0g150x, mspm0g151x, mspm0g310x, mspm0g350x, mspm0g351x, mspm0l110x, mspm0l122x, mspm0l130x, 209 mspm0g110x, mspm0g150x, mspm0g151x, mspm0g310x, mspm0g350x, mspm0g351x, mspm0h321x, mspm0l110x, mspm0l122x,
210 mspm0l134x, mspm0l222x 210 mspm0l130x, mspm0l134x, mspm0l222x
211 ))] 211 ))]
212 fn calculate_clock_source(&self) -> u32 { 212 fn calculate_clock_source(&self) -> u32 {
213 // Assume that BusClk has default value. 213 // Assume that BusClk has default value.