/* * Programm.hpp * * Created: 19.10.2020 18:03:50 * Author: netz */ #define F_CPU 8000000 #include "peripheral.h" #include "io/AudioSwitcher.hpp" #include "io/LED.hpp" #include "io/Comperator.hpp" #include "io/PTT.hpp" #include "io/Timer.hpp" class Programm { private: void ResetTimer() { if(this->reset_running) { return; } this->reset_running = true; led.SetColor(Led::RED); timer.Reset(); if(!this->timer_running) { audio.SetFunk(); timer.Start(); } _delay_ms(1); this->timer_running = true; this->reset_running = false; } void TimerEnd() { audio.SetRadio(); timer.Stop(); this->timer_running = false; } public: Programm() : timer_running(false) { } void Setup() { led.SetColor(Led::BLUE); _delay_ms(500); } void Loop() { if(this->timer_running) { led.SetColor(Led::YELLOW); if(comp.GetInterruptActivated()) { this->ResetTimer(); } if(ptt.GetPttActivated()) { this->ResetTimer(); } } else { led.SetColor(Led::GREEN); } } void Vect_Ptt() { this->ResetTimer(); } void Vect_Comp() { this->ResetTimer(); } void Vect_Timer() { this->TimerEnd(); } private: AudioSwitcher audio; Led led; Comperator comp; Ptt ptt; Timer timer; protected: bool timer_running; bool reset_running; public: };