From 31245568b5afc255d4287e9a6dea8fe62259e36c Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Mon, 17 May 2021 11:47:29 +0200 Subject: Add sequencing --- sw/eval-clock-cw-tx/src/main.rs | 11 ++++++++--- sw/eval-clock-cw-tx/src/state.rs | 3 +-- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'sw') diff --git a/sw/eval-clock-cw-tx/src/main.rs b/sw/eval-clock-cw-tx/src/main.rs index 0d70630..e2e5f61 100644 --- a/sw/eval-clock-cw-tx/src/main.rs +++ b/sw/eval-clock-cw-tx/src/main.rs @@ -68,6 +68,7 @@ struct SharedWithISR { cw_paddle_tip: gpio::gpiob::PB8>, cw_paddle_ring: gpio::gpiob::PB9>, ptt_out: gpio::gpiob::PB3>, + seq_switch: gpio::gpiob::PB5>, led : gpio::gpiob::PB14>, } @@ -137,6 +138,7 @@ fn main() -> ! { let (pa15, pb3, _pb4) = afio.mapr.disable_jtag(gpioa.pa15, gpiob.pb3, gpiob.pb4); let cw_key_out_n = pa15.into_push_pull_output_with_state(&mut gpioa.crh, gpio::State::High); let ptt_out = pb3.into_push_pull_output_with_state(&mut gpiob.crl, gpio::State::Low); + let seq_switch = gpiob.pb5.into_push_pull_output_with_state(&mut gpiob.crl, gpio::State::Low); let c1 = gpioa.pa6; let c2 = gpioa.pa7; @@ -195,7 +197,7 @@ fn main() -> ! { ui, cw_pwm, cw_keyer : cw::Keyer::new(12, TICKS_PER_SECOND), - cw_paddle_tip, cw_paddle_ring, ptt_out, led + cw_paddle_tip, cw_paddle_ring, ptt_out, seq_switch, led }; si_clock::SiClock::new(i2c_busmanager.acquire_i2c(), 0, shared.state.vfo_display()) @@ -328,6 +330,7 @@ fn TIM2() { let next_state = match shared.state.sequence_state { SequenceState::Rx => { shared.ptt_out.set_low().unwrap(); + shared.seq_switch.set_low().unwrap(); shared.led.set_high().unwrap(); if ptt { if shared.state.mode == Mode::FeldHell { @@ -342,7 +345,8 @@ fn TIM2() { } }, SequenceState::Switching(m) => { - shared.ptt_out.set_high().unwrap(); + shared.ptt_out.set_low().unwrap(); + shared.seq_switch.set_high().unwrap(); shared.led.set_low().unwrap(); if ptt { SequenceState::Tx(m) @@ -353,6 +357,7 @@ fn TIM2() { }, SequenceState::Tx(m) => { shared.ptt_out.set_high().unwrap(); + shared.seq_switch.set_high().unwrap(); shared.led.set_low().unwrap(); if ptt { SequenceState::Tx(m) @@ -389,7 +394,7 @@ fn TIM2() { }, } - const SWITCHING_DELAY : u32 = TICKS_PER_SECOND * 80 / 1000; + const SWITCHING_DELAY : u32 = TICKS_PER_SECOND * 40 / 1000; if shared.state.sequence_state != next_state && shared.last_sequence_state_change + SWITCHING_DELAY <= *ticks { shared.state.sequence_state = next_state; diff --git a/sw/eval-clock-cw-tx/src/state.rs b/sw/eval-clock-cw-tx/src/state.rs index cd89ede..87527bf 100644 --- a/sw/eval-clock-cw-tx/src/state.rs +++ b/sw/eval-clock-cw-tx/src/state.rs @@ -62,8 +62,7 @@ impl State { pub fn new() -> Self { State { ui_sel : UISelection::VFO, - //mode : Mode::CW(CWMode::StraightKey), - mode : Mode::FeldHell, + mode : Mode::CW(CWMode::StraightKey), vfo_sel : VFOSelection::A, vfo_a : INITIAL_VFO, vfo_b : INITIAL_VFO, -- cgit v1.2.3