diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2023-03-03 15:07:57 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2023-03-03 15:07:57 +0100 |
commit | aa999d4c4bdf4ede912f3aa833e7045ccfcca4b1 (patch) | |
tree | 76b114d14cbdec0cb8f74b06e17a0cc662b74fff /sw/eval-clock-cw-tx/src/ui.rs | |
parent | 9684038c8ed57e11177e9b786f38bdfcb8fa4c93 (diff) | |
download | picardy-aa999d4c4bdf4ede912f3aa833e7045ccfcca4b1.tar.gz picardy-aa999d4c4bdf4ede912f3aa833e7045ccfcca4b1.tar.bz2 picardy-aa999d4c4bdf4ede912f3aa833e7045ccfcca4b1.zip |
Update eval-clock-cw-tx prerequisites
Diffstat (limited to 'sw/eval-clock-cw-tx/src/ui.rs')
-rw-r--r-- | sw/eval-clock-cw-tx/src/ui.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sw/eval-clock-cw-tx/src/ui.rs b/sw/eval-clock-cw-tx/src/ui.rs index 809dd8d..9f3d985 100644 --- a/sw/eval-clock-cw-tx/src/ui.rs +++ b/sw/eval-clock-cw-tx/src/ui.rs @@ -28,13 +28,12 @@ use core::fmt; use core::fmt::Write; use stm32f1xx_hal::{ - delay::Delay, gpio::gpiob::*, gpio::gpioc::*, gpio::{Input, PullUp, Floating}, }; -use embedded_hal::digital::v2::InputPin; +use embedded_hal::blocking::delay::{DelayMs, DelayUs}; use hd44780_driver::HD44780; #[derive(PartialEq, Eq, Clone, Copy)] @@ -125,8 +124,8 @@ impl UI { fn read_buttons(&mut self) -> ButtonState { let mut buttons = ButtonState::default(); - let b0_low = self.btn0.is_low().unwrap(); - let b1_low = self.btn1.is_low().unwrap(); + let b0_low = self.btn0.is_low(); + let b1_low = self.btn1.is_low(); if b0_low && b1_low { buttons.e = true; @@ -138,15 +137,15 @@ impl UI { buttons.b = true; } - if self.btn2.is_low().unwrap() { + if self.btn2.is_low() { buttons.c = true; } - if self.btn3.is_low().unwrap() { + if self.btn3.is_low() { buttons.d = true; } - if self.btn_enc.is_low().unwrap() { + if self.btn_enc.is_low() { buttons.enc = true; } @@ -239,9 +238,10 @@ impl UI { } } -pub fn update_disp<T: hd44780_driver::bus::DataBus>(lcd: &mut HD44780<T>, state: &State, delay: &mut Delay) +pub fn update_disp<T: hd44780_driver::bus::DataBus, D: DelayUs<u16> + DelayMs<u8>>( + lcd: &mut HD44780<T>, state: &State, delay: &mut D) { - let mut string = arrayvec::ArrayString::<[_; 16]>::new(); + let mut string = arrayvec::ArrayString::<16>::new(); let disp_freq = state.vfo_display() as i32; write!(string, "{:<05}.{:<03} ", disp_freq / 1000, disp_freq % 1000).unwrap(); |