straight key mode added
This commit is contained in:
parent
aa6b12470c
commit
b37c39bc36
4 changed files with 22 additions and 9 deletions
|
@ -8,11 +8,11 @@ Features (planned/done):
|
||||||
|
|
||||||
- [x] Iambic Paddle
|
- [x] Iambic Paddle
|
||||||
- [x] Keying modes: Iambic A, Iambic B
|
- [x] Keying modes: Iambic A, Iambic B
|
||||||
- [ ] Straight key
|
- [x] Straight key
|
||||||
- [x] Sidetone (buzzer)
|
- [x] Sidetone (buzzer)
|
||||||
- [x] CW out (straight key input on TRX)
|
- [x] CW out (straight key input on TRX)
|
||||||
|
- [ ] Setting speed with rotary knob
|
||||||
- [ ] WinKeyer emulation
|
- [ ] WinKeyer emulation
|
||||||
- [ ] Setting speed with rotary knob (left stop = speed setting from memory)
|
|
||||||
- [ ] LCD Display showing at least:
|
- [ ] LCD Display showing at least:
|
||||||
- Current speed
|
- Current speed
|
||||||
- Iambic mode
|
- Iambic mode
|
||||||
|
|
|
@ -51,6 +51,22 @@ void Keyer::run()
|
||||||
{
|
{
|
||||||
auto timestamp = get_absolute_time();
|
auto timestamp = get_absolute_time();
|
||||||
|
|
||||||
|
// If we are in Straight key mode …
|
||||||
|
if (m_mode == Mode::Straight) {
|
||||||
|
if (left_paddle_pressed()) {
|
||||||
|
gpio_put(LED_PIN, 1);
|
||||||
|
gpio_put(CW_OUT_PIN, 1);
|
||||||
|
m_buzzer.on(SIDETONE_FREQ);
|
||||||
|
} else {
|
||||||
|
gpio_put(LED_PIN, 0);
|
||||||
|
gpio_put(CW_OUT_PIN, 0);
|
||||||
|
m_buzzer.off();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we are in IambicA or IambicB-Mode …
|
||||||
switch (m_state) {
|
switch (m_state) {
|
||||||
case State::Wait:
|
case State::Wait:
|
||||||
if (left_paddle_pressed()) {
|
if (left_paddle_pressed()) {
|
||||||
|
@ -60,7 +76,7 @@ void Keyer::run()
|
||||||
m_keyNextIambicB = false;
|
m_keyNextIambicB = false;
|
||||||
m_state = State::Dah;
|
m_state = State::Dah;
|
||||||
} else {
|
} else {
|
||||||
if (m_mode == Mode::IAMBIC_B && m_keyNextIambicB) {
|
if (m_mode == Mode::IambicB && m_keyNextIambicB) {
|
||||||
if (m_previousState == State::Dit)
|
if (m_previousState == State::Dit)
|
||||||
m_state = State::Dah;
|
m_state = State::Dah;
|
||||||
else
|
else
|
||||||
|
|
|
@ -26,7 +26,7 @@ class Keyer final
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t m_wpm {18};
|
uint8_t m_wpm {18};
|
||||||
Mode m_mode {Mode::IAMBIC_B};
|
Mode m_mode {Mode::IambicB};
|
||||||
|
|
||||||
absolute_time_t m_keying_until {0};
|
absolute_time_t m_keying_until {0};
|
||||||
absolute_time_t m_pausing_until {0};
|
absolute_time_t m_pausing_until {0};
|
||||||
|
|
|
@ -4,14 +4,11 @@
|
||||||
|
|
||||||
const uint16_t MAGIC_NUMBER = 2;
|
const uint16_t MAGIC_NUMBER = 2;
|
||||||
|
|
||||||
enum class Mode : uint8_t {
|
enum class Mode : uint8_t { IambicA = 0, IambicB, Straight };
|
||||||
IAMBIC_A = 0,
|
|
||||||
IAMBIC_B,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Settings {
|
struct Settings {
|
||||||
uint16_t magic_number {MAGIC_NUMBER}; // Bytes: 2
|
uint16_t magic_number {MAGIC_NUMBER}; // Bytes: 2
|
||||||
Mode mode {Mode::IAMBIC_B}; // Bytes: 1
|
Mode mode {Mode::IambicB}; // Bytes: 1
|
||||||
uint8_t wpm {18}; // Bytes: 1
|
uint8_t wpm {18}; // Bytes: 1
|
||||||
uint8_t dummy[FLASH_PAGE_SIZE - 4] {0}; // Sum : 4
|
uint8_t dummy[FLASH_PAGE_SIZE - 4] {0}; // Sum : 4
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue