This commit is contained in:
2020-11-02 00:27:02 +01:00
parent 2a2ba7693e
commit 35a57e2e36
12 changed files with 141 additions and 32 deletions
+12 -7
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_ */
-2
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;
+16 -2
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_ */
+29 -2
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_ */
+12 -2
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() {