commit 6ce605dadc0c98727692a7e203cee4b8b4bc3ba0 from: Tracey Emery date: Tue Jan 10 16:49:44 2023 UTC add ability to set wpm. based on ESP32 diff from OM0WT commit - f184fbbd2c17347a0dc002b978d5d3acbe7f2386 commit + 6ce605dadc0c98727692a7e203cee4b8b4bc3ba0 blob - 1e5abd295801fc012ad7a3d28850507bb916da90 blob + 8d0cf6264a75390d2c6750763bb66497ea287423 --- README.md +++ README.md @@ -27,6 +27,11 @@ Pro-sign Morse Code can be generated using backticks: cont char *led_morse = "Hello giant world `ar`"; +To set the WPM, two functions are available: + + gpio_set_wpm(WPM); + dac_set_wpm(WPM); + Example ------- blob - 2c5b61712cfc7cfd9c8b7fdca28b4a40f6130a82 blob + 4f16994f7341d6a40a13a9b0af187a0d276a1305 --- libmorse.cpp +++ libmorse.cpp @@ -185,6 +185,14 @@ Morse::gpio_tx(const char *morse) } } +void +Morse::gpio_set_wpm(uint8_t the_wpm) +{ + gpio_wpm = the_wpm; + gpio_unit_t = UNIT_T(gpio_wpm); + gpio_inited = 1; +} + static void gpio_stop(struct morse_cb_args *mcb) { @@ -374,6 +382,14 @@ Morse::dac_tx(const char *morse) } } +void +Morse::dac_set_wpm(uint8_t the_wpm) +{ + dac_wpm = the_wpm; + dac_unit_t = UNIT_T(gpio_wpm); + dac_inited = 1; +} + static void dac_stop(struct morse_cb_args *mcb) { blob - a64f4639497fe63ee41a64b6f74b541ce6216e77 blob + 75473afa70fee53444113e705734af9f957a2fff --- libmorse.h +++ libmorse.h @@ -34,11 +34,15 @@ Morse void gpio_tx(const char *); void gpio_tx_stop(void); + void gpio_set_wpm(uint8_t the_wpm); + uint8_t dac_get_transmitting(void); void dac_set_transmitting(void); void dac_tx(const char *); void dac_tx_stop(void); + + void dac_set_wpm(uint8_t the_wpm); }; enum