aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32u5/src/bin
diff options
context:
space:
mode:
authorEekle <[email protected]>2024-06-23 16:43:12 +0200
committerEekle <[email protected]>2024-06-23 16:43:12 +0200
commit2655426cd80b828593c8cd60930da3ebbd60e85c (patch)
tree4553255a9f6b854e7d60f609004a10a39b0c3fe0 /examples/stm32u5/src/bin
parentd5badb94d2098b0360ed1ab8015c37f819771445 (diff)
Add async wait to TSC
Diffstat (limited to 'examples/stm32u5/src/bin')
-rw-r--r--examples/stm32u5/src/bin/tsc.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/examples/stm32u5/src/bin/tsc.rs b/examples/stm32u5/src/bin/tsc.rs
index f5593d1c4..642bbeaca 100644
--- a/examples/stm32u5/src/bin/tsc.rs
+++ b/examples/stm32u5/src/bin/tsc.rs
@@ -2,10 +2,17 @@
2#![no_main] 2#![no_main]
3 3
4use defmt::*; 4use defmt::*;
5use embassy_stm32::tsc::{self, *}; 5use embassy_stm32::{
6 bind_interrupts,
7 tsc::{self, *},
8};
6use embassy_time::Timer; 9use embassy_time::Timer;
7use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
8 11
12bind_interrupts!(struct Irqs {
13 TSC => InterruptHandler<embassy_stm32::peripherals::TSC>;
14});
15
9#[cortex_m_rt::exception] 16#[cortex_m_rt::exception]
10unsafe fn HardFault(_: &cortex_m_rt::ExceptionFrame) -> ! { 17unsafe fn HardFault(_: &cortex_m_rt::ExceptionFrame) -> ! {
11 cortex_m::peripheral::SCB::sys_reset(); 18 cortex_m::peripheral::SCB::sys_reset();
@@ -47,6 +54,7 @@ async fn main(_spawner: embassy_executor::Spawner) {
47 54
48 let mut touch_controller = tsc::Tsc::new( 55 let mut touch_controller = tsc::Tsc::new(
49 context.TSC, 56 context.TSC,
57 Irqs,
50 Some(g1), 58 Some(g1),
51 Some(g2), 59 Some(g2),
52 None, 60 None,
@@ -67,7 +75,7 @@ async fn main(_spawner: embassy_executor::Spawner) {
67 let mut group_seven_val = 0; 75 let mut group_seven_val = 0;
68 info!("Starting touch_controller interface"); 76 info!("Starting touch_controller interface");
69 loop { 77 loop {
70 touch_controller.poll_for_acquisition(); 78 touch_controller.pend_for_acquisition().await;
71 touch_controller.discharge_io(true); 79 touch_controller.discharge_io(true);
72 Timer::after_millis(1).await; 80 Timer::after_millis(1).await;
73 81