commit 7c413445786c12d90a28c3549613d70779f20216 from: Tracey Emery date: Tue Jan 10 16:52:47 2023 UTC add dac_set_wpm, fix formatting and whitespace commit - 3245e5d6762e1e1474b49cd333caef90f3b24a07 commit + 7c413445786c12d90a28c3549613d70779f20216 blob - a25257dd4ff78f91bc016e9a3c8e511970b9ea19 blob + 20fa53b2c51beed119ba8b73f594d2daf60c3d0a --- Morse.cpp +++ Morse.cpp @@ -89,7 +89,7 @@ Morse::Morse(uint8_t type, uint8_t the_pin, uint8_t th dac_wpm = the_wpm; dac_unit_t = UNIT_T(dac_wpm); dac_cw_config_t dac_cw_config; - // this func is broken and only gives 1/2 wave form + // this func is broken and only gives 1/2 wave form /* dac_cw_config.en_ch = channel; */ dac_cw_config.freq = 1000; @@ -187,7 +187,8 @@ Morse::gpio_tx(String tx) } void -Morse::gpio_set_wpm(uint8_t the_wpm) { +Morse::gpio_set_wpm(uint8_t the_wpm) +{ gpio_wpm = the_wpm; gpio_unit_t = UNIT_T(gpio_wpm); gpio_inited = 1; @@ -366,6 +367,14 @@ Morse::dac_cw_configure(dac_cw_config_t *dac_cw_config } void +Morse::dac_set_wpm(uint8_t the_wpm) +{ + dac_wpm = the_wpm; + dac_unit_t = UNIT_T(gpio_wpm); + dac_inited = 1; +} + +void dac_handle_chars(void) { dac_tx_current_millis = millis(); blob - fdaafea21a98533cc0b10b3ba8d2dc4808954a54 blob + 2f5aaa19c6026cc694b5b1857de9101c0ceca777 --- Morse.h +++ Morse.h @@ -43,6 +43,7 @@ Morse uint8_t dac_transmitting(void); void dac_tx(String tx); + void dac_set_wpm(uint8_t the_wpm); void dac_tx_stop(void); void dac_watchdog(void); void dac_cw_configure(dac_cw_config_t *); blob - d7e1680571efa3d68f0f2bbffaf68e444bb2a191 blob + a8a1bc39f26f23951ddaa1534fd1098c691d23e0 --- README.md +++ README.md @@ -42,9 +42,10 @@ To enable the Morse Code, two watchdogs are available: morse.gpio_watchdog(); morse_dac.dac_watchdog(); -To set the WPM for GPIO based Morse Code, use ```gpio_set_wpm``` function: +To set the WPM, two functions are available: - morse.gpio_set_wpm(new_wpm) + morse.gpio_set_wpm(WPM) + morse.dac_set_wpm(WPM) Example