7 #define MAX_OUTPUTCOMPARE8_UNITS 3
14 * @brief 8-bit Output Compare Unit
16 * 8-bit Output Compare Unit
18 class OutputCompareUnit8
{
20 OutputCompareUnit8() : ocfmask(0), ocr(0) {}
23 void setOcrRegister(IORegister
*ocr
) { this->ocr
= ocr
; }
24 bool ocrSet() const { return ocr
!= 0; }
25 void setMask(unsigned char ocfmask
) { this->ocfmask
= ocfmask
; }
26 void setCompareMode(unsigned char cm
) { this->compareMode
= cm
; }
27 void regChanged(IORegister
*reg
);
30 bool compare(unsigned char tcnt
) const { return tcnt
== ocrBuf
; }
32 unsigned char value() const { return ocrBuf
; }
33 void forceOutputCompare(IORegister
*tifr
, unsigned char tcnt
);
34 void compareMatchOutput(IORegister
*tifr
, unsigned char tcnt
);
37 // For double buffering ocr register
39 unsigned char compareMode
;
40 unsigned char ocfmask
;
53 class Timer8
: public Hardware
{
55 Timer8(Bus
& bus
, unsigned char tovmask
, int compunits
,
56 unsigned char ocfmask
[]);
59 bool attachReg(const char *name
, IORegister
*reg
);
61 void regChanged( IORegister
*reg
);
65 void setClock(unsigned char tccr
);
69 unsigned char tovmask
;
72 /* pg. 93 of manual. Block compareMatch for one period after
73 * TCNTn is written to. */
74 bool blockCompareMatch
;
76 unsigned char timerMode
;
85 OutputCompareUnit8 units
[MAX_OUTPUTCOMPARE8_UNITS
];
90 #endif /*AVR_TIMER8_H*/