diff --git a/Programm/Audio-Switch/Audio-Switch.cppproj b/Programm/Audio-Switch/Audio-Switch.cppproj index 7bc29ec..f367e3a 100644 --- a/Programm/Audio-Switch/Audio-Switch.cppproj +++ b/Programm/Audio-Switch/Audio-Switch.cppproj @@ -20,139 +20,148 @@ false true true - + 0x20000000 true - + exception_table 2 0 0 - - - - - - - - - + + + + + + + + + - -mmcu=atmega48pa -B "%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\gcc\dev\atmega48pa" - True - True - True - True - False - True - True - - - NDEBUG - - - - - %24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include - - - Optimize for size (-Os) - True - True - True - True - True - - - NDEBUG - - - - - %24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include - - - Optimize for size (-Os) - True - True - True - - - libm - - - - - %24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include - - - + -mmcu=atmega48pa -B "%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\gcc\dev\atmega48pa" + True + True + True + True + False + True + True + + + NDEBUG + + + + + %24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include + + + Optimize for size (-Os) + True + True + True + True + True + + + NDEBUG + + + + + %24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include + + + Optimize for size (-Os) + True + True + True + + + libm + + + + + %24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include + + + - -mmcu=atmega48pa -B "%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\gcc\dev\atmega48pa" - True - True - True - True - False - True - True - - - DEBUG - - - - - %24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include - - - Optimize (-O1) - True - True - Default (-g2) - True - True - True - - - DEBUG - - - - - %24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include - - - Optimize (-O1) - True - True - Default (-g2) - True - - - libm - - - - - %24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include - - - Default (-Wa,-g) - + -mmcu=atmega48pa -B "%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\gcc\dev\atmega48pa" + True + True + True + True + False + True + True + + + DEBUG + + + + + %24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include + + + Optimize (-O1) + True + True + Default (-g2) + True + True + True + + + DEBUG + + + + + %24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include + + + Optimize (-O1) + True + True + Default (-g2) + True + + + libm + + + + + %24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include + + + Default (-Wa,-g) + + + compile + + + compile + + + compile + compile @@ -165,6 +174,15 @@ compile + + compile + + + compile + + + compile + compile diff --git a/Programm/Audio-Switch/Programm.hpp b/Programm/Audio-Switch/Programm.hpp index d249efd..545674a 100644 --- a/Programm/Audio-Switch/Programm.hpp +++ b/Programm/Audio-Switch/Programm.hpp @@ -8,24 +8,50 @@ #define F_CPU 8000000 #include "peripheral.h" +#include "io/AudioSwitcher.hpp" +#include "io/LED.hpp" template class ProgrammT { + private: + void ResetTimer() { + led.SetColor(Led::CYAN); + if(!this->timer_running) { + audio.SetFunk(); + } + this->timer_running = true; + } + void TimerEnd() { + audio.SetRadio(); + this->timer_running = false; + } + protected: public: - ProgrammT() { - + ProgrammT() : timer_running(false) { + } void Setup() { - + led.SetColor(Led::RED); } void Loop() { + if(this->timer_running) { + led.SetColor(Led::YELLOW); + } else { + led.SetColor(Led::GREEN); + } } - void PttVect() { - + void Vect_Ptt() { + this->ResetTimer(); } + private: + AudioSwitcher audio; + Led led; + protected: + bool timer_running; + public: }; typedef ProgrammT Programm; \ No newline at end of file diff --git a/Programm/Audio-Switch/io/AudioSwitcher.hpp b/Programm/Audio-Switch/io/AudioSwitcher.hpp new file mode 100644 index 0000000..6f62c9b --- /dev/null +++ b/Programm/Audio-Switch/io/AudioSwitcher.hpp @@ -0,0 +1,56 @@ +/* + * AudioSwitcher.hpp + * + * Created: 30.10.2020 19:47:31 + * Author: netz + */ + + +#ifndef AUDIOSWITCHER_HPP_ +#define AUDIOSWITCHER_HPP_ + +#include "Relais.hpp" +#include "ports/pin.hpp" +#include "ports/portb.hpp" +#include "ports/portd.hpp" + +template +class AudioSwitcherT { + // Methods + public: + AudioSwitcherT() { + this->SetRadio(); + } + + /** + * \brief + * Set the Relais to Radio output + * + * \return void + */ + void SetRadio() { + relais_right.Reset(); + relais_left.Reset(); + } + + + /** + * \brief + * Set the Relais to Funk output + * + * \return void + */ + void SetFunk() { + relais_right.Set(); + relais_left.Set(); + } + + // Variables + private: + Relais1 relais_right; + Relais2 relais_left; +}; + +typedef AudioSwitcherT, RelaisT > AudioSwitcher; + +#endif /* AUDIOSWITCHER_HPP_ */ \ No newline at end of file diff --git a/Programm/Audio-Switch/io/Comperator.hpp b/Programm/Audio-Switch/io/Comperator.hpp new file mode 100644 index 0000000..2360547 --- /dev/null +++ b/Programm/Audio-Switch/io/Comperator.hpp @@ -0,0 +1,24 @@ +/* + * Comperator.hpp + * + * Created: 30.10.2020 19:01:31 + * Author: netz + */ + + +#ifndef COMPERATOR_HPP_ +#define COMPERATOR_HPP_ + +class Comperator { + // Methods + private: + protected: + public: + + // Variables + private: + protected: + public: +}; + +#endif /* COMPERATOR_HPP_ */ \ No newline at end of file diff --git a/Programm/Audio-Switch/io/LED.hpp b/Programm/Audio-Switch/io/LED.hpp new file mode 100644 index 0000000..c80b959 --- /dev/null +++ b/Programm/Audio-Switch/io/LED.hpp @@ -0,0 +1,66 @@ +/* + * LED.hpp + * + * Created: 30.10.2020 22:05:41 + * Author: netz + */ + + +#ifndef LED_HPP_ +#define LED_HPP_ + +#include "ports/pin.hpp" +#include "ports/portc.hpp" + +template +class LedT { + //ENUMS + public: + enum Led_Color { + BLACK = 0, + RED = 1, + GREEN = 2, + YELLOW = 3, + BLUE = 4, + MAGENTA = 5, + CYAN = 6, + WHITE = 7 + }; + // Methods + private: + void Init() { + led_r.MakeLow(); + led_g.MakeLow(); + led_b.MakeLow(); + } + protected: + public: + LedT() { + this->Init(); + } + + /** + * \brief + * Set a color in the RGB Led + * \param color + * + * \return void + */ + void SetColor(Led_Color color) { + led_r.Set(color & (1<<0) ? true : false); + led_g.Set(color & (1<<1) ? true : false); + led_b.Set(color & (1<<2) ? true : false); + } + + // Variables + private: + led_pin_r led_r; + led_pin_g led_g; + led_pin_b led_b; + protected: + public: +}; + +typedef LedT, blubblib::pin, blubblib::pin > Led; + +#endif /* LED_HPP_ */ \ No newline at end of file diff --git a/Programm/Audio-Switch/io/PTT.hpp b/Programm/Audio-Switch/io/PTT.hpp new file mode 100644 index 0000000..7461610 --- /dev/null +++ b/Programm/Audio-Switch/io/PTT.hpp @@ -0,0 +1,26 @@ +/* + * PTT.hpp + * + * Created: 30.10.2020 22:03:26 + * Author: netz + */ + + +#ifndef PTT_HPP_ +#define PTT_HPP_ + + +class PttT { + // Methods + private: + protected: + public: + + // Variables + private: + protected: + public: +}; + + +#endif /* PTT_HPP_ */ \ No newline at end of file diff --git a/Programm/Audio-Switch/io/Relais.hpp b/Programm/Audio-Switch/io/Relais.hpp new file mode 100644 index 0000000..b55de2a --- /dev/null +++ b/Programm/Audio-Switch/io/Relais.hpp @@ -0,0 +1,54 @@ +/* + * Relais.hpp + * + * Created: 30.10.2020 19:46:30 + * Author: netz + */ + +#ifndef RELAIS_HPP_ +#define RELAIS_HPP_ + +#include +#include "ports/pin.hpp" + +template +class RelaisT { + // Methods + public: + RelaisT() { + r_set::MakeLow(); + r_reset::MakeLow(); + } + + + /** + * \brief + * Trigger the Set Pin + * + * \return void + */ + void Set() { + r_set::SetHigh(); + _delay_ms(10); + r_set::SetLow(); + } + + /** + * \brief + * Trigger the Reset Pin + * + * \return void + */ + void Reset() { + r_reset::SetHigh(); + _delay_ms(10); + r_reset::SetLow(); + } + + // Variables + private: + const typedef blubblib::pin r_set; + const typedef blubblib::pin r_reset; +}; + +#endif /* RELAIS_HPP_ */ \ No newline at end of file diff --git a/Programm/Audio-Switch/io/Timer.hpp b/Programm/Audio-Switch/io/Timer.hpp new file mode 100644 index 0000000..295da39 --- /dev/null +++ b/Programm/Audio-Switch/io/Timer.hpp @@ -0,0 +1,26 @@ +/* + * Timer.h + * + * Created: 30.10.2020 19:46:04 + * Author: netz + */ + + +#ifndef TIMER_H_ +#define TIMER_H_ + +class Timer { + // Methods + private: + protected: + public: + + // Variables + private: + protected: + public: +}; + + + +#endif /* TIMER_H_ */ \ No newline at end of file diff --git a/Programm/Audio-Switch/io/ports/pin.hpp b/Programm/Audio-Switch/io/ports/pin.hpp index 05f92de..0ce37b6 100644 --- a/Programm/Audio-Switch/io/ports/pin.hpp +++ b/Programm/Audio-Switch/io/ports/pin.hpp @@ -13,6 +13,13 @@ namespace blubblib { template struct pin { + /** + * \brief + * Set or Unset the Output + * \param value + * true = set, false = unset + * \return void + */ static void Set(bool value = true) { if (value) { PortT::Port(PortT::Port() | (1<