diff options
Diffstat (limited to 'usb-i2c-sl018/heartbeat.c')
-rw-r--r-- | usb-i2c-sl018/heartbeat.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/usb-i2c-sl018/heartbeat.c b/usb-i2c-sl018/heartbeat.c index 6822320..fd9d5cb 100644 --- a/usb-i2c-sl018/heartbeat.c +++ b/usb-i2c-sl018/heartbeat.c @@ -50,13 +50,11 @@ void init_heartbeat(void) heartbeat_cnt = 0; heartbeat_flag = 1; - // timer 2: ~10 ms, timebase for heartbeat signal - TCCR0A = 1<<WGM01; // OC0A and OC0B as normal output, WGM = 2 (CTC) - TCCR0B = 1<<CS02 | 1<<CS00; // Prescaler 1:1024 - OCR0A = 155; // (1+155)*1024 = 159744 -> ~10 ms @ 16 MHz - //OCR2A = 194; // (1+194)*1024 = 199680 -> ~10 ms @ 20 MHz - TCNT2 = 0; // reseting timer - TIMSK0 = 1<<OCIE0A; // enable Interrupt + TCCR0A = 1<<WGM01; // OC0A and OC0B as normal output, WGM = 2 (CTC) + TCCR0B = 1<<CS02 | 1<<CS00; // Prescaler 1:1024 + OCR0A = 155; // (1+155)*1024 = 159744 -> ~10 ms @ 16 MHz + TCNT2 = 0; + TIMSK0 = 1<<OCIE0A; } void handle_heartbeat(void) |