This commit is contained in:
BlubbFish 2020-11-02 00:27:02 +01:00
parent 2a2ba7693e
commit 35a57e2e36
12 changed files with 141 additions and 32 deletions

2
.gitignore vendored
View File

@ -4,3 +4,5 @@
/Gehäuse/PCB
/Programm/Audio-Switch/Audio-Switch.componentinfo.xml
/Verkabelung/BackupFiles
/Programm/.vs
/Programm/Audio-Switch/Debug

11
Gehäuse/Readme.md Normal file
View File

@ -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) |

View File

@ -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) |

View File

@ -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 <int delay_plus>
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<settings_prog_delay_plus> Programm;
};

View File

@ -9,16 +9,21 @@
#ifndef COMPERATOR_HPP_
#define COMPERATOR_HPP_
#include <avr/io.h>
class Comperator {
// Methods
private:
protected:
public:
// Variables
private:
protected:
public:
Comperator() {
ADCSRB = 0;
ACSR = (1<<ACI) | (1<<ACIE) | (1<<ACIS1) | (1<<ACIS0);
}
bool GetInterruptActivated() {
if(ACSR & (1<<ACO)) {
return true;
}
return false;
}
};
#endif /* COMPERATOR_HPP_ */

View File

@ -57,8 +57,6 @@ class LedT {
led_pin_r led_r;
led_pin_g led_g;
led_pin_b led_b;
protected:
public:
};
typedef LedT<blubblib::pin<blubblib::portc, PINC1>, blubblib::pin<blubblib::portc, PINC2>, blubblib::pin<blubblib::portc, PINC0> > Led;

View File

@ -9,18 +9,32 @@
#ifndef PTT_HPP_
#define PTT_HPP_
#include <avr/io.h>
#include "ports/pin.hpp"
#include "ports/portd.hpp"
template<typename ptt_pin>
class PttT {
// Methods
private:
protected:
public:
PttT() {
ptt.MakeInput();
EICRA = (1<<ISC01) | (1<<ISC00);
EIMSK = (1<<INT0);
}
bool GetPttActivated() {
return ptt.Value();
}
// Variables
private:
protected:
public:
ptt_pin ptt;
};
typedef PttT<blubblib::pin<blubblib::portd, PIND2> > Ptt;
#endif /* PTT_HPP_ */

View File

@ -9,11 +9,38 @@
#ifndef TIMER_H_
#define TIMER_H_
class Timer {
#include <avr/io.h>
template <long int timer_count_till, int timer_prescaler>
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<<ICIE1) | (1<<OCIE1A);
}
void Stop() {
TCCR1B = 0;
}
void Start() {
TCCR1B = timer_prescaler;
}
void Reset() {
TCNT1 = 0;
}
// Variables
private:
@ -21,6 +48,6 @@ class Timer {
public:
};
typedef TimerT<settings_timer_count_till, settings_timer_prescaler> Timer;
#endif /* TIMER_H_ */

View File

