#ifndef PWM_H #define PWM_H #include class Pwm16b //TC1 pwm on PB1 & PB2 { public: Pwm16b(); ~Pwm16b(); void setDuty( const uint16_t duty ); void off(); void on(); }; class Pwm8b { private: volatile unsigned char *_timerControlRegisterA; //TCCRxA volatile unsigned char *_timerControlRegisterB; //TCCRxB volatile unsigned char *_compareRegisterA; //OCRxA volatile unsigned char *_compareRegisterB; //OCRxB uint8_t _speed = 0b00000011; 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(); void setDutyA(const uint8_t duty); void setDutyB(const uint8_t duty); void off(); void on(); }; #endif