diff --git a/keyer.cpp b/keyer.cpp index d7d798f..45e5c22 100644 --- a/keyer.cpp +++ b/keyer.cpp @@ -1,4 +1,4 @@ -#include +#include "toneAC2/toneAC2.h" #include "pin_definitions.h" #include "settings.h" #include "tuner.h" @@ -45,7 +45,7 @@ static const unsigned int cwAdcDashTo = 800; * each time it is called, the cwTimeOut is pushed further into the future */ void cwKeydown(){ - tone(PIN_CW_TONE, globalSettings.cwSideToneFreq); + toneAC2(PIN_CW_TONE, globalSettings.cwSideToneFreq); digitalWrite(PIN_CW_KEY, 1); globalSettings.cwExpirationTimeMs = millis() + globalSettings.cwActiveTimeoutMs; @@ -56,7 +56,7 @@ void cwKeydown(){ * Pushes the cwTimeout further into the future */ void cwKeyUp(){ - noTone(PIN_CW_TONE); + noToneAC2(); digitalWrite(PIN_CW_KEY, 0); globalSettings.cwExpirationTimeMs = millis() + globalSettings.cwActiveTimeoutMs; diff --git a/morse.cpp b/morse.cpp index b8c2b20..eb7d9e6 100644 --- a/morse.cpp +++ b/morse.cpp @@ -1,4 +1,4 @@ -#include //tone +#include "toneAC2/toneAC2.h" #include "encoder.h" #include "morse.h" @@ -86,7 +86,7 @@ void morseLetter(char c, uint16_t dit_duration_ms){ //now we are at the first zero, skip and carry on mask = mask >> 1; while(mask){ - tone(PIN_CW_TONE, globalSettings.cwSideToneFreq,10000); + toneAC2(PIN_CW_TONE, globalSettings.cwSideToneFreq); if (mask & code){ delay(3 * dit_duration_ms); //Serial.print('-'); @@ -96,7 +96,7 @@ void morseLetter(char c, uint16_t dit_duration_ms){ //Serial.print('.'); } //Serial.print('#'); - noTone(PIN_CW_TONE); + noToneAC2(); delay(dit_duration_ms); // space between dots and dashes mask = mask >> 1; } @@ -122,8 +122,8 @@ void morseBool(bool val){ if(!globalSettings.morseMenuOn){ return; } - tone(PIN_CW_TONE, globalSettings.cwSideToneFreq + (val ? RELATIVE_OFFSET_HZ : -RELATIVE_OFFSET_HZ)); + toneAC2(PIN_CW_TONE, globalSettings.cwSideToneFreq + (val ? RELATIVE_OFFSET_HZ : -RELATIVE_OFFSET_HZ)); delay(3*globalSettings.cwDitDurationMs); - noTone(PIN_CW_TONE); + noToneAC2(); delay(3*globalSettings.cwDitDurationMs); } diff --git a/setup.cpp b/setup.cpp index 954b09d..c0b58de 100644 --- a/setup.cpp +++ b/setup.cpp @@ -1,4 +1,4 @@ -#include +#include "toneAC2/toneAC2.h" #include "colors.h" #include "encoder.h" #include "menu.h" @@ -279,13 +279,13 @@ void ssCwToneValidate(const long int candidate_value_in, long int* validated_val void ssCwToneChange(const long int new_value, char* buff_out, const size_t buff_out_size) { globalSettings.cwSideToneFreq = new_value; - tone(PIN_CW_TONE, globalSettings.cwSideToneFreq); + toneAC2(PIN_CW_TONE, globalSettings.cwSideToneFreq); ltoa(globalSettings.cwSideToneFreq,buff_out,10); strncat_P(buff_out,(const char*)F("Hz"),buff_out_size - strlen(buff_out)); } void ssCwToneFinalize(const long int final_value) { - noTone(PIN_CW_TONE); + noToneAC2(); globalSettings.cwSideToneFreq = final_value; SaveSettingsToEeprom(); }