aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32l4
diff options
context:
space:
mode:
authormichel <[email protected]>2024-10-10 15:14:53 +0200
committermichel <[email protected]>2024-11-29 17:58:35 +0100
commit31da5155e840d97e432cf2fa06c6fa4c2a19bf9a (patch)
tree50b2745e97e0305fb06afcfdf3a649529a2d0d3a /examples/stm32l4
parenta5b34a7980edaba5d8de05c68a48972dd9239f75 (diff)
Refactor TSC module: Remove redundant 'Tsc' prefixes for improved naming consistency
Diffstat (limited to 'examples/stm32l4')
-rw-r--r--examples/stm32l4/src/bin/tsc_async.rs4
-rw-r--r--examples/stm32l4/src/bin/tsc_blocking.rs6
-rw-r--r--examples/stm32l4/src/bin/tsc_multipin.rs12
3 files changed, 11 insertions, 11 deletions
diff --git a/examples/stm32l4/src/bin/tsc_async.rs b/examples/stm32l4/src/bin/tsc_async.rs
index ada2c468f..b9a059e2e 100644
--- a/examples/stm32l4/src/bin/tsc_async.rs
+++ b/examples/stm32l4/src/bin/tsc_async.rs
@@ -50,9 +50,9 @@ async fn main(_spawner: embassy_executor::Spawner) {
50 50
51 let mut pin_group: PinGroupWithRoles<peripherals::TSC, G2> = PinGroupWithRoles::default(); 51 let mut pin_group: PinGroupWithRoles<peripherals::TSC, G2> = PinGroupWithRoles::default();
52 // D25 52 // D25
53 pin_group.set_io1::<tsc_pin_roles::Sample>(context.PB4); 53 pin_group.set_io1::<tsc::pin_roles::Sample>(context.PB4);
54 // D21 54 // D21
55 let tsc_sensor = pin_group.set_io2::<tsc_pin_roles::Channel>(context.PB5); 55 let tsc_sensor = pin_group.set_io2::<tsc::pin_roles::Channel>(context.PB5);
56 56
57 let pin_groups: PinGroups<peripherals::TSC> = PinGroups { 57 let pin_groups: PinGroups<peripherals::TSC> = PinGroups {
58 g2: Some(pin_group.pin_group), 58 g2: Some(pin_group.pin_group),
diff --git a/examples/stm32l4/src/bin/tsc_blocking.rs b/examples/stm32l4/src/bin/tsc_blocking.rs
index 76aba55ba..12084f8e2 100644
--- a/examples/stm32l4/src/bin/tsc_blocking.rs
+++ b/examples/stm32l4/src/bin/tsc_blocking.rs
@@ -74,9 +74,9 @@ async fn main(_spawner: embassy_executor::Spawner) {
74 74
75 let mut g2: PinGroupWithRoles<peripherals::TSC, G2> = PinGroupWithRoles::default(); 75 let mut g2: PinGroupWithRoles<peripherals::TSC, G2> = PinGroupWithRoles::default();
76 // D25 76 // D25
77 g2.set_io1::<tsc_pin_roles::Sample>(context.PB4); 77 g2.set_io1::<tsc::pin_roles::Sample>(context.PB4);
78 // D21 78 // D21
79 let tsc_sensor = g2.set_io2::<tsc_pin_roles::Channel>(context.PB5); 79 let tsc_sensor = g2.set_io2::<tsc::pin_roles::Channel>(context.PB5);
80 80
81 let pin_groups: PinGroups<peripherals::TSC> = PinGroups { 81 let pin_groups: PinGroups<peripherals::TSC> = PinGroups {
82 g2: Some(g2.pin_group), 82 g2: Some(g2.pin_group),
@@ -128,7 +128,7 @@ const MAX_GROUP_STATUS_READ_ATTEMPTS: usize = 10;
128// attempt to read group status and delay when still ongoing 128// attempt to read group status and delay when still ongoing
129async fn read_touch_value( 129async fn read_touch_value(
130 touch_controller: &mut tsc::Tsc<'_, peripherals::TSC, mode::Blocking>, 130 touch_controller: &mut tsc::Tsc<'_, peripherals::TSC, mode::Blocking>,
131 sensor_pin: TscIOPin, 131 sensor_pin: tsc::IOPin,
132) -> Option<u16> { 132) -> Option<u16> {
133 for _ in 0..MAX_GROUP_STATUS_READ_ATTEMPTS { 133 for _ in 0..MAX_GROUP_STATUS_READ_ATTEMPTS {
134 match touch_controller.group_get_status(sensor_pin.group()) { 134 match touch_controller.group_get_status(sensor_pin.group()) {
diff --git a/examples/stm32l4/src/bin/tsc_multipin.rs b/examples/stm32l4/src/bin/tsc_multipin.rs
index f26a6f4eb..2fadbe16a 100644
--- a/examples/stm32l4/src/bin/tsc_multipin.rs
+++ b/examples/stm32l4/src/bin/tsc_multipin.rs
@@ -74,7 +74,7 @@ const SENSOR_THRESHOLD: u16 = 20;
74 74
75async fn acquire_sensors( 75async fn acquire_sensors(
76 touch_controller: &mut Tsc<'static, peripherals::TSC, mode::Async>, 76 touch_controller: &mut Tsc<'static, peripherals::TSC, mode::Async>,
77 tsc_acquisition_bank: &TscAcquisitionBank, 77 tsc_acquisition_bank: &AcquisitionBank,
78) { 78) {
79 touch_controller.set_active_channels_mask(tsc_acquisition_bank.mask()); 79 touch_controller.set_active_channels_mask(tsc_acquisition_bank.mask());
80 touch_controller.start(); 80 touch_controller.start();
@@ -91,11 +91,11 @@ async fn main(_spawner: embassy_executor::Spawner) {
91 91
92 // ---------- initial configuration of TSC ---------- 92 // ---------- initial configuration of TSC ----------
93 let mut g1: PinGroupWithRoles<peripherals::TSC, G1> = PinGroupWithRoles::default(); 93 let mut g1: PinGroupWithRoles<peripherals::TSC, G1> = PinGroupWithRoles::default();
94 g1.set_io1::<tsc_pin_roles::Sample>(context.PB12); 94 g1.set_io1::<tsc::pin_roles::Sample>(context.PB12);
95 let sensor0 = g1.set_io2::<tsc_pin_roles::Channel>(context.PB13); 95 let sensor0 = g1.set_io2::<tsc::pin_roles::Channel>(context.PB13);
96 96
97 let mut g2: PinGroupWithRoles<peripherals::TSC, G2> = PinGroupWithRoles::default(); 97 let mut g2: PinGroupWithRoles<peripherals::TSC, G2> = PinGroupWithRoles::default();
98 g2.set_io1::<tsc_pin_roles::Sample>(context.PB4); 98 g2.set_io1::<tsc::pin_roles::Sample>(context.PB4);
99 let sensor1 = g2.set_io2(context.PB5); 99 let sensor1 = g2.set_io2(context.PB5);
100 let sensor2 = g2.set_io3(context.PB6); 100 let sensor2 = g2.set_io3(context.PB6);
101 101
@@ -124,14 +124,14 @@ async fn main(_spawner: embassy_executor::Spawner) {
124 // ---------- setting up acquisition banks ---------- 124 // ---------- setting up acquisition banks ----------
125 // sensor0 and sensor1 belong to different TSC-groups, therefore we can acquire and 125 // sensor0 and sensor1 belong to different TSC-groups, therefore we can acquire and
126 // read them both in one go. 126 // read them both in one go.
127 let bank1 = touch_controller.create_acquisition_bank(TscAcquisitionBankPins { 127 let bank1 = touch_controller.create_acquisition_bank(AcquisitionBankPins {
128 g1_pin: Some(sensor0), 128 g1_pin: Some(sensor0),
129 g2_pin: Some(sensor1), 129 g2_pin: Some(sensor1),
130 ..Default::default() 130 ..Default::default()
131 }); 131 });
132 // `sensor1` and `sensor2` belongs to the same TSC-group, therefore we must make sure to 132 // `sensor1` and `sensor2` belongs to the same TSC-group, therefore we must make sure to
133 // acquire them one at the time. We do this by organizing them into different acquisition banks. 133 // acquire them one at the time. We do this by organizing them into different acquisition banks.
134 let bank2 = touch_controller.create_acquisition_bank(TscAcquisitionBankPins { 134 let bank2 = touch_controller.create_acquisition_bank(AcquisitionBankPins {
135 g2_pin: Some(sensor2), 135 g2_pin: Some(sensor2),
136 ..Default::default() 136 ..Default::default()
137 }); 137 });