diff --git a/Source/functions.c b/Source/functions.c index 9cfe4a9..0b04ade 100644 --- a/Source/functions.c +++ b/Source/functions.c @@ -85,8 +85,25 @@ void IntDisable(void) sreg_tmp = SREG; cli(); } - -/** \brief EEPROM schreiben +/** @brief Pin Change Interrupt abschalten + * @param none + * @return none + */ +void DisablePinChangeIRQ(void) +{ + cbi(PCICR,PCIE2); +} +/** @brief Pin Change Interrupt einschalten + * @param none + * @return none + */ +void EnablePinChangeIRQ(void) +{ + sbi(PCICR,PCIE2); +} +/** @brief EEPROM schreiben + * @param none + * @return none */ void WriteEEprom(void) { @@ -365,85 +382,8 @@ void CheckStraightKey(void) */ void CheckPaddles(void) { - static uint8_t LastAction = NOTHING; - CheckDitPaddle(); CheckDahPaddle(); - - if(bConfig.KeyerMode == ULTIMATIC) - { - switch(LastAction) - { - case DAH_DIT_ON: - if(DahBuffer) { - if(DitBuffer) - DitBuffer = 0; - else - LastAction = DAH_DIT_OFF; - } else { - if(DitBuffer) - LastAction = DIT_DAH_OFF; - else - LastAction = NOTHING; - } - break; - case DIT_DAH_ON: - if(DitBuffer) { - if(DahBuffer) - DahBuffer = 0; - else - LastAction = DIT_DAH_OFF; - } else { - if(DahBuffer) - LastAction = DAH_DIT_OFF; - else - LastAction = NOTHING; - } - break; - case DAH_DIT_OFF: - if(DitBuffer) { - if(DahBuffer) - { - LastAction = DIT_DAH_ON; - DahBuffer = 0; - } else { - LastAction = DIT_DAH_OFF; - } - } else { - if(!DahBuffer) - LastAction = NOTHING; - } - break; - case DIT_DAH_OFF: - if(DahBuffer) { - if(DitBuffer) - { - LastAction = DAH_DIT_ON; - DitBuffer = 0; - } else { - LastAction = DAH_DIT_OFF; - } - } else { - if(!DitBuffer) - LastAction = NOTHING; - } - break; - case NOTHING: - if((DitBuffer) && (!DahBuffer)) { - LastAction = NOTHING; - } else { - if((DahBuffer) && (!DitBuffer)) { - LastAction = DAH_DIT_OFF; - } else { - if((DitBuffer) && (DahBuffer)) { - LastAction = DIT_DAH_ON; - DahBuffer = 0; - } - } - } - break; - } - } } /** \brief CheckDitPaddle * @@ -460,7 +400,7 @@ void CheckDitPaddle(void) if(pinvalue == 0) // DitPaddle betätigt { - DitBuffer = 1; + bState.DitPressed = 1; } } /* @@ -477,146 +417,91 @@ void CheckDahPaddle(void) if(pinvalue == 0) { - DahBuffer = 1; + bState.DahPressed = 1; } } - void SetRatio(uint8_t WPMCorrectFactor) { DitMillis = 1200 / WpM; DahMillis = DitMillis * (float)(bConfig.Ratio/10); } -/** @brief Schleife für die Dauer eines Zeichenelements Dit oder Dah - * - * @param Len Anzahl der Symbole (in Dits) +/** @brief Symbol senden + * @param Dit = 1, wenn Symbol ein Punkt ist * @return none -*/ -void SymbolLoop(uint8_t Len) -{ - volatile static uint16_t ticks; // lengths of elements + AddMilliSeconds in ms - - ticks = DitMillis * Len; // - t_elementlength = 0; // Reset Timer 0 variable - while(t_elementlength < ticks) - { - if(KeyerMode != ULTIMATIC) - { - if((KeyerMode == IAMBIC_A) && (!(PIND & (1<