diff hw.c @ 30:435c6330896c

Set tv_usec in gettimeofday() by using the prescaler counter.
author Daniel O'Connor <darius@dons.net.au>
date Tue, 27 Nov 2012 13:19:11 +1030
parents 5c9d2e3d6591
children 03592ca4d37e
line wrap: on
line diff
--- a/hw.c	Tue Nov 27 13:17:42 2012 +1030
+++ b/hw.c	Tue Nov 27 13:19:11 2012 +1030
@@ -4,9 +4,9 @@
 
 #include "1wire.h"
 #include "lcd.h"
+#include "rtc.h"
 
 #define I2C_TIMEOUT 10000
-
 static void	hw_port_cfg(void);
 
 /* Wait for cnt microseconds */
@@ -77,7 +77,7 @@
     RTC_WaitForLastTask();
 
     /* Set RTC prescaler: set RTC period to 1sec */
-    RTC_SetPrescaler(32767); /* RTC period = RTCCLK/RTC_PR = (32.768 KHz)/(32767+1) */
+    RTC_SetPrescaler(RTC_PRESCALE);
 
     /* Wait until last write operation on RTC registers has finished */
     RTC_WaitForLastTask();