From eb2ac1a1548d6a309b2344fc29501b3c702f7f1a Mon Sep 17 00:00:00 2001 From: dak664 Date: Fri, 12 Feb 2010 14:37:50 +0000 Subject: [PATCH] Make seconds a global variable, add optional radio on time --- cpu/avr/dev/clock.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/cpu/avr/dev/clock.c b/cpu/avr/dev/clock.c index 1d984ab90..afab4a339 100644 --- a/cpu/avr/dev/clock.c +++ b/cpu/avr/dev/clock.c @@ -6,8 +6,16 @@ #include #include +/* Experimental: RADIOSTATS should be also be defined in the radio driver and webserver */ +#define RADIOSTATS 0 +#if RADIOSTATS +static volatile clock_time_t count, scount, rcount; +volatile unsigned long seconds,radioontime; +extern uint8_t RF230_radio_on; +#else static volatile clock_time_t count, scount; -static volatile unsigned long seconds; +volatile unsigned long seconds; +#endif /*---------------------------------------------------------------------------*/ //SIGNAL(SIG_OUTPUT_COMPARE0) @@ -18,6 +26,14 @@ ISR(AVR_OUTPUT_COMPARE_INT) scount = 0; seconds++; } +#if RADIOSTATS + if (RF230_radio_on) { + if (++rcount == CLOCK_SECOND) { + rcount=0; + radioontime++; + } + } +#endif if(etimer_pending()) { etimer_request_poll(); }