aboutsummaryrefslogtreecommitdiffstats
path: root/sw/eval-clock-cw-tx/src/ui.rs
diff options
context:
space:
mode:
Diffstat (limited to 'sw/eval-clock-cw-tx/src/ui.rs')
-rw-r--r--sw/eval-clock-cw-tx/src/ui.rs18
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();