summaryrefslogtreecommitdiff
path: root/usb-i2c-sl018/heartbeat.c
diff options
context:
space:
mode:
Diffstat (limited to 'usb-i2c-sl018/heartbeat.c')
-rw-r--r--usb-i2c-sl018/heartbeat.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/usb-i2c-sl018/heartbeat.c b/usb-i2c-sl018/heartbeat.c
index fd7f11a..47caffc 100644
--- a/usb-i2c-sl018/heartbeat.c
+++ b/usb-i2c-sl018/heartbeat.c
@@ -32,6 +32,10 @@
uint8_t heartbeat_cnt = 0;
uint8_t heartbeat_flag;
+#define FASTBEAT_PORT PORTD
+#define FASTBEAT_DDR DDRD
+#define FASTBEAT_BIT 5
+
// while running this gets called every ~10ms
ISR(TIMER0_COMPA_vect)
{
@@ -55,10 +59,14 @@ void init_heartbeat(void)
OCR0A = 155; // (1+155)*1024 = 159744 -> ~10 ms @ 16 MHz
TCNT2 = 0;
TIMSK0 = 1<<OCIE0A;
+
+ FASTBEAT_DDR |= 1<<FASTBEAT_BIT;
}
void heartbeat_task(void)
{
+ FASTBEAT_PORT ^= 1<<FASTBEAT_BIT;
+
if(heartbeat_flag)
led_on();
else