aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32l0
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/stm32l0
parenta5b34a7980edaba5d8de05c68a48972dd9239f75 (diff)
Refactor TSC module: Remove redundant 'Tsc' prefixes for improved naming consistency
Diffstat (limited to 'examples/stm32l0')
-rw-r--r--examples/stm32l0/src/bin/tsc_async.rs4
-rw-r--r--examples/stm32l0/src/bin/tsc_blocking.rs6
-rw-r--r--examples/stm32l0/src/bin/tsc_multipin.rs10
3 files changed, 10 insertions, 10 deletions
diff --git a/examples/stm32l0/src/bin/tsc_async.rs b/examples/stm32l0/src/bin/tsc_async.rs
index cebe9712f..dae351c2e 100644
--- a/examples/stm32l0/src/bin/tsc_async.rs
+++ b/examples/stm32l0/src/bin/tsc_async.rs
@@ -58,8 +58,8 @@ async fn main(_spawner: embassy_executor::Spawner) {
58 let context = embassy_stm32::init(device_config); 58 let context = embassy_stm32::init(device_config);
59 59
60 let mut pin_group: PinGroupWithRoles<peripherals::TSC, G1> = PinGroupWithRoles::default(); 60 let mut pin_group: PinGroupWithRoles<peripherals::TSC, G1> = PinGroupWithRoles::default();
61 pin_group.set_io1::<tsc_pin_roles::Sample>(context.PA0); 61 pin_group.set_io1::<tsc::pin_roles::Sample>(context.PA0);
62 let sensor = pin_group.set_io2::<tsc_pin_roles::Channel>(context.PA1); 62 let sensor = pin_group.set_io2::<tsc::pin_roles::Channel>(context.PA1);
63 63
64 let tsc_conf = Config { 64 let tsc_conf = Config {
65 ct_pulse_high_length: ChargeTransferPulseCycle::_4, 65 ct_pulse_high_length: ChargeTransferPulseCycle::_4,
diff --git a/examples/stm32l0/src/bin/tsc_blocking.rs b/examples/stm32l0/src/bin/tsc_blocking.rs
index 65203925c..e1f24639b 100644
--- a/examples/stm32l0/src/bin/tsc_blocking.rs
+++ b/examples/stm32l0/src/bin/tsc_blocking.rs
@@ -69,8 +69,8 @@ async fn main(_spawner: embassy_executor::Spawner) {
69 }; 69 };
70 70
71 let mut g1: PinGroupWithRoles<peripherals::TSC, G1> = PinGroupWithRoles::default(); 71 let mut g1: PinGroupWithRoles<peripherals::TSC, G1> = PinGroupWithRoles::default();
72 g1.set_io1::<tsc_pin_roles::Sample>(context.PA0); 72 g1.set_io1::<tsc::pin_roles::Sample>(context.PA0);
73 let tsc_sensor = g1.set_io2::<tsc_pin_roles::Channel>(context.PA1); 73 let tsc_sensor = g1.set_io2::<tsc::pin_roles::Channel>(context.PA1);
74 74
75 let pin_groups: PinGroups<peripherals::TSC> = PinGroups { 75 let pin_groups: PinGroups<peripherals::TSC> = PinGroups {
76 g1: Some(g1.pin_group), 76 g1: Some(g1.pin_group),
@@ -123,7 +123,7 @@ const MAX_GROUP_STATUS_READ_ATTEMPTS: usize = 10;
123// attempt to read group status and delay when still ongoing 123// attempt to read group status and delay when still ongoing
124async fn read_touch_value( 124async fn read_touch_value(
125 touch_controller: &mut tsc::Tsc<'_, peripherals::TSC, mode::Blocking>, 125 touch_controller: &mut tsc::Tsc<'_, peripherals::TSC, mode::Blocking>,
126 sensor_pin: TscIOPin, 126 sensor_pin: tsc::IOPin,
127) -> Option<u16> { 127) -> Option<u16> {
128 for _ in 0..MAX_GROUP_STATUS_READ_ATTEMPTS { 128 for _ in 0..MAX_GROUP_STATUS_READ_ATTEMPTS {
129 match touch_controller.group_get_status(sensor_pin.group()) { 129 match touch_controller.group_get_status(sensor_pin.group()) {
diff --git a/examples/stm32l0/src/bin/tsc_multipin.rs b/examples/stm32l0/src/bin/tsc_multipin.rs
index 85feb50b0..bf75a5657 100644
--- a/examples/stm32l0/src/bin/tsc_multipin.rs
+++ b/examples/stm32l0/src/bin/tsc_multipin.rs
@@ -78,7 +78,7 @@ const SENSOR_THRESHOLD: u16 = 35;
78 78
79async fn acquire_sensors( 79async fn acquire_sensors(
80 touch_controller: &mut Tsc<'static, peripherals::TSC, mode::Async>, 80 touch_controller: &mut Tsc<'static, peripherals::TSC, mode::Async>,
81 tsc_acquisition_bank: &TscAcquisitionBank, 81 tsc_acquisition_bank: &AcquisitionBank,
82) { 82) {
83 touch_controller.set_active_channels_mask(tsc_acquisition_bank.mask()); 83 touch_controller.set_active_channels_mask(tsc_acquisition_bank.mask());
84 touch_controller.start(); 84 touch_controller.start();
@@ -95,11 +95,11 @@ async fn main(_spawner: embassy_executor::Spawner) {
95 95
96 // ---------- initial configuration of TSC ---------- 96 // ---------- initial configuration of TSC ----------
97 let mut pin_group1: PinGroupWithRoles<peripherals::TSC, G1> = PinGroupWithRoles::default(); 97 let mut pin_group1: PinGroupWithRoles<peripherals::TSC, G1> = PinGroupWithRoles::default();
98 pin_group1.set_io1::<tsc_pin_roles::Sample>(context.PA0); 98 pin_group1.set_io1::<tsc::pin_roles::Sample>(context.PA0);
99 let tsc_sensor0 = pin_group1.set_io2(context.PA1); 99 let tsc_sensor0 = pin_group1.set_io2(context.PA1);
100 100
101 let mut pin_group5: PinGroupWithRoles<peripherals::TSC, G5> = PinGroupWithRoles::default(); 101 let mut pin_group5: PinGroupWithRoles<peripherals::TSC, G5> = PinGroupWithRoles::default();
102 pin_group5.set_io1::<tsc_pin_roles::Sample>(context.PB3); 102 pin_group5.set_io1::<tsc::pin_roles::Sample>(context.PB3);
103 let tsc_sensor1 = pin_group5.set_io2(context.PB4); 103 let tsc_sensor1 = pin_group5.set_io2(context.PB4);
104 let tsc_sensor2 = pin_group5.set_io3(context.PB6); 104 let tsc_sensor2 = pin_group5.set_io3(context.PB6);
105 105
@@ -128,14 +128,14 @@ async fn main(_spawner: embassy_executor::Spawner) {
128 // ---------- setting up acquisition banks ---------- 128 // ---------- setting up acquisition banks ----------
129 // sensor0 and sensor1 in this example belong to different TSC-groups, 129 // sensor0 and sensor1 in this example belong to different TSC-groups,
130 // therefore we can acquire and read them both in one go. 130 // therefore we can acquire and read them both in one go.
131 let bank1 = touch_controller.create_acquisition_bank(TscAcquisitionBankPins { 131 let bank1 = touch_controller.create_acquisition_bank(AcquisitionBankPins {
132 g1_pin: Some(tsc_sensor0), 132 g1_pin: Some(tsc_sensor0),
133 g5_pin: Some(tsc_sensor1), 133 g5_pin: Some(tsc_sensor1),
134 ..Default::default() 134 ..Default::default()
135 }); 135 });
136 // `sensor1` and `sensor2` belongs to the same TSC-group, therefore we must make sure to 136 // `sensor1` and `sensor2` belongs to the same TSC-group, therefore we must make sure to
137 // acquire them one at the time. Therefore, we organize them into different acquisition banks. 137 // acquire them one at the time. Therefore, we organize them into different acquisition banks.
138 let bank2 = touch_controller.create_acquisition_bank(TscAcquisitionBankPins { 138 let bank2 = touch_controller.create_acquisition_bank(AcquisitionBankPins {
139 g5_pin: Some(tsc_sensor2), 139 g5_pin: Some(tsc_sensor2),
140 ..Default::default() 140 ..Default::default()
141 }); 141 });