diff --git a/embassy-stm32/src/tsc/mod.rs b/embassy-stm32/src/tsc/mod.rs index 6bff642fa..1a8aabbc6 100644 --- a/embassy-stm32/src/tsc/mod.rs +++ b/embassy-stm32/src/tsc/mod.rs @@ -81,14 +81,81 @@ pub struct Config { pub sampling_ios: u32, } +pub struct TscPin<'d, T> { + pin: PeripheralRef<'d, AnyPin>, + role: PinType, +} + +pub struct PinGroup<'d, A, B, C, D> { + d1: Option>, + d2: Option>, + d3: Option>, + d4: Option>, +} + pub struct TSC<'d, T: Instance> { _peri: PeripheralRef<'d, T>, + g1: Option>, + g2: Option>, + g3: Option>, + g4: Option>, + g5: Option>, + g6: Option>, + g7: Option>, + g8: Option>, state: State, config: Config, } impl<'d, T: Instance> TSC<'d, T> { - pub fn new(peri: impl Peripheral

+ 'd, config: Config) -> Self { + pub fn new( + peri: impl Peripheral

+ 'd, + g1: Option< + PinGroup< + 'd, + impl Peripheral

> + 'd, + impl Peripheral

> + 'd, + impl Peripheral

> + 'd, + impl Peripheral

> + 'd, + >, + >, + + g2_d1: Option> + 'd>, + g2_d2: Option> + 'd>, + g2_d3: Option> + 'd>, + g2_d4: Option> + 'd>, + + g3_d1: Option> + 'd>, + g3_d2: Option> + 'd>, + g3_d3: Option> + 'd>, + g3_d4: Option> + 'd>, + + g4_d1: Option> + 'd>, + g4_d2: Option> + 'd>, + g4_d3: Option> + 'd>, + g4_d4: Option> + 'd>, + + g5_d1: Option> + 'd>, + g5_d2: Option> + 'd>, + g5_d3: Option> + 'd>, + g5_d4: Option> + 'd>, + + g6_d1: Option> + 'd>, + g6_d2: Option> + 'd>, + g6_d3: Option> + 'd>, + g6_d4: Option> + 'd>, + + g7_d1: Option> + 'd>, + g7_d2: Option> + 'd>, + g7_d3: Option> + 'd>, + g7_d4: Option> + 'd>, + + g8_d1: Option> + 'd>, + g8_d2: Option> + 'd>, + g8_d3: Option> + 'd>, + g8_d4: Option> + 'd>, + config: Config, + ) -> Self { into_ref!(peri); // Need to check valid pin configuration input @@ -96,6 +163,8 @@ impl<'d, T: Instance> TSC<'d, T> { Self::new_inner(peri, config) } + fn filter_group() -> Result, ()> {} + fn new_inner(peri: impl Peripheral

+ 'd, config: Config) -> Self { into_ref!(peri); @@ -111,7 +180,7 @@ impl<'d, T: Instance> TSC<'d, T> { w.set_pgpsc(config.pulse_generator_prescaler.into()); w.set_mcv(config.max_count_value); w.set_syncpol(config.synchro_pin_polarity); - w.set_am(config.acquisition_mode) + w.set_am(config.acquisition_mode); }); // Set IO configuration