feat(ex01): use actual register bit names
This commit is contained in:
parent
31d97af311
commit
9580fa10ca
1 changed files with 4 additions and 4 deletions
|
|
@ -8,7 +8,7 @@
|
|||
#define TIMER_FREQ (F_CPU / PRESCALER)
|
||||
|
||||
// at a high level:
|
||||
// Set the OC1B (PB2) pin as output
|
||||
// Set the OC1A (PB1) pin as output
|
||||
// set the TIMER1 mode to COMPARE (CTC)
|
||||
// say to compare against OC1A
|
||||
// set the value to be compated at X count
|
||||
|
|
@ -22,7 +22,7 @@ void timer1_init(void) {
|
|||
// CTC mode (WGM12 = 1)
|
||||
TCCR1B |= _BV(WGM12);
|
||||
|
||||
// Toggle OC1B on compare match (COM1B0 = 1)
|
||||
// Toggle OC1A on compare match (COM1B0 = 1)
|
||||
TCCR1A |= _BV(COM1A0);
|
||||
|
||||
// Set compare values
|
||||
|
|
@ -32,9 +32,9 @@ void timer1_init(void) {
|
|||
TCCR1B |= _BV(CS12) | _BV(CS10);
|
||||
|
||||
// set OCR1A interrupt
|
||||
TIMSK1 = _BV(1);
|
||||
TIMSK1 |= _BV(OCIE1A);
|
||||
|
||||
|
||||
// HELLO NO `sei()` SO WE DO IT BY HAND
|
||||
SREG |= (1 << 7);
|
||||
SREG |= _BV(SREG_I);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue