aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src
diff options
context:
space:
mode:
authorKarun <[email protected]>2024-04-22 12:36:17 -0400
committerKarun <[email protected]>2024-05-02 17:17:39 -0400
commit253f6c42eeada0bc9e40582fd968214d8f8bd761 (patch)
treed11ad8df3be0125d9231eea68ae61190d4f33208 /embassy-stm32/src
parentfd69247d702d01a8e3c976a48bba4e44422d2cae (diff)
Address versioning and format issues raised by CI
Diffstat (limited to 'embassy-stm32/src')
-rw-r--r--embassy-stm32/src/lib.rs4
-rw-r--r--embassy-stm32/src/tsc/enums.rs16
-rw-r--r--embassy-stm32/src/tsc/mod.rs38
3 files changed, 49 insertions, 9 deletions
diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs
index dd89618ef..2bda2cf79 100644
--- a/embassy-stm32/src/lib.rs
+++ b/embassy-stm32/src/lib.rs
@@ -101,10 +101,10 @@ pub mod sai;
101pub mod sdmmc; 101pub mod sdmmc;
102#[cfg(spi)] 102#[cfg(spi)]
103pub mod spi; 103pub mod spi;
104#[cfg(ucpd)]
105pub mod ucpd;
106#[cfg(tsc)] 104#[cfg(tsc)]
107pub mod tsc; 105pub mod tsc;
106#[cfg(ucpd)]
107pub mod ucpd;
108#[cfg(uid)] 108#[cfg(uid)]
109pub mod uid; 109pub mod uid;
110#[cfg(usart)] 110#[cfg(usart)]
diff --git a/embassy-stm32/src/tsc/enums.rs b/embassy-stm32/src/tsc/enums.rs
index bc8e9d2f5..bdb384900 100644
--- a/embassy-stm32/src/tsc/enums.rs
+++ b/embassy-stm32/src/tsc/enums.rs
@@ -27,13 +27,21 @@ pub enum TscIOPin {
27 Group6Io2, 27 Group6Io2,
28 Group6Io3, 28 Group6Io3,
29 Group6Io4, 29 Group6Io4,
30 #[cfg(any(tsc_v2, tsc_v3))]
30 Group7Io1, 31 Group7Io1,
32 #[cfg(any(tsc_v2, tsc_v3))]
31 Group7Io2, 33 Group7Io2,
34 #[cfg(any(tsc_v2, tsc_v3))]
32 Group7Io3, 35 Group7Io3,
36 #[cfg(any(tsc_v2, tsc_v3))]
33 Group7Io4, 37 Group7Io4,
38 #[cfg(tsc_v3)]
34 Group8Io1, 39 Group8Io1,
40 #[cfg(tsc_v3)]
35 Group8Io2, 41 Group8Io2,
42 #[cfg(tsc_v3)]
36 Group8Io3, 43 Group8Io3,
44 #[cfg(tsc_v3)]
37 Group8Io4, 45 Group8Io4,
38} 46}
39 47
@@ -78,13 +86,21 @@ impl Into<u32> for TscIOPin {
78 TscIOPin::Group6Io2 => 0x00200000, 86 TscIOPin::Group6Io2 => 0x00200000,
79 TscIOPin::Group6Io3 => 0x00400000, 87 TscIOPin::Group6Io3 => 0x00400000,
80 TscIOPin::Group6Io4 => 0x00800000, 88 TscIOPin::Group6Io4 => 0x00800000,
89 #[cfg(any(tsc_v2, tsc_v3))]
81 TscIOPin::Group7Io1 => 0x01000000, 90 TscIOPin::Group7Io1 => 0x01000000,
91 #[cfg(any(tsc_v2, tsc_v3))]
82 TscIOPin::Group7Io2 => 0x02000000, 92 TscIOPin::Group7Io2 => 0x02000000,
93 #[cfg(any(tsc_v2, tsc_v3))]
83 TscIOPin::Group7Io3 => 0x04000000, 94 TscIOPin::Group7Io3 => 0x04000000,
95 #[cfg(any(tsc_v2, tsc_v3))]
84 TscIOPin::Group7Io4 => 0x08000000, 96 TscIOPin::Group7Io4 => 0x08000000,
97 #[cfg(tsc_v3)]
85 TscIOPin::Group8Io1 => 0x10000000, 98 TscIOPin::Group8Io1 => 0x10000000,
99 #[cfg(tsc_v3)]
86 TscIOPin::Group8Io2 => 0x20000000, 100 TscIOPin::Group8Io2 => 0x20000000,
101 #[cfg(tsc_v3)]
87 TscIOPin::Group8Io3 => 0x40000000, 102 TscIOPin::Group8Io3 => 0x40000000,
103 #[cfg(tsc_v3)]
88 TscIOPin::Group8Io4 => 0x80000000, 104 TscIOPin::Group8Io4 => 0x80000000,
89 } 105 }
90 } 106 }
diff --git a/embassy-stm32/src/tsc/mod.rs b/embassy-stm32/src/tsc/mod.rs
index 301d6f900..8642da0e1 100644
--- a/embassy-stm32/src/tsc/mod.rs
+++ b/embassy-stm32/src/tsc/mod.rs
@@ -5,13 +5,14 @@
5/// Enums defined for peripheral parameters 5/// Enums defined for peripheral parameters
6pub mod enums; 6pub mod enums;
7 7
8use crate::gpio::{low_level::AFType, AnyPin, Pull}; 8pub use enums::*;
9use crate::{pac::tsc::Tsc as Regs, rcc::RccPeripheral}; 9
10use crate::gpio::{AFType, AnyPin, Pull};
11use crate::pac::tsc::Tsc as Regs;
12use crate::rcc::RccPeripheral;
10use crate::{peripherals, Peripheral}; 13use crate::{peripherals, Peripheral};
11use embassy_hal_internal::{into_ref, PeripheralRef}; 14use embassy_hal_internal::{into_ref, PeripheralRef};
12 15
13pub use enums::*;
14
15const TSC_NUM_GROUPS: u32 = 8; 16const TSC_NUM_GROUPS: u32 = 8;
16 17
17/// Error type defined for TSC 18/// Error type defined for TSC
@@ -68,7 +69,9 @@ pub enum Group {
68 Four, 69 Four,
69 Five, 70 Five,
70 Six, 71 Six,
72 #[cfg(any(tsc_v2, tsc_v3))]
71 Seven, 73 Seven,
74 #[cfg(tsc_v3)]
72 Eight, 75 Eight,
73} 76}
74 77
@@ -81,7 +84,9 @@ impl Into<usize> for Group {
81 Group::Four => 3, 84 Group::Four => 3,
82 Group::Five => 4, 85 Group::Five => 4,
83 Group::Six => 5, 86 Group::Six => 5,
87 #[cfg(any(tsc_v2, tsc_v3))]
84 Group::Seven => 6, 88 Group::Seven => 6,
89 #[cfg(tsc_v3)]
85 Group::Eight => 7, 90 Group::Eight => 7,
86 } 91 }
87 } 92 }
@@ -175,7 +180,9 @@ pub struct Tsc<'d, T: Instance> {
175 g4: Option<PinGroup<'d, AnyPin>>, 180 g4: Option<PinGroup<'d, AnyPin>>,
176 g5: Option<PinGroup<'d, AnyPin>>, 181 g5: Option<PinGroup<'d, AnyPin>>,
177 g6: Option<PinGroup<'d, AnyPin>>, 182 g6: Option<PinGroup<'d, AnyPin>>,
183 #[cfg(any(tsc_v2, tsc_v3))]
178 g7: Option<PinGroup<'d, AnyPin>>, 184 g7: Option<PinGroup<'d, AnyPin>>,
185 #[cfg(tsc_v3)]
179 g8: Option<PinGroup<'d, AnyPin>>, 186 g8: Option<PinGroup<'d, AnyPin>>,
180 state: State, 187 state: State,
181 config: Config, 188 config: Config,
@@ -310,7 +317,20 @@ impl<'d, T: Instance> Tsc<'d, T> {
310 }; 317 };
311 318
312 // Need to check valid pin configuration input 319 // Need to check valid pin configuration input
313 Self::new_inner(peri, Some(g1), Some(g2), None, Some(g4), None, None, None, None, config) 320 Self::new_inner(
321 peri,
322 Some(g1),
323 Some(g2),
324 None,
325 Some(g4),
326 None,
327 None,
328 #[cfg(any(tsc_v2, tsc_v3))]
329 None,
330 #[cfg(tsc_v3)]
331 None,
332 config,
333 )
314 } 334 }
315 335
316 // fn configure_pin<'b, G: Pin>(pin: PeripheralRef<'b, G>, role: PinType) { 336 // fn configure_pin<'b, G: Pin>(pin: PeripheralRef<'b, G>, role: PinType) {
@@ -340,8 +360,8 @@ impl<'d, T: Instance> Tsc<'d, T> {
340 g4: Option<PinGroup<'d, AnyPin>>, 360 g4: Option<PinGroup<'d, AnyPin>>,
341 g5: Option<PinGroup<'d, AnyPin>>, 361 g5: Option<PinGroup<'d, AnyPin>>,
342 g6: Option<PinGroup<'d, AnyPin>>, 362 g6: Option<PinGroup<'d, AnyPin>>,
343 g7: Option<PinGroup<'d, AnyPin>>, 363 #[cfg(any(tsc_v2, tsc_v3))] g7: Option<PinGroup<'d, AnyPin>>,
344 g8: Option<PinGroup<'d, AnyPin>>, 364 #[cfg(tsc_v3)] g8: Option<PinGroup<'d, AnyPin>>,
345 config: Config, 365 config: Config,
346 ) -> Self { 366 ) -> Self {
347 into_ref!(peri); 367 into_ref!(peri);
@@ -411,7 +431,9 @@ impl<'d, T: Instance> Tsc<'d, T> {
411 g4, 431 g4,
412 g5, 432 g5,
413 g6, 433 g6,
434 #[cfg(any(tsc_v2, tsc_v3))]
414 g7, 435 g7,
436 #[cfg(tsc_v3)]
415 g8, 437 g8,
416 state: State::Ready, 438 state: State::Ready,
417 config, 439 config,
@@ -548,7 +570,9 @@ impl<'d, T: Instance> Tsc<'d, T> {
548 Group::Four => T::REGS.iogcsr().read().g4s(), 570 Group::Four => T::REGS.iogcsr().read().g4s(),
549 Group::Five => T::REGS.iogcsr().read().g5s(), 571 Group::Five => T::REGS.iogcsr().read().g5s(),
550 Group::Six => T::REGS.iogcsr().read().g6s(), 572 Group::Six => T::REGS.iogcsr().read().g6s(),
573 #[cfg(any(tsc_v2, tsc_v3))]
551 Group::Seven => T::REGS.iogcsr().read().g7s(), 574 Group::Seven => T::REGS.iogcsr().read().g7s(),
575 #[cfg(tsc_v3)]
552 Group::Eight => T::REGS.iogcsr().read().g8s(), 576 Group::Eight => T::REGS.iogcsr().read().g8s(),
553 }; 577 };
554 match status { 578 match status {