Old serial system

This commit is contained in:
IMback
2018-09-01 21:19:29 +02:00
parent 1cbff35a33
commit 91971f5380
30 changed files with 2792 additions and 839 deletions

19
pwm.h
View File

@ -5,10 +5,20 @@
class Pwm16b //TC1 pwm on PB1 & PB2
{
private:
volatile unsigned char *_timerControlRegisterA; //TCCRxA
volatile uint16_t *_compareRegisterA; //OCRxA
volatile uint16_t *_compareRegisterB; //OCRxB
bool _enableA;
bool _enableB;
public:
Pwm16b();
Pwm16b( volatile unsigned char *timerControlRegisterA, volatile unsigned char *timerControlRegisterB, volatile uint16_t *compareRegisterA, volatile uint16_t *compareRegisterB, volatile uint16_t *inputCaptureRegister, const uint8_t speed = 0b00000011, const bool enableA = true, const bool enableB = true);
~Pwm16b();
void setDuty( const uint16_t duty );
void setDutyA(const uint16_t duty);
void setDutyB(const uint16_t duty);
uint16_t getValue();
bool isOn();
void off();
void on();
};
@ -24,10 +34,13 @@ private:
bool _enableB;
public:
Pwm8b( volatile unsigned char *timerControlRegisterA, volatile unsigned char *timerControlRegisterB, volatile unsigned char *compareRegisterA, volatile unsigned char *compareRegisterB, const uint8_t speed = 0b00000011, const bool enableA = true, const bool enableB = true, const uint8_t dutyA = 0, const uint8_t dutyB = 0 );
Pwm8b( volatile unsigned char *timerControlRegisterA, volatile unsigned char *timerControlRegisterB, volatile unsigned char *compareRegisterA, volatile unsigned char *compareRegisterB, const uint8_t speed = 0b00000011, const bool enableA = true, const bool enableB = true);
~Pwm8b();
void setDutyA(const uint8_t duty);
void setDutyB(const uint8_t duty);
uint8_t getValueA();
uint8_t getValueB();
bool isOn();
void off();
void on();
};