From 35a57e2e36d742358ada52cdb4f76b191c42554c Mon Sep 17 00:00:00 2001 From: BlubbFish Date: Mon, 2 Nov 2020 00:27:02 +0100 Subject: [PATCH] Weiter --- .gitignore | 2 ++ Gehäuse/Readme.md | 11 ++++++++ Platine/Readme.md | 5 ++-- Programm/Audio-Switch/Programm.hpp | 35 ++++++++++++++++++++----- Programm/Audio-Switch/io/Comperator.hpp | 19 +++++++++----- Programm/Audio-Switch/io/LED.hpp | 2 -- Programm/Audio-Switch/io/PTT.hpp | 18 +++++++++++-- Programm/Audio-Switch/io/Timer.hpp | 31 ++++++++++++++++++++-- Programm/Audio-Switch/io/ports/pin.hpp | 14 ++++++++-- Programm/Audio-Switch/main.cpp | 8 ++++++ Programm/Audio-Switch/peripheral.h | 5 ++-- Verkabelung/Readme.md | 23 ++++++++++++---- 12 files changed, 141 insertions(+), 32 deletions(-) create mode 100644 Gehäuse/Readme.md diff --git a/.gitignore b/.gitignore index a081912..6fb7b8b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ /Gehäuse/PCB /Programm/Audio-Switch/Audio-Switch.componentinfo.xml /Verkabelung/BackupFiles +/Programm/.vs +/Programm/Audio-Switch/Debug diff --git a/Gehäuse/Readme.md b/Gehäuse/Readme.md new file mode 100644 index 0000000..a90b70d --- /dev/null +++ b/Gehäuse/Readme.md @@ -0,0 +1,11 @@ +# Gehäuse +Das Gehäuse besteht aus zwei gedruckten PLA Teilen die mit Schrauben und Muttern zusammenhalten + +## Bilder +![Housing](../Bilder/Housing.JPG) + +## Teile +| Menge | Wert | Kosten | Bestelllink | +| -------- | -------- | -------- | -------- | -------- | +| 1x | M3x20 Senkkopf | 1,410 € | [Flach-Senkkopfschrauben, Kreuzschlitz, PZD, M3, 20 mm](https://www.reichelt.de/?ARTIKEL=SKS+M3X20-50) | +| 1x | M3 Mutter | 2,630 € | [Sechskantmuttern, Edelstahl A2, M3, 100 Stück](https://www.reichelt.de/?ARTIKEL=SK-E+M3-100) | diff --git a/Platine/Readme.md b/Platine/Readme.md index 9e228f5..a663721 100644 --- a/Platine/Readme.md +++ b/Platine/Readme.md @@ -1,10 +1,9 @@ # Audio-Switch ## Aufgabe -Was tut die PCB? +Audioumschalter zwischen Funkgerät und Autoradio im THW DIECI ICARUS 40.14 ## Beschreibung ![Layout](../Bilder/Layout.JPG) -Hier eine Beschreibung der Platine. ## Bilder / Bauplan Doppellagig in SMD-Bauweise mit Durchkontaktierungen. @@ -22,7 +21,7 @@ Gehäuse aus dem 3D-Drucker: | Menge | Wert | Gehäuse | Kosten | Bestelllink | | -------- | -------- | -------- | -------- | -------- | | 4x | 100nF | 1206 | 0,160 € | [Vielschicht-Kerko, 100nF, 50V, 125°C](https://www.reichelt.de/?ARTIKEL=KEM+X7R1206B100N) | -| 1x | 10?F | 1206 | 0,250 € | [SMD-Vielschichtkondensator G1206 - 10µF 25V](https://www.reichelt.de/?ARTIKEL=X7R-G1206+10%2F25) | +| 1x | 10µF | 1206 | 0,250 € | [SMD-Vielschichtkondensator G1206 - 10µF 25V](https://www.reichelt.de/?ARTIKEL=X7R-G1206+10%2F25) | | 2x | 10K | 1206 | 0,040 € | [SMD-Widerstand, 1206, 10 kOhm, 250 mW, 1%](https://www.reichelt.de/?ARTIKEL=RND+1206+1+10K) | | 2x | 120 | 1206 | 0,040 € | [SMD-Widerstand, 1206, 120 Ohm, 250 mW, 5%](https://www.reichelt.de/?ARTIKEL=RND+1206+5+120) | | 1x | 150 | 1206 | 0,020 € | [SMD-Widerstand, 1206, 150 Ohm, 250 mW, 1%](https://www.reichelt.de/?ARTIKEL=RND+1206+1+150) | diff --git a/Programm/Audio-Switch/Programm.hpp b/Programm/Audio-Switch/Programm.hpp index 545674a..3c49cc0 100644 --- a/Programm/Audio-Switch/Programm.hpp +++ b/Programm/Audio-Switch/Programm.hpp @@ -10,48 +10,69 @@ #include "peripheral.h" #include "io/AudioSwitcher.hpp" #include "io/LED.hpp" +#include "io/Comperator.hpp" +#include "io/PTT.hpp" +#include "io/Timer.hpp" -template -class ProgrammT { +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; } - protected: public: - ProgrammT() : timer_running(false) { + 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: -}; -typedef ProgrammT Programm; \ No newline at end of file +}; \ No newline at end of file diff --git a/Programm/Audio-Switch/io/Comperator.hpp b/Programm/Audio-Switch/io/Comperator.hpp index 2360547..d2c73ca 100644 --- a/Programm/Audio-Switch/io/Comperator.hpp +++ b/Programm/Audio-Switch/io/Comperator.hpp @@ -9,16 +9,21 @@ #ifndef COMPERATOR_HPP_ #define COMPERATOR_HPP_ +#include + class Comperator { // Methods - private: - protected: - public: - - // Variables - private: - protected: public: + Comperator() { + ADCSRB = 0; + ACSR = (1<, blubblib::pin, blubblib::pin > Led; diff --git a/Programm/Audio-Switch/io/PTT.hpp b/Programm/Audio-Switch/io/PTT.hpp index 7461610..205b6bb 100644 --- a/Programm/Audio-Switch/io/PTT.hpp +++ b/Programm/Audio-Switch/io/PTT.hpp @@ -9,18 +9,32 @@ #ifndef PTT_HPP_ #define PTT_HPP_ +#include +#include "ports/pin.hpp" +#include "ports/portd.hpp" +template class PttT { // Methods private: protected: public: + PttT() { + ptt.MakeInput(); + EICRA = (1< > Ptt; + #endif /* PTT_HPP_ */ \ No newline at end of file diff --git a/Programm/Audio-Switch/io/Timer.hpp b/Programm/Audio-Switch/io/Timer.hpp index 295da39..9686590 100644 --- a/Programm/Audio-Switch/io/Timer.hpp +++ b/Programm/Audio-Switch/io/Timer.hpp @@ -9,11 +9,38 @@ #ifndef TIMER_H_ #define TIMER_H_ -class Timer { +#include + +template +class TimerT { // Methods private: protected: public: + TimerT() { + TCCR1A = 0; + TCCR1B = 0; + TCCR1C = 0; + + TCNT1 = 0; + + OCR1AH = (timer_count_till<<8); + OCR1AL = timer_count_till; + + TIMSK1 = (1< Timer; #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 0ce37b6..9f7d65d 100644 --- a/Programm/Audio-Switch/io/ports/pin.hpp +++ b/Programm/Audio-Switch/io/ports/pin.hpp @@ -36,10 +36,16 @@ namespace blubblib { PortT::Port(PortT::Port() ^ (1<