From 21984e237a2795aac07898f416bee028109532f8 Mon Sep 17 00:00:00 2001 From: Bart Van Der Meerssche Date: Wed, 29 Dec 2010 17:43:17 +0100 Subject: [PATCH] avr: port INT0 and INT1 ISRs to flukso v2 --- mote/v2/avr/main.c | 25 +++++++++++++++++++++++-- mote/v2/avr/main.h | 7 +++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/mote/v2/avr/main.c b/mote/v2/avr/main.c index ff9e79a..38b2f1a 100644 --- a/mote/v2/avr/main.c +++ b/mote/v2/avr/main.c @@ -145,6 +145,27 @@ ISR(SPI_STC_vect) } } +ISR(INT0_vect) +{ + uint8_t muxn_l = phy_to_log[3]; + + register_pulse(&sensor[muxn_l], &state[muxn_l]); +} + +ISR(INT1_vect) +{ + uint8_t muxn_l = phy_to_log[4]; + + register_pulse(&sensor[muxn_l], &state[muxn_l]); +} + +void register_pulse(volatile struct sensor_struct *psensor, volatile struct state_struct *pstate) +{ + psensor->counter += psensor->meterconst; + pstate->flags |= STATE_PULSE; + pstate->timestamp = time.ms; +} + ISR(TIMER1_COMPA_vect) { uint8_t muxn_l = phy_to_log[muxn]; @@ -267,7 +288,7 @@ void setup_analog_comparator(void) ACSR |= (1<