diff options
Diffstat (limited to 'sw/picardy/src/ui.rs')
-rw-r--r-- | sw/picardy/src/ui.rs | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/sw/picardy/src/ui.rs b/sw/picardy/src/ui.rs index ad85a3e..ad29722 100644 --- a/sw/picardy/src/ui.rs +++ b/sw/picardy/src/ui.rs @@ -30,16 +30,15 @@ use core::fmt::Write; use stm32f1xx_hal::{ prelude::*, adc, - rcc::{APB2, Clocks}, + rcc::Clocks, stm32::ADC1, - delay::Delay, gpio::gpioa::*, gpio::gpiob::*, gpio::gpioc::*, gpio::{Analog, 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)] @@ -124,13 +123,12 @@ impl UI { pb0: PB0<Input<Floating>>, pb1: PB1<Input<Floating>>, adc1: ADC1, - mut apb2: &mut APB2, clocks: &Clocks, pb12: PB12<Input<PullUp>>, pb13: PB13<Input<PullUp>>, pc15 : PC15<Input<PullUp>>) -> UI { - let adc1 = adc::Adc::adc1(adc1, &mut apb2, *clocks); + let adc1 = adc::Adc::adc1(adc1, *clocks); UI { btn0 : pb1, @@ -152,23 +150,23 @@ impl UI { //let mic_sw2_value: u16 = self.adc.read(&mut self.mic_sw2).unwrap(); buttons.ptt = mic_sw1_value < 500; - if self.btn0.is_low().unwrap() { + if self.btn0.is_low() { buttons.a = true; } - if self.btn1.is_low().unwrap() { + if self.btn1.is_low() { 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; } @@ -315,9 +313,9 @@ impl UI { } } -pub fn update_disp<T: hd44780_driver::bus::DataBus>(lcd: &mut HD44780<T>, state: &State, delay: &mut Delay, s_meter_value: u8, bfo_tune_fail: bool) +pub fn update_disp<T: hd44780_driver::bus::DataBus, D: DelayUs<u16> + DelayMs<u8>>(lcd: &mut HD44780<T>, state: &State, delay: &mut D, s_meter_value: u8, bfo_tune_fail: bool) { - let mut string = arrayvec::ArrayString::<[_; 16]>::new(); + let mut string = arrayvec::ArrayString::<16>::new(); /* Shorten the QRG to avoid using three digits for nothing */ let disp_freq = (state.vhf_qrg() as i32) - (VHF_BAND_EDGE as i32); |