From 3e8383a12212511e9ee719be4776dd78416aff37 Mon Sep 17 00:00:00 2001 From: Todd Stellanova Date: Mon, 13 Apr 2020 16:52:11 -0700 Subject: [PATCH] Switch to rtt/jlink for example debug output --- Cargo.toml | 5 ++--- examples/touchpad.rs | 7 ++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index de35665..12b8fd2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cst816s" -version = "0.1.3" +version = "0.1.4" authors = ["Todd Stellanova "] edition = "2018" description = "CST816S touchscreen driver for embedded hal / no_std" @@ -27,8 +27,7 @@ embedded-hal = {version ="0.2.3", features = ["unproven"] } [dev-dependencies] cortex-m-rt = "0.6.12" nrf52832-hal = {version = "0.8.1", default-features = false, features = ["xxAA-package", "rt"]} -panic-halt = "0.2.0" +panic-rtt-core = {version="0.1.0"} st7789 = { git = "https://github.com/tstellanova/st7789" } -#st7789 = { path = "../st7789"} shared-bus = {version = "0.1.4", features = ["cortexm"] } embedded-graphics = "0.6.0" diff --git a/examples/touchpad.rs b/examples/touchpad.rs index e1af9ff..f397764 100644 --- a/examples/touchpad.rs +++ b/examples/touchpad.rs @@ -1,7 +1,7 @@ #![no_std] #![no_main] -extern crate panic_halt; // you can put a breakpoint on `rust_begin_unwind` to catch panics +use panic_rtt_core::{self, rtt_init_print, rprintln}; use nrf52832_hal as p_hal; use p_hal::gpio::{GpioExt, Level}; @@ -36,6 +36,8 @@ const SCREEN_RADIUS: u32 = (MIN_SCREEN_DIM / 2) as u32; /// #[entry] fn main() -> ! { + rtt_init_print!(NoBlockTrim); + let cp = pac::CorePeripherals::take().unwrap(); let mut delay_source = Delay::new(cp.SYST); @@ -53,6 +55,8 @@ fn main() -> ! { let mut vibe = port0.p0_16.into_push_pull_output(Level::High).degrade(); pulse_vibe(&mut vibe, &mut delay_source, 10); + rprintln!("\r\n--- BEGIN ---"); + // internal i2c0 bus devices: BMA421 (accel), HRS3300 (hrs), CST816S (TouchPad) // BMA421-INT: P0.08 // TP-INT: P0.28 @@ -113,6 +117,7 @@ fn main() -> ! { if let Some(evt) = touchpad.read_one_touch_event(true) { refresh_count += 1; + rprintln!("{:?}",evt); draw_marker(&mut display, &evt, rand_color); let vibe_time = match evt.gesture {