Timer8 now has a variable amount of output compare units.
[avr-sim.git] / src / Timer16.h
blob6901fb9acf6f2f5ce5f91b1ce9ea84a9b2cb1194
1 #ifndef AVR_TIMER16_H
2 #define AVR_TIMER16_H
4 #include "Types.h"
5 #include "Hardware.h"
6 #include <string>
8 namespace avr {
10 /**
11 * @author Tom Haber
12 * @date May 2, 2008
13 * @brief 16-bit timers
15 * 16-bit timers
17 class Timer16 : public Hardware {
18 public:
19 Timer16(Bus & bus, unsigned char tovmask);
21 public:
22 bool attachReg(const char *name, IORegister *reg);
23 void regChanged( IORegister *reg );
24 void step();
26 private:
27 void flushOCRn();
28 void setClock(unsigned char tccr);
30 private:
31 unsigned char tovmask;
32 int direction;
34 word tcnt;
35 bool blockCompareMatch;
36 unsigned char timerMode;
37 unsigned char compareMode;
38 int period;
40 private:
41 IORegister *tcntl;
42 IORegister *tcnth;
43 IORegister *tccr;
44 IORegister *tifr;
47 inline Timer16::Timer16(Bus & bus, unsigned char tovmask)
48 : Hardware(bus), tovmask(tovmask), direction(1) {
49 blockCompareMatch = false;
50 timerMode = 0;
51 compareMode = 0;
52 period = 0;
57 #endif /*AVR_TIMER16_H*/