aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/stm32u5/src/bin/tsc.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/examples/stm32u5/src/bin/tsc.rs b/examples/stm32u5/src/bin/tsc.rs
index f5593d1c4..eb15d275a 100644
--- a/examples/stm32u5/src/bin/tsc.rs
+++ b/examples/stm32u5/src/bin/tsc.rs
@@ -2,10 +2,15 @@
2#![no_main] 2#![no_main]
3 3
4use defmt::*; 4use defmt::*;
5use embassy_stm32::bind_interrupts;
5use embassy_stm32::tsc::{self, *}; 6use embassy_stm32::tsc::{self, *};
6use embassy_time::Timer; 7use embassy_time::Timer;
7use {defmt_rtt as _, panic_probe as _}; 8use {defmt_rtt as _, panic_probe as _};
8 9
10bind_interrupts!(struct Irqs {
11 TSC => InterruptHandler<embassy_stm32::peripherals::TSC>;
12});
13
9#[cortex_m_rt::exception] 14#[cortex_m_rt::exception]
10unsafe fn HardFault(_: &cortex_m_rt::ExceptionFrame) -> ! { 15unsafe fn HardFault(_: &cortex_m_rt::ExceptionFrame) -> ! {
11 cortex_m::peripheral::SCB::sys_reset(); 16 cortex_m::peripheral::SCB::sys_reset();
@@ -45,7 +50,7 @@ async fn main(_spawner: embassy_executor::Spawner) {
45 g7.set_io2(context.PE3, PinType::Sample); 50 g7.set_io2(context.PE3, PinType::Sample);
46 g7.set_io3(context.PE4, PinType::Channel); 51 g7.set_io3(context.PE4, PinType::Channel);
47 52
48 let mut touch_controller = tsc::Tsc::new( 53 let mut touch_controller = tsc::Tsc::new_async(
49 context.TSC, 54 context.TSC,
50 Some(g1), 55 Some(g1),
51 Some(g2), 56 Some(g2),
@@ -56,6 +61,7 @@ async fn main(_spawner: embassy_executor::Spawner) {
56 Some(g7), 61 Some(g7),
57 None, 62 None,
58 config, 63 config,
64 Irqs,
59 ); 65 );
60 66
61 touch_controller.discharge_io(true); 67 touch_controller.discharge_io(true);
@@ -67,7 +73,7 @@ async fn main(_spawner: embassy_executor::Spawner) {
67 let mut group_seven_val = 0; 73 let mut group_seven_val = 0;
68 info!("Starting touch_controller interface"); 74 info!("Starting touch_controller interface");
69 loop { 75 loop {
70 touch_controller.poll_for_acquisition(); 76 touch_controller.pend_for_acquisition().await;
71 touch_controller.discharge_io(true); 77 touch_controller.discharge_io(true);
72 Timer::after_millis(1).await; 78 Timer::after_millis(1).await;
73 79