diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-10-06 21:26:55 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-10-06 21:26:55 +0000 |
| commit | 07016a4ffbe0b0ea689b83a6ddf19ab1b6a9a79a (patch) | |
| tree | de82055258c8e3962911e85426dc91f716f04a65 /embassy-mspm0 | |
| parent | e2a2bd3c573928208a4c85e7fcd6ad630f23f47d (diff) | |
| parent | dbf0416abd48190056a25828d8e5d8f889170f88 (diff) | |
Merge pull request #4744 from embassy-rs/edition2024
Edition 2024.
Diffstat (limited to 'embassy-mspm0')
| -rw-r--r-- | embassy-mspm0/Cargo.toml | 2 | ||||
| -rw-r--r-- | embassy-mspm0/build.rs | 2 | ||||
| -rw-r--r-- | embassy-mspm0/src/adc.rs | 6 | ||||
| -rw-r--r-- | embassy-mspm0/src/dma.rs | 8 | ||||
| -rw-r--r-- | embassy-mspm0/src/gpio.rs | 8 | ||||
| -rw-r--r-- | embassy-mspm0/src/i2c.rs | 4 | ||||
| -rw-r--r-- | embassy-mspm0/src/lib.rs | 5 | ||||
| -rw-r--r-- | embassy-mspm0/src/time_driver.rs | 2 | ||||
| -rw-r--r-- | embassy-mspm0/src/uart/buffered.rs | 4 | ||||
| -rw-r--r-- | embassy-mspm0/src/uart/mod.rs | 13 | ||||
| -rw-r--r-- | embassy-mspm0/src/wwdt.rs | 4 |
11 files changed, 28 insertions, 30 deletions
diff --git a/embassy-mspm0/Cargo.toml b/embassy-mspm0/Cargo.toml index 1b32c4d43..65019eb7c 100644 --- a/embassy-mspm0/Cargo.toml +++ b/embassy-mspm0/Cargo.toml | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | [package] | 1 | [package] |
| 2 | name = "embassy-mspm0" | 2 | name = "embassy-mspm0" |
| 3 | version = "0.1.0" | 3 | version = "0.1.0" |
| 4 | edition = "2021" | 4 | edition = "2024" |
| 5 | license = "MIT OR Apache-2.0" | 5 | license = "MIT OR Apache-2.0" |
| 6 | description = "Embassy Hardware Abstraction Layer (HAL) for Texas Instruments MSPM0 series microcontrollers" | 6 | description = "Embassy Hardware Abstraction Layer (HAL) for Texas Instruments MSPM0 series microcontrollers" |
| 7 | keywords = ["embedded", "async", "mspm0", "hal", "embedded-hal"] | 7 | keywords = ["embedded", "async", "mspm0", "hal", "embedded-hal"] |
diff --git a/embassy-mspm0/build.rs b/embassy-mspm0/build.rs index d294bc422..93ea81ac3 100644 --- a/embassy-mspm0/build.rs +++ b/embassy-mspm0/build.rs | |||
| @@ -208,7 +208,7 @@ fn generate_groups() -> TokenStream { | |||
| 208 | 208 | ||
| 209 | #[cfg(feature = "rt")] | 209 | #[cfg(feature = "rt")] |
| 210 | mod group_vectors { | 210 | mod group_vectors { |
| 211 | extern "Rust" { | 211 | unsafe extern "Rust" { |
| 212 | #(#group_vectors)* | 212 | #(#group_vectors)* |
| 213 | } | 213 | } |
| 214 | } | 214 | } |
diff --git a/embassy-mspm0/src/adc.rs b/embassy-mspm0/src/adc.rs index 5b93e9a6e..948801679 100644 --- a/embassy-mspm0/src/adc.rs +++ b/embassy-mspm0/src/adc.rs | |||
| @@ -4,13 +4,13 @@ use core::future::poll_fn; | |||
| 4 | use core::marker::PhantomData; | 4 | use core::marker::PhantomData; |
| 5 | use core::task::Poll; | 5 | use core::task::Poll; |
| 6 | 6 | ||
| 7 | use embassy_hal_internal::{impl_peripheral, PeripheralType}; | 7 | use embassy_hal_internal::{PeripheralType, impl_peripheral}; |
| 8 | use embassy_sync::waitqueue::AtomicWaker; | 8 | use embassy_sync::waitqueue::AtomicWaker; |
| 9 | 9 | ||
| 10 | use crate::interrupt::{Interrupt, InterruptExt}; | 10 | use crate::interrupt::{Interrupt, InterruptExt}; |
| 11 | use crate::mode::{Async, Blocking, Mode}; | 11 | use crate::mode::{Async, Blocking, Mode}; |
| 12 | use crate::pac::adc::{vals, Adc as Regs}; | 12 | use crate::pac::adc::{Adc as Regs, vals}; |
| 13 | use crate::{interrupt, Peri}; | 13 | use crate::{Peri, interrupt}; |
| 14 | 14 | ||
| 15 | /// Interrupt handler. | 15 | /// Interrupt handler. |
| 16 | pub struct InterruptHandler<T: Instance> { | 16 | pub struct InterruptHandler<T: Instance> { |
diff --git a/embassy-mspm0/src/dma.rs b/embassy-mspm0/src/dma.rs index 66b79709c..58b087761 100644 --- a/embassy-mspm0/src/dma.rs +++ b/embassy-mspm0/src/dma.rs | |||
| @@ -5,18 +5,18 @@ | |||
| 5 | use core::future::Future; | 5 | use core::future::Future; |
| 6 | use core::mem; | 6 | use core::mem; |
| 7 | use core::pin::Pin; | 7 | use core::pin::Pin; |
| 8 | use core::sync::atomic::{compiler_fence, Ordering}; | 8 | use core::sync::atomic::{Ordering, compiler_fence}; |
| 9 | use core::task::{Context, Poll}; | 9 | use core::task::{Context, Poll}; |
| 10 | 10 | ||
| 11 | use critical_section::CriticalSection; | 11 | use critical_section::CriticalSection; |
| 12 | use embassy_hal_internal::interrupt::InterruptExt; | 12 | use embassy_hal_internal::interrupt::InterruptExt; |
| 13 | use embassy_hal_internal::{impl_peripheral, PeripheralType}; | 13 | use embassy_hal_internal::{PeripheralType, impl_peripheral}; |
| 14 | use embassy_sync::waitqueue::AtomicWaker; | 14 | use embassy_sync::waitqueue::AtomicWaker; |
| 15 | use mspm0_metapac::common::{Reg, RW}; | 15 | use mspm0_metapac::common::{RW, Reg}; |
| 16 | use mspm0_metapac::dma::regs; | 16 | use mspm0_metapac::dma::regs; |
| 17 | use mspm0_metapac::dma::vals::{self, Autoen, Em, Incr, Preirq, Wdth}; | 17 | use mspm0_metapac::dma::vals::{self, Autoen, Em, Incr, Preirq, Wdth}; |
| 18 | 18 | ||
| 19 | use crate::{interrupt, pac, Peri}; | 19 | use crate::{Peri, interrupt, pac}; |
| 20 | 20 | ||
| 21 | /// The burst size of a DMA transfer. | 21 | /// The burst size of a DMA transfer. |
| 22 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] | 22 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
diff --git a/embassy-mspm0/src/gpio.rs b/embassy-mspm0/src/gpio.rs index d5fd36dbf..a4d41aa71 100644 --- a/embassy-mspm0/src/gpio.rs +++ b/embassy-mspm0/src/gpio.rs | |||
| @@ -5,7 +5,7 @@ use core::future::Future; | |||
| 5 | use core::pin::Pin as FuturePin; | 5 | use core::pin::Pin as FuturePin; |
| 6 | use core::task::{Context, Poll}; | 6 | use core::task::{Context, Poll}; |
| 7 | 7 | ||
| 8 | use embassy_hal_internal::{impl_peripheral, Peri, PeripheralType}; | 8 | use embassy_hal_internal::{Peri, PeripheralType, impl_peripheral}; |
| 9 | use embassy_sync::waitqueue::AtomicWaker; | 9 | use embassy_sync::waitqueue::AtomicWaker; |
| 10 | 10 | ||
| 11 | use crate::pac::gpio::vals::*; | 11 | use crate::pac::gpio::vals::*; |
| @@ -1125,14 +1125,14 @@ fn GPIOB() { | |||
| 1125 | // Defining these as no_mangle is required so that the linker will pick these over the default handler. | 1125 | // Defining these as no_mangle is required so that the linker will pick these over the default handler. |
| 1126 | 1126 | ||
| 1127 | #[cfg(all(feature = "rt", not(any(mspm0c110x, mspm0c1105_c1106, mspm0l110x))))] | 1127 | #[cfg(all(feature = "rt", not(any(mspm0c110x, mspm0c1105_c1106, mspm0l110x))))] |
| 1128 | #[no_mangle] | 1128 | #[unsafe(no_mangle)] |
| 1129 | #[allow(non_snake_case)] | 1129 | #[allow(non_snake_case)] |
| 1130 | fn GPIOA() { | 1130 | fn GPIOA() { |
| 1131 | irq_handler(pac::GPIOA, &PORTA_WAKERS); | 1131 | irq_handler(pac::GPIOA, &PORTA_WAKERS); |
| 1132 | } | 1132 | } |
| 1133 | 1133 | ||
| 1134 | #[cfg(all(feature = "rt", gpio_pb, not(mspm0c1105_c1106)))] | 1134 | #[cfg(all(feature = "rt", gpio_pb, not(mspm0c1105_c1106)))] |
| 1135 | #[no_mangle] | 1135 | #[unsafe(no_mangle)] |
| 1136 | #[allow(non_snake_case)] | 1136 | #[allow(non_snake_case)] |
| 1137 | fn GPIOB() { | 1137 | fn GPIOB() { |
| 1138 | irq_handler(pac::GPIOB, &PORTB_WAKERS); | 1138 | irq_handler(pac::GPIOB, &PORTB_WAKERS); |
| @@ -1140,7 +1140,7 @@ fn GPIOB() { | |||
| 1140 | 1140 | ||
| 1141 | #[cfg(all(feature = "rt", gpio_pc))] | 1141 | #[cfg(all(feature = "rt", gpio_pc))] |
| 1142 | #[allow(non_snake_case)] | 1142 | #[allow(non_snake_case)] |
| 1143 | #[no_mangle] | 1143 | #[unsafe(no_mangle)] |
| 1144 | fn GPIOC() { | 1144 | fn GPIOC() { |
| 1145 | irq_handler(pac::GPIOC, &PORTC_WAKERS); | 1145 | irq_handler(pac::GPIOC, &PORTC_WAKERS); |
| 1146 | } | 1146 | } |
diff --git a/embassy-mspm0/src/i2c.rs b/embassy-mspm0/src/i2c.rs index 1906e37ba..a12b4b4a2 100644 --- a/embassy-mspm0/src/i2c.rs +++ b/embassy-mspm0/src/i2c.rs | |||
| @@ -10,13 +10,13 @@ use embassy_hal_internal::PeripheralType; | |||
| 10 | use embassy_sync::waitqueue::AtomicWaker; | 10 | use embassy_sync::waitqueue::AtomicWaker; |
| 11 | use mspm0_metapac::i2c; | 11 | use mspm0_metapac::i2c; |
| 12 | 12 | ||
| 13 | use crate::Peri; | ||
| 13 | use crate::gpio::{AnyPin, PfType, Pull, SealedPin}; | 14 | use crate::gpio::{AnyPin, PfType, Pull, SealedPin}; |
| 14 | use crate::interrupt::typelevel::Binding; | 15 | use crate::interrupt::typelevel::Binding; |
| 15 | use crate::interrupt::{Interrupt, InterruptExt}; | 16 | use crate::interrupt::{Interrupt, InterruptExt}; |
| 16 | use crate::mode::{Async, Blocking, Mode}; | 17 | use crate::mode::{Async, Blocking, Mode}; |
| 17 | use crate::pac::i2c::{vals, I2c as Regs}; | 18 | use crate::pac::i2c::{I2c as Regs, vals}; |
| 18 | use crate::pac::{self}; | 19 | use crate::pac::{self}; |
| 19 | use crate::Peri; | ||
| 20 | 20 | ||
| 21 | /// The clock source for the I2C. | 21 | /// The clock source for the I2C. |
| 22 | #[derive(Clone, Copy, PartialEq, Eq, Debug)] | 22 | #[derive(Clone, Copy, PartialEq, Eq, Debug)] |
diff --git a/embassy-mspm0/src/lib.rs b/embassy-mspm0/src/lib.rs index 13f0ce662..55f3f9381 100644 --- a/embassy-mspm0/src/lib.rs +++ b/embassy-mspm0/src/lib.rs | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![allow(unsafe_op_in_unsafe_fn)] | ||
| 2 | // Doc feature labels can be tested locally by running RUSTDOCFLAGS="--cfg=docsrs" cargo +nightly doc | 3 | // 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)))] | 4 | #![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg_hide), doc(cfg_hide(doc, docsrs)))] |
| 4 | #![cfg_attr( | 5 | #![cfg_attr( |
| @@ -54,7 +55,7 @@ pub(crate) mod _generated { | |||
| 54 | 55 | ||
| 55 | // Reexports | 56 | // Reexports |
| 56 | pub(crate) use _generated::gpio_pincm; | 57 | pub(crate) use _generated::gpio_pincm; |
| 57 | pub use _generated::{peripherals, Peripherals}; | 58 | pub use _generated::{Peripherals, peripherals}; |
| 58 | pub use embassy_hal_internal::Peri; | 59 | pub use embassy_hal_internal::Peri; |
| 59 | #[cfg(feature = "unstable-pac")] | 60 | #[cfg(feature = "unstable-pac")] |
| 60 | pub use mspm0_metapac as pac; | 61 | pub use mspm0_metapac as pac; |
| @@ -111,7 +112,7 @@ macro_rules! bind_interrupts { | |||
| 111 | 112 | ||
| 112 | $( | 113 | $( |
| 113 | #[allow(non_snake_case)] | 114 | #[allow(non_snake_case)] |
| 114 | #[no_mangle] | 115 | #[unsafe(no_mangle)] |
| 115 | $(#[cfg($cond_irq)])? | 116 | $(#[cfg($cond_irq)])? |
| 116 | unsafe extern "C" fn $irq() { | 117 | unsafe extern "C" fn $irq() { |
| 117 | unsafe { | 118 | unsafe { |
diff --git a/embassy-mspm0/src/time_driver.rs b/embassy-mspm0/src/time_driver.rs index e80e89e55..0743c667b 100644 --- a/embassy-mspm0/src/time_driver.rs +++ b/embassy-mspm0/src/time_driver.rs | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | use core::cell::{Cell, RefCell}; | 1 | use core::cell::{Cell, RefCell}; |
| 2 | use core::sync::atomic::{compiler_fence, AtomicU32, Ordering}; | 2 | use core::sync::atomic::{AtomicU32, Ordering, compiler_fence}; |
| 3 | use core::task::Waker; | 3 | use core::task::Waker; |
| 4 | 4 | ||
| 5 | use critical_section::{CriticalSection, Mutex}; | 5 | use critical_section::{CriticalSection, Mutex}; |
diff --git a/embassy-mspm0/src/uart/buffered.rs b/embassy-mspm0/src/uart/buffered.rs index cbc0b6c80..89e6bcc7b 100644 --- a/embassy-mspm0/src/uart/buffered.rs +++ b/embassy-mspm0/src/uart/buffered.rs | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | use core::future::{poll_fn, Future}; | 1 | use core::future::{Future, poll_fn}; |
| 2 | use core::marker::PhantomData; | 2 | use core::marker::PhantomData; |
| 3 | use core::slice; | 3 | use core::slice; |
| 4 | use core::sync::atomic::{AtomicU8, Ordering}; | 4 | use core::sync::atomic::{AtomicU8, Ordering}; |
| @@ -14,7 +14,7 @@ use crate::gpio::{AnyPin, SealedPin}; | |||
| 14 | use crate::interrupt::typelevel::Binding; | 14 | use crate::interrupt::typelevel::Binding; |
| 15 | use crate::pac::uart::Uart as Regs; | 15 | use crate::pac::uart::Uart as Regs; |
| 16 | use crate::uart::{Config, ConfigError, CtsPin, Error, Info, Instance, RtsPin, RxPin, State, TxPin}; | 16 | use crate::uart::{Config, ConfigError, CtsPin, Error, Info, Instance, RtsPin, RxPin, State, TxPin}; |
| 17 | use crate::{interrupt, Peri}; | 17 | use crate::{Peri, interrupt}; |
| 18 | 18 | ||
| 19 | /// Interrupt handler. | 19 | /// Interrupt handler. |
| 20 | pub struct BufferedInterruptHandler<T: Instance> { | 20 | pub struct BufferedInterruptHandler<T: Instance> { |
diff --git a/embassy-mspm0/src/uart/mod.rs b/embassy-mspm0/src/uart/mod.rs index 6599cea06..03e68d297 100644 --- a/embassy-mspm0/src/uart/mod.rs +++ b/embassy-mspm0/src/uart/mod.rs | |||
| @@ -3,17 +3,17 @@ | |||
| 3 | mod buffered; | 3 | mod buffered; |
| 4 | 4 | ||
| 5 | use core::marker::PhantomData; | 5 | use core::marker::PhantomData; |
| 6 | use core::sync::atomic::{compiler_fence, AtomicU32, Ordering}; | 6 | use core::sync::atomic::{AtomicU32, Ordering, compiler_fence}; |
| 7 | 7 | ||
| 8 | pub use buffered::*; | 8 | pub use buffered::*; |
| 9 | use embassy_embedded_hal::SetConfig; | 9 | use embassy_embedded_hal::SetConfig; |
| 10 | use embassy_hal_internal::PeripheralType; | 10 | use embassy_hal_internal::PeripheralType; |
| 11 | 11 | ||
| 12 | use crate::Peri; | ||
| 12 | use crate::gpio::{AnyPin, PfType, Pull, SealedPin}; | 13 | use crate::gpio::{AnyPin, PfType, Pull, SealedPin}; |
| 13 | use crate::interrupt::{Interrupt, InterruptExt}; | 14 | use crate::interrupt::{Interrupt, InterruptExt}; |
| 14 | use crate::mode::{Blocking, Mode}; | 15 | use crate::mode::{Blocking, Mode}; |
| 15 | use crate::pac::uart::{vals, Uart as Regs}; | 16 | use crate::pac::uart::{Uart as Regs, vals}; |
| 16 | use crate::Peri; | ||
| 17 | 17 | ||
| 18 | /// The clock source for the UART. | 18 | /// The clock source for the UART. |
| 19 | #[derive(Clone, Copy, PartialEq, Eq, Debug)] | 19 | #[derive(Clone, Copy, PartialEq, Eq, Debug)] |
| @@ -931,8 +931,7 @@ fn set_baudrate_inner(regs: Regs, clock: u32, baudrate: u32) -> Result<(), Confi | |||
| 931 | let Some(min_clock) = baudrate.checked_mul(oversampling as u32) else { | 931 | let Some(min_clock) = baudrate.checked_mul(oversampling as u32) else { |
| 932 | trace!( | 932 | trace!( |
| 933 | "{}x oversampling would cause overflow for clock: {} Hz", | 933 | "{}x oversampling would cause overflow for clock: {} Hz", |
| 934 | oversampling, | 934 | oversampling, clock |
| 935 | clock | ||
| 936 | ); | 935 | ); |
| 937 | continue; | 936 | continue; |
| 938 | }; | 937 | }; |
| @@ -945,9 +944,7 @@ fn set_baudrate_inner(regs: Regs, clock: u32, baudrate: u32) -> Result<(), Confi | |||
| 945 | for &(div, div_value) in &DIVS { | 944 | for &(div, div_value) in &DIVS { |
| 946 | trace!( | 945 | trace!( |
| 947 | "Trying div: {}, oversampling {} for {} baud", | 946 | "Trying div: {}, oversampling {} for {} baud", |
| 948 | div, | 947 | div, oversampling, baudrate |
| 949 | oversampling, | ||
| 950 | baudrate | ||
| 951 | ); | 948 | ); |
| 952 | 949 | ||
| 953 | let Some((ibrd, fbrd)) = calculate_brd(clock, div, baudrate, oversampling) else { | 950 | let Some((ibrd, fbrd)) = calculate_brd(clock, div, baudrate, oversampling) else { |
diff --git a/embassy-mspm0/src/wwdt.rs b/embassy-mspm0/src/wwdt.rs index e5c62c660..92aeb8b40 100644 --- a/embassy-mspm0/src/wwdt.rs +++ b/embassy-mspm0/src/wwdt.rs | |||
| @@ -6,9 +6,9 @@ | |||
| 6 | 6 | ||
| 7 | use embassy_hal_internal::PeripheralType; | 7 | use embassy_hal_internal::PeripheralType; |
| 8 | 8 | ||
| 9 | use crate::pac::wwdt::{vals, Wwdt as Regs}; | ||
| 10 | use crate::pac::{self}; | ||
| 11 | use crate::Peri; | 9 | use crate::Peri; |
| 10 | use crate::pac::wwdt::{Wwdt as Regs, vals}; | ||
| 11 | use crate::pac::{self}; | ||
| 12 | 12 | ||
| 13 | /// Possible watchdog timeout values. | 13 | /// Possible watchdog timeout values. |
| 14 | #[derive(Clone, Copy, PartialEq, Eq, Debug)] | 14 | #[derive(Clone, Copy, PartialEq, Eq, Debug)] |
