78 lines
1.4 KiB
C++
78 lines
1.4 KiB
C++
/*
|
|
* 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() {
|
|
led.SetColor(Led::CYAN);
|
|
//timer.Reset();
|
|
if(!this->timer_running) {
|
|
audio.SetFunk();
|
|
//timer.Start();
|
|
}
|
|
this->timer_running = true;
|
|
}
|
|
|
|
void TimerEnd() {
|
|
audio.SetRadio();
|
|
//timer.Stop();
|
|
this->timer_running = false;
|
|
}
|
|
public:
|
|
Programm() : timer_running(false) {
|
|
|
|
}
|
|
|
|
void Setup() {
|
|
led.SetColor(Led::RED);
|
|
_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;
|
|
public:
|
|
}; |