aboutsummaryrefslogtreecommitdiff
path: root/embassy-mspm0/src/uart
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2025-10-06 22:56:31 +0200
committerDario Nieuwenhuis <[email protected]>2025-10-06 23:19:53 +0200
commit8730a013c395cf0bf4c2fa8eeb7f138288103039 (patch)
tree39eca5fbc4570bd0129c9a291f134de5dab98820 /embassy-mspm0/src/uart
parentabc8e450f936567ad42cb34b5d2a7941b206aa5d (diff)
Rustfmt for edition 2024.
Diffstat (limited to 'embassy-mspm0/src/uart')
-rw-r--r--embassy-mspm0/src/uart/buffered.rs4
-rw-r--r--embassy-mspm0/src/uart/mod.rs13
2 files changed, 7 insertions, 10 deletions
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 @@
1use core::future::{poll_fn, Future}; 1use core::future::{Future, poll_fn};
2use core::marker::PhantomData; 2use core::marker::PhantomData;
3use core::slice; 3use core::slice;
4use core::sync::atomic::{AtomicU8, Ordering}; 4use core::sync::atomic::{AtomicU8, Ordering};
@@ -14,7 +14,7 @@ use crate::gpio::{AnyPin, SealedPin};
14use crate::interrupt::typelevel::Binding; 14use crate::interrupt::typelevel::Binding;
15use crate::pac::uart::Uart as Regs; 15use crate::pac::uart::Uart as Regs;
16use crate::uart::{Config, ConfigError, CtsPin, Error, Info, Instance, RtsPin, RxPin, State, TxPin}; 16use crate::uart::{Config, ConfigError, CtsPin, Error, Info, Instance, RtsPin, RxPin, State, TxPin};
17use crate::{interrupt, Peri}; 17use crate::{Peri, interrupt};
18 18
19/// Interrupt handler. 19/// Interrupt handler.
20pub struct BufferedInterruptHandler<T: Instance> { 20pub 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 @@
3mod buffered; 3mod buffered;
4 4
5use core::marker::PhantomData; 5use core::marker::PhantomData;
6use core::sync::atomic::{compiler_fence, AtomicU32, Ordering}; 6use core::sync::atomic::{AtomicU32, Ordering, compiler_fence};
7 7
8pub use buffered::*; 8pub use buffered::*;
9use embassy_embedded_hal::SetConfig; 9use embassy_embedded_hal::SetConfig;
10use embassy_hal_internal::PeripheralType; 10use embassy_hal_internal::PeripheralType;
11 11
12use crate::Peri;
12use crate::gpio::{AnyPin, PfType, Pull, SealedPin}; 13use crate::gpio::{AnyPin, PfType, Pull, SealedPin};
13use crate::interrupt::{Interrupt, InterruptExt}; 14use crate::interrupt::{Interrupt, InterruptExt};
14use crate::mode::{Blocking, Mode}; 15use crate::mode::{Blocking, Mode};
15use crate::pac::uart::{vals, Uart as Regs}; 16use crate::pac::uart::{Uart as Regs, vals};
16use 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 {