diff --git a/k3ng_keyer/k3ng_keyer.ino b/k3ng_keyer/k3ng_keyer.ino index 3c0df58..da1e5e8 100644 --- a/k3ng_keyer/k3ng_keyer.ino +++ b/k3ng_keyer/k3ng_keyer.ino @@ -1449,6 +1449,12 @@ If you offer a hardware kit using this software, show your appreciation by sendi #include "src/buttonarray/buttonarray.h" #endif +#if defined(FEATURE_SIDETONE_NEWTONE) && !defined(OPTION_SIDETONE_DIGITAL_OUTPUT_NO_SQUARE_WAVE) + #include + #define tone NewTone + #define noTone noNewTone +#endif //FEATURE_SIDETONE_NEWTONE + #if defined(FEATURE_SLEEP) #include // It should be different library for ARM sp5iou #endif diff --git a/k3ng_keyer/keyer_features_and_options.h b/k3ng_keyer/keyer_features_and_options.h index e512cbb..d0a6693 100644 --- a/k3ng_keyer/keyer_features_and_options.h +++ b/k3ng_keyer/keyer_features_and_options.h @@ -12,6 +12,7 @@ // #define FEATURE_TRAINING_COMMAND_LINE_INTERFACE // #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes // #define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). +// #define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home // #define FEATURE_SERIAL_HELP // #define FEATURE_HELL // #define FEATURE_PS2_KEYBOARD // Use a PS2 keyboard to send code - Change keyboard layout (non-US) in K3NG_PS2Keyboard.h. Additional options below. diff --git a/k3ng_keyer/keyer_features_and_options_fk_10.h b/k3ng_keyer/keyer_features_and_options_fk_10.h index 793d4dd..94e301e 100644 --- a/k3ng_keyer/keyer_features_and_options_fk_10.h +++ b/k3ng_keyer/keyer_features_and_options_fk_10.h @@ -30,6 +30,7 @@ #define FEATURE_TRAINING_COMMAND_LINE_INTERFACE // #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes // #define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). +// #define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home #define FEATURE_SERIAL_HELP #define FEATURE_HELL // #define FEATURE_PS2_KEYBOARD // Use a PS2 keyboard to send code - Change keyboard layout (non-US) in K3NG_PS2Keyboard.h. Additional options below. diff --git a/k3ng_keyer/keyer_features_and_options_fk_11.h b/k3ng_keyer/keyer_features_and_options_fk_11.h index 883cc24..224b932 100644 --- a/k3ng_keyer/keyer_features_and_options_fk_11.h +++ b/k3ng_keyer/keyer_features_and_options_fk_11.h @@ -13,6 +13,7 @@ #define FEATURE_TRAINING_COMMAND_LINE_INTERFACE // #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes // #define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). +// #define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home #define FEATURE_SERIAL_HELP #define FEATURE_HELL // #define FEATURE_PS2_KEYBOARD // Use a PS2 keyboard to send code - Change keyboard layout (non-US) in K3NG_PS2Keyboard.h. Additional options below. diff --git a/k3ng_keyer/keyer_features_and_options_generic_STM32F103C.h b/k3ng_keyer/keyer_features_and_options_generic_STM32F103C.h old mode 100755 new mode 100644 index 17f1b12..01fd56c --- a/k3ng_keyer/keyer_features_and_options_generic_STM32F103C.h +++ b/k3ng_keyer/keyer_features_and_options_generic_STM32F103C.h @@ -19,6 +19,7 @@ Generic STM32F103C "Blue Pill" // #define FEATURE_TRAINING_COMMAND_LINE_INTERFACE // #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes // #define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). +// #define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home #define FEATURE_SERIAL_HELP #define FEATURE_HELL // #define FEATURE_PS2_KEYBOARD // Use a PS2 keyboard to send code - Change keyboard layout (non-US) in K3NG_PS2Keyboard.h. Additional options below. diff --git a/k3ng_keyer/keyer_features_and_options_iz3gme.h b/k3ng_keyer/keyer_features_and_options_iz3gme.h index c5b0e8d..5832650 100644 --- a/k3ng_keyer/keyer_features_and_options_iz3gme.h +++ b/k3ng_keyer/keyer_features_and_options_iz3gme.h @@ -12,6 +12,7 @@ // #define FEATURE_TRAINING_COMMAND_LINE_INTERFACE #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes // #define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). +// #define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home #define FEATURE_SERIAL_HELP // #define FEATURE_HELL // #define FEATURE_PS2_KEYBOARD // Use a PS2 keyboard to send code - Change keyboard layout (non-US) in K3NG_PS2Keyboard.h. Additional options below. @@ -120,4 +121,4 @@ // #define OPTION_DISPLAY_MEMORY_CONTENTS_COMMAND_MODE //Added in version 2020.07.04.01 -//#define OPTION_WINKEY_PROSIGN_COMPATIBILITY // Additional character mappings to support K1EL Winkey emulation prosigns \ No newline at end of file +//#define OPTION_WINKEY_PROSIGN_COMPATIBILITY // Additional character mappings to support K1EL Winkey emulation prosigns diff --git a/k3ng_keyer/keyer_features_and_options_k5bcq.h b/k3ng_keyer/keyer_features_and_options_k5bcq.h index 381d778..d2b8c0f 100644 --- a/k3ng_keyer/keyer_features_and_options_k5bcq.h +++ b/k3ng_keyer/keyer_features_and_options_k5bcq.h @@ -12,6 +12,7 @@ // #define FEATURE_TRAINING_COMMAND_LINE_INTERFACE // #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes // #define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). +// #define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home #define FEATURE_SERIAL_HELP #define FEATURE_HELL #define FEATURE_PS2_KEYBOARD // Use a PS2 keyboard to send code - Change keyboard layout (non-US) in K3NG_PS2Keyboard.h. Additional options below. diff --git a/k3ng_keyer/keyer_features_and_options_maple_mini.h b/k3ng_keyer/keyer_features_and_options_maple_mini.h index 89b27cf..679e6a4 100644 --- a/k3ng_keyer/keyer_features_and_options_maple_mini.h +++ b/k3ng_keyer/keyer_features_and_options_maple_mini.h @@ -26,6 +26,7 @@ // #define FEATURE_TRAINING_COMMAND_LINE_INTERFACE #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes // #define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). +// #define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home #define FEATURE_SERIAL_HELP #define FEATURE_HELL // #define FEATURE_PS2_KEYBOARD // Use a PS2 keyboard to send code - Change keyboard layout (non-US) in K3NG_PS2Keyboard.h. Additional options below. diff --git a/k3ng_keyer/keyer_features_and_options_megakeyer.h b/k3ng_keyer/keyer_features_and_options_megakeyer.h index 974a183..77320aa 100644 --- a/k3ng_keyer/keyer_features_and_options_megakeyer.h +++ b/k3ng_keyer/keyer_features_and_options_megakeyer.h @@ -16,6 +16,7 @@ #define FEATURE_TRAINING_COMMAND_LINE_INTERFACE // #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes // #define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). +// #define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home #define FEATURE_SERIAL_HELP // #define FEATURE_HELL #define FEATURE_PS2_KEYBOARD // Use a PS2 keyboard to send code - Change keyboard layout (non-US) in K3NG_PS2Keyboard.h. Additional options below. @@ -124,4 +125,4 @@ // #define OPTION_DISPLAY_MEMORY_CONTENTS_COMMAND_MODE //Added in version 2020.07.04.01 -//#define OPTION_WINKEY_PROSIGN_COMPATIBILITY // Additional character mappings to support K1EL Winkey emulation prosigns \ No newline at end of file +//#define OPTION_WINKEY_PROSIGN_COMPATIBILITY // Additional character mappings to support K1EL Winkey emulation prosigns diff --git a/k3ng_keyer/keyer_features_and_options_mortty.h b/k3ng_keyer/keyer_features_and_options_mortty.h old mode 100755 new mode 100644 index 6332ac0..b55fd81 --- a/k3ng_keyer/keyer_features_and_options_mortty.h +++ b/k3ng_keyer/keyer_features_and_options_mortty.h @@ -12,6 +12,7 @@ // #define FEATURE_TRAINING_COMMAND_LINE_INTERFACE // #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes // #define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). +// #define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home // #define FEATURE_SERIAL_HELP // #define FEATURE_HELL // #define FEATURE_PS2_KEYBOARD // Use a PS2 keyboard to send code - Change keyboard layout (non-US) in K3NG_PS2Keyboard.h. Additional options below. diff --git a/k3ng_keyer/keyer_features_and_options_mortty_regular.h b/k3ng_keyer/keyer_features_and_options_mortty_regular.h old mode 100755 new mode 100644 index 61b8167..2893677 --- a/k3ng_keyer/keyer_features_and_options_mortty_regular.h +++ b/k3ng_keyer/keyer_features_and_options_mortty_regular.h @@ -12,6 +12,7 @@ // #define FEATURE_TRAINING_COMMAND_LINE_INTERFACE // #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes // #define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). +// #define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home // #define FEATURE_SERIAL_HELP // #define FEATURE_HELL // #define FEATURE_PS2_KEYBOARD // Use a PS2 keyboard to send code - Change keyboard layout (non-US) in K3NG_PS2Keyboard.h. Additional options below. @@ -108,4 +109,4 @@ // #define OPTION_DISPLAY_MEMORY_CONTENTS_COMMAND_MODE //Added in version 2020.07.04.01 -//#define OPTION_WINKEY_PROSIGN_COMPATIBILITY // Additional character mappings to support K1EL Winkey emulation prosigns \ No newline at end of file +//#define OPTION_WINKEY_PROSIGN_COMPATIBILITY // Additional character mappings to support K1EL Winkey emulation prosigns diff --git a/k3ng_keyer/keyer_features_and_options_mortty_regular_with_potentiometer.h b/k3ng_keyer/keyer_features_and_options_mortty_regular_with_potentiometer.h old mode 100755 new mode 100644 index e26b015..d8e3a4e --- a/k3ng_keyer/keyer_features_and_options_mortty_regular_with_potentiometer.h +++ b/k3ng_keyer/keyer_features_and_options_mortty_regular_with_potentiometer.h @@ -12,6 +12,7 @@ // #define FEATURE_TRAINING_COMMAND_LINE_INTERFACE #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes // #define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). +// #define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home // #define FEATURE_SERIAL_HELP // #define FEATURE_HELL // #define FEATURE_PS2_KEYBOARD // Use a PS2 keyboard to send code - Change keyboard layout (non-US) in K3NG_PS2Keyboard.h. Additional options below. @@ -108,4 +109,4 @@ // #define OPTION_DISPLAY_MEMORY_CONTENTS_COMMAND_MODE //Added in version 2020.07.04.01 -//#define OPTION_WINKEY_PROSIGN_COMPATIBILITY // Additional character mappings to support K1EL Winkey emulation prosigns \ No newline at end of file +//#define OPTION_WINKEY_PROSIGN_COMPATIBILITY // Additional character mappings to support K1EL Winkey emulation prosigns diff --git a/k3ng_keyer/keyer_features_and_options_mortty_so2r.h b/k3ng_keyer/keyer_features_and_options_mortty_so2r.h old mode 100755 new mode 100644 index 61b8167..2893677 --- a/k3ng_keyer/keyer_features_and_options_mortty_so2r.h +++ b/k3ng_keyer/keyer_features_and_options_mortty_so2r.h @@ -12,6 +12,7 @@ // #define FEATURE_TRAINING_COMMAND_LINE_INTERFACE // #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes // #define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). +// #define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home // #define FEATURE_SERIAL_HELP // #define FEATURE_HELL // #define FEATURE_PS2_KEYBOARD // Use a PS2 keyboard to send code - Change keyboard layout (non-US) in K3NG_PS2Keyboard.h. Additional options below. @@ -108,4 +109,4 @@ // #define OPTION_DISPLAY_MEMORY_CONTENTS_COMMAND_MODE //Added in version 2020.07.04.01 -//#define OPTION_WINKEY_PROSIGN_COMPATIBILITY // Additional character mappings to support K1EL Winkey emulation prosigns \ No newline at end of file +//#define OPTION_WINKEY_PROSIGN_COMPATIBILITY // Additional character mappings to support K1EL Winkey emulation prosigns diff --git a/k3ng_keyer/keyer_features_and_options_nanokeyer_rev_b.h b/k3ng_keyer/keyer_features_and_options_nanokeyer_rev_b.h index effaf6a..bb079c7 100644 --- a/k3ng_keyer/keyer_features_and_options_nanokeyer_rev_b.h +++ b/k3ng_keyer/keyer_features_and_options_nanokeyer_rev_b.h @@ -11,6 +11,7 @@ //#define FEATURE_TRAINING_COMMAND_LINE_INTERFACE #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes //#define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). +//#define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home //#define FEATURE_SERIAL_HELP //#define FEATURE_HELL //#define FEATURE_PS2_KEYBOARD // Change keyboard layout (non-US in K3NG_PS2Keyboard.h). Additional options below. diff --git a/k3ng_keyer/keyer_features_and_options_open_interface.h b/k3ng_keyer/keyer_features_and_options_open_interface.h index c792c88..4e7e077 100644 --- a/k3ng_keyer/keyer_features_and_options_open_interface.h +++ b/k3ng_keyer/keyer_features_and_options_open_interface.h @@ -13,6 +13,7 @@ #define FEATURE_TRAINING_COMMAND_LINE_INTERFACE #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes // #define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). +// #define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home #define FEATURE_SERIAL_HELP //#define FEATURE_HELL //#define FEATURE_PS2_KEYBOARD // Use a PS2 keyboard to send code - Change keyboard layout (non-US) in K3NG_PS2Keyboard.h. Additional options below. diff --git a/k3ng_keyer/keyer_features_and_options_opencwkeyer_mk2.h b/k3ng_keyer/keyer_features_and_options_opencwkeyer_mk2.h index dc4d3a9..304e3de 100644 --- a/k3ng_keyer/keyer_features_and_options_opencwkeyer_mk2.h +++ b/k3ng_keyer/keyer_features_and_options_opencwkeyer_mk2.h @@ -12,6 +12,7 @@ // #define FEATURE_TRAINING_COMMAND_LINE_INTERFACE #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes // #define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). +// #define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home // #define FEATURE_SERIAL_HELP // #define FEATURE_HELL // #define FEATURE_PS2_KEYBOARD // Use a PS2 keyboard to send code - Change keyboard layout (non-US) in K3NG_PS2Keyboard.h. Additional options below. @@ -120,4 +121,4 @@ // #define OPTION_DISPLAY_MEMORY_CONTENTS_COMMAND_MODE //Added in version 2020.07.04.01 -//#define OPTION_WINKEY_PROSIGN_COMPATIBILITY // Additional character mappings to support K1EL Winkey emulation prosigns \ No newline at end of file +//#define OPTION_WINKEY_PROSIGN_COMPATIBILITY // Additional character mappings to support K1EL Winkey emulation prosigns diff --git a/k3ng_keyer/keyer_features_and_options_test.h b/k3ng_keyer/keyer_features_and_options_test.h index a12ec51..5952421 100644 --- a/k3ng_keyer/keyer_features_and_options_test.h +++ b/k3ng_keyer/keyer_features_and_options_test.h @@ -23,6 +23,7 @@ // #define FEATURE_TRAINING_COMMAND_LINE_INTERFACE // #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes // #define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). +// #define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home // #define FEATURE_SERIAL_HELP // #define FEATURE_HELL // #define FEATURE_PS2_KEYBOARD // Use a PS2 keyboard to send code - Change keyboard layout (non-US) in K3NG_PS2Keyboard.h. Additional options below. diff --git a/k3ng_keyer/keyer_features_and_options_test_everything.h b/k3ng_keyer/keyer_features_and_options_test_everything.h index c5900ee..a04867e 100644 --- a/k3ng_keyer/keyer_features_and_options_test_everything.h +++ b/k3ng_keyer/keyer_features_and_options_test_everything.h @@ -11,6 +11,7 @@ #define FEATURE_TRAINING_COMMAND_LINE_INTERFACE #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes #define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). +#define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home #define FEATURE_SERIAL_HELP #define FEATURE_HELL #define FEATURE_PS2_KEYBOARD // Use a PS2 keyboard to send code - Change keyboard layout (non-US) in K3NG_PS2Keyboard.h. Additional options below. diff --git a/k3ng_keyer/keyer_features_and_options_tinykeyer.h b/k3ng_keyer/keyer_features_and_options_tinykeyer.h old mode 100755 new mode 100644 index bbeb548..eb5807d --- a/k3ng_keyer/keyer_features_and_options_tinykeyer.h +++ b/k3ng_keyer/keyer_features_and_options_tinykeyer.h @@ -12,6 +12,7 @@ //#define FEATURE_BEACON // Go into beacon mode if paddle_left pin is LOW at boot up //#define FEATURE_BEACON_SETTING // Go into beacon mode at boot up if EEPROM setting is enabled (\_ CLI Command) //#define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). +//#define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home //#define FEATURE_DEAD_OP_WATCHDOG #define FEATURE_AUTOSPACE //#define FEATURE_FARNSWORTH diff --git a/k3ng_keyer/keyer_features_and_options_yaacwk.h b/k3ng_keyer/keyer_features_and_options_yaacwk.h index 927d2be..299b636 100644 --- a/k3ng_keyer/keyer_features_and_options_yaacwk.h +++ b/k3ng_keyer/keyer_features_and_options_yaacwk.h @@ -15,6 +15,7 @@ //#define FEATURE_TRAINING_COMMAND_LINE_INTERFACE #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes //#define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). +//#define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home //#define FEATURE_SERIAL_HELP //#define FEATURE_HELL #define FEATURE_PS2_KEYBOARD // Use a PS2 keyboard to send code - Change keyboard layout (non-US) in K3NG_PS2Keyboard.h. Additional options below. @@ -117,4 +118,4 @@ // #define OPTION_DISPLAY_MEMORY_CONTENTS_COMMAND_MODE //Added in version 2020.07.04.01 -//#define OPTION_WINKEY_PROSIGN_COMPATIBILITY // Additional character mappings to support K1EL Winkey emulation prosigns \ No newline at end of file +//#define OPTION_WINKEY_PROSIGN_COMPATIBILITY // Additional character mappings to support K1EL Winkey emulation prosigns diff --git a/k3ng_keyer/keyer_features_and_options_yccc_so2r_mini.h b/k3ng_keyer/keyer_features_and_options_yccc_so2r_mini.h index 8b29d9d..940ea19 100644 --- a/k3ng_keyer/keyer_features_and_options_yccc_so2r_mini.h +++ b/k3ng_keyer/keyer_features_and_options_yccc_so2r_mini.h @@ -18,6 +18,7 @@ // #define FEATURE_TRAINING_COMMAND_LINE_INTERFACE // #define FEATURE_POTENTIOMETER // do not enable unless you have a potentiometer connected, otherwise noise will falsely trigger wpm changes // #define FEATURE_SIDETONE_SWITCH // adds switch control for the sidetone output. requires an external toggle switch (assigned to an arduino pin - see keyer_pin_settings.h). +// #define FEATURE_SIDETONE_NEWTONE // Use the NewTone library, ~1k smaller code size than the standard tone library. Uses timer1 (pins 9 or 10) https://bitbucket.org/teckel12/arduino-new-tone/wiki/Home // #define FEATURE_SERIAL_HELP // #define FEATURE_HELL // #define FEATURE_PS2_KEYBOARD // Use a PS2 keyboard to send code - Change keyboard layout (non-US) in K3NG_PS2Keyboard.h. Additional options below. diff --git a/libraries/NewTone/NewTone.cpp b/libraries/NewTone/NewTone.cpp new file mode 100644 index 0000000..31c3c8f --- /dev/null +++ b/libraries/NewTone/NewTone.cpp @@ -0,0 +1,49 @@ +// --------------------------------------------------------------------------- +// Created by Tim Eckel - teckel@leethost.com +// Copyright 2013 License: GNU GPL v3 http://www.gnu.org/licenses/gpl-3.0.html +// +// See "NewTone.h" for purpose, syntax, version history, links, and more. +// --------------------------------------------------------------------------- + +#include "NewTone.h" + +unsigned long _nt_time; // Time note should end. +uint8_t _pinMask = 0; // Pin bitmask. +volatile uint8_t *_pinOutput; // Output port register + +void NewTone(uint8_t pin, unsigned long frequency, unsigned long length) { + uint8_t prescaler = _BV(CS10); // Try using prescaler 1 first. + unsigned long top = F_CPU / frequency / 4 - 1; // Calculate the top. + if (top > 65535) { // If not in the range for prescaler 1, use prescaler 256 (61 Hz and lower @ 16 MHz). + prescaler = _BV(CS12); // Set the 256 prescaler bit. + top = top / 256 - 1; // Calculate the top using prescaler 256. + } + + if (length > 0) _nt_time = millis() + length; else _nt_time = 0xFFFFFFFF; // Set when the note should end, or play "forever". + + if (_pinMask == 0) { + _pinMask = digitalPinToBitMask(pin); // Get the port register bitmask for the pin. + _pinOutput = portOutputRegister(digitalPinToPort(pin)); // Get the output port register for the pin. + uint8_t *_pinMode = (uint8_t *) portModeRegister(digitalPinToPort(pin)); // Get the port mode register for the pin. + *_pinMode |= _pinMask; // Set the pin to Output mode. + } + + ICR1 = top; // Set the top. + if (TCNT1 > top) TCNT1 = top; // Counter over the top, put within range. + TCCR1B = _BV(WGM13) | prescaler; // Set PWM, phase and frequency corrected (ICR1) and prescaler. + TCCR1A = _BV(COM1B0); + TIMSK1 |= _BV(OCIE1A); // Activate the timer interrupt. +} + +void noNewTone(uint8_t pin) { + TIMSK1 &= ~_BV(OCIE1A); // Remove the timer interrupt. + TCCR1B = _BV(CS11); // Default clock prescaler of 8. + TCCR1A = _BV(WGM10); // Set to defaults so PWM can work like normal (PWM, phase corrected, 8bit). + *_pinOutput &= ~_pinMask; // Set pin to LOW. + _pinMask = 0; // Flag so we know note is no longer playing. +} + +ISR(TIMER1_COMPA_vect) { // Timer interrupt vector. + if (millis() >= _nt_time) noNewTone(); // Check to see if it's time for the note to end. + *_pinOutput ^= _pinMask; // Toggle the pin state. +} \ No newline at end of file diff --git a/libraries/NewTone/NewTone.h b/libraries/NewTone/NewTone.h new file mode 100644 index 0000000..2bc3a61 --- /dev/null +++ b/libraries/NewTone/NewTone.h @@ -0,0 +1,50 @@ +// --------------------------------------------------------------------------- +// NewTone Library - v1.0 - 01/20/2013 +// +// AUTHOR/LICENSE: +// Created by Tim Eckel - teckel@leethost.com +// Copyright 2013 License: GNU GPL v3 http://www.gnu.org/licenses/gpl-3.0.html +// +// LINKS: +// Project home: http://code.google.com/p/arduino-new-tone/ +// Blog: http://arduino.cc/forum/index.php/XXX +// +// DISCLAIMER: +// This software is furnished "as is", without technical support, and with no +// warranty, express or implied, as to its usefulness for any purpose. +// +// PURPOSE: +// Almost 1,300 bytes smaller code size than the Tone library. Faster execution +// time. Exclusive use of port registers for fastest and smallest code. Higher +// quality sound output than tone library. Plug-in replacement for Tone. Uses +// timer 1 which may free up conflicts with the tone library. +// +// SYNTAX: +// NewTone( pin, frequency [, length ] ) - Play a note on pin at frequency in Hz. +// Parameters: +// * pin - Pin speaker is wired to (other wire to ground, be sure to add an inline 100 ohm resistor). +// * frequency - Play the specified frequency indefinitely, turn off with noNewTone(). +// * length - [optional] Set the length to play in milliseconds. (default: 0 [forever], range: 0 to 2^32-1) +// noNewTone(pin) - Stop playing note (pin is optional, will always stop playing on pin that was last used). +// +// HISTORY: +// 01/20/2013 v1.0 - Initial release. +// +// --------------------------------------------------------------------------- + +#ifndef NewTone_h + #define NewTone_h + + #if defined(ARDUINO) && ARDUINO >= 100 + #include + #else + #include + #endif + + #if defined(__AVR_ATmega8__) || defined(__AVR_ATmega128__) + #define TIMSK1 TIMSK + #endif + + void NewTone(uint8_t pin, unsigned long frequency, unsigned long length = 0); + void noNewTone(uint8_t pin = 0); +#endif \ No newline at end of file diff --git a/libraries/NewTone/keywords.txt b/libraries/NewTone/keywords.txt new file mode 100644 index 0000000..7e44a58 --- /dev/null +++ b/libraries/NewTone/keywords.txt @@ -0,0 +1,18 @@ +################################### +# Syntax Coloring Map For NewPing +################################### + +################################### +# Datatypes (KEYWORD1) +################################### + +################################### +# Methods and Functions (KEYWORD2) +################################### + +NewTone KEYWORD2 +noNewTone KEYWORD2 + +################################### +# Constants (LITERAL1) +###################################