@ -36,10 +36,16 @@ namespace blubblib {
PortT::Port(PortT::Port() ^ (1<<Pin));
}
static bool Get() {
return (PortT::Port() & (1<<Pin)) != 0;
}
/**
* \brief
* Return Value of the Pin (High or Low)
* \return bool
*/
static bool Value() {
return (PortT::Pin() & (1<<Pin)) != 0;
}
@ -60,6 +66,11 @@ namespace blubblib {
Output(true);
}
/**
* \brief
* Set as Input and no Pullup
* \return void
*/
static void MakeInput() {
Output(false);
Clear();
@ -67,8 +78,7 @@ namespace blubblib {
/**
* \brief
* Set Output and Low
*
* Set as Output and Low
* \return void
*/
static void MakeLow() {

View File

@ -20,4 +20,12 @@ int main(void) {
ISR(INT0_vect) {
p.Vect_Ptt();
}
ISR(ANALOG_COMP_vect) {
p.Vect_Comp();
}
ISR(TIMER1_COMPA_vect) {
p.Vect_Timer();
}

View File

@ -10,8 +10,9 @@
#define PERIPHERAL_H_
namespace {
//Programm settings
extern int const settings_prog_delay_plus = 5000;
//Timer settings = 5s
extern long const settings_timer_count_till = 39062;
extern int const settings_timer_prescaler = 5;
}

View File

@ -1,15 +1,28 @@
# Verkabelung Audio-Switch
Es müssen für den Betrieb der Schaltung 6 Kabel hergestellt werden.
## Aufbau
Für jedes Kabel wird ein passender Molex-Stecker benötigt, dieser kann 2 bis 6 Polig sein. Die Nummerierung der Pins ist von der Kabelseite aus in den Stecker gesehen.
### Power + Radio
Es werden zwei Kabel für den Audioteil des Radios benötigt, wenn kein Radio vorhanden ist wird nur Block B "Fahrzeugseite" benötigt.
Allerdings kann hier auch auf die ganze Schaltung verzichtet werden und ein Adapter aus einem Iso-Stecker und der restlichen Peperie gebaut werden.
Die benötigten Teile für die jeweiligen Anschlüsse sind in den folgenden Abschnitten ersichtlich. Die Verdratung ist aus dem [Kabelplan](../Datenblätter/Kabelplan.pdf) ersichtlich.
### Power
| Menge | Wert | Kosten | Bestelllink |
| -------- | -------- | -------- | -------- | -------- |
| 1x | 5557-02R/39-01-2020 | 0,180 € | [Molex Crimpgehäuse - Mini-Fit Jr - 2x1-polig - Buchse](https://www.reichelt.de/?ARTIKEL=MOLEX+39012020) |
| 2x | 5557-04R/39-01-2040 | 0,320 € | [Molex Crimpgehäuse - Mini-Fit Jr - 2x2-polig - Buchse](https://www.reichelt.de/?ARTIKEL=MOLEX+39012040) |
| 10x | 5556-T2L/39-00-0047 | 0,700 € | [Molex Crimpkontakt - Mini-Fit Jr - Buchse](https://www.reichelt.de/?ARTIKEL=MOLEX+39000047) |
| 1x | ISO Stecker | 1,140 € | [Umrüstadapter](https://www.reichelt.de/?ARTIKEL=BSL+70006) |
| 1x | ISO Buchse | 2,090 € | [Umrüstadapter](https://www.reichelt.de/?ARTIKEL=BSL+70039) |
| 2x | 5556-T2L/39-00-0047 | 0,700 € | [Molex Crimpkontakt - Mini-Fit Jr - Buchse](https://www.reichelt.de/?ARTIKEL=MOLEX+39000047) |
| 50x | 0,5 - 1,5 mm² | 10,000 € | [Stoßverbinder-Schrumpf, 0,5 - 1,5mm², rot](https://www.reichelt.de/?ARTIKEL=STV-R-I)
### Radio
| Menge | Wert | Kosten | Bestelllink |
| -------- | -------- | -------- | -------- | -------- |
| 2x | 5557-04R/39-01-2040 | 0,320 € | [Molex Crimpgehäuse - Mini-Fit Jr - 2x2-polig - Buchse](https://www.reichelt.de/?ARTIKEL=MOLEX+39012040) |
| 8x | 5556-T2L/39-00-0047 | 0,700 € | [Molex Crimpkontakt - Mini-Fit Jr - Buchse](https://www.reichelt.de/?ARTIKEL=MOLEX+39000047) |
| 1x | ISO Stecker | 1,140 € | [Umrüstadapter](https://www.reichelt.de/?ARTIKEL=BSL+70006) |
| 1x | ISO Buchse | 2,090 € | [Umrüstadapter](https://www.reichelt.de/?ARTIKEL=BSL+70039) |
### Mikrofon
| Menge | Wert | Kosten | Bestelllink |