diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2021-05-17 11:47:29 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2021-05-17 11:47:29 +0200 |
commit | 31245568b5afc255d4287e9a6dea8fe62259e36c (patch) | |
tree | 10bab0b0384bdbb9dc4e6bd3aab2d33ccff13f9c /sw | |
parent | 03ad81d7afaea119df607b6e65f19bd5362fab39 (diff) | |
download | picardy-31245568b5afc255d4287e9a6dea8fe62259e36c.tar.gz picardy-31245568b5afc255d4287e9a6dea8fe62259e36c.tar.bz2 picardy-31245568b5afc255d4287e9a6dea8fe62259e36c.zip |
Add sequencing
Diffstat (limited to 'sw')
-rw-r--r-- | sw/eval-clock-cw-tx/src/main.rs | 11 | ||||
-rw-r--r-- | sw/eval-clock-cw-tx/src/state.rs | 3 |
2 files changed, 9 insertions, 5 deletions
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<gpio::Input<gpio::PullUp>>, cw_paddle_ring: gpio::gpiob::PB9<gpio::Input<gpio::PullUp>>, ptt_out: gpio::gpiob::PB3<gpio::Output<gpio::PushPull>>, + seq_switch: gpio::gpiob::PB5<gpio::Output<gpio::PushPull>>, led : gpio::gpiob::PB14<gpio::Output<gpio::PushPull>>, } @@ -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, |