aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32F1xx/RTC
diff options
context:
space:
mode:
authorbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-09-07 12:54:11 +0000
committerbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-09-07 12:54:11 +0000
commit076c1733859a4e00b75fbf57d9faa5d437a33822 (patch)
tree98b7aa8a6d6791f723cfa21bc722058d0d13747a /testhal/STM32F1xx/RTC
parentd0771593893ef9f8a9ae4ab689c569b88e3631a9 (diff)
downloadChibiOS-076c1733859a4e00b75fbf57d9faa5d437a33822.tar.gz
ChibiOS-076c1733859a4e00b75fbf57d9faa5d437a33822.tar.bz2
ChibiOS-076c1733859a4e00b75fbf57d9faa5d437a33822.zip
RTC. Test code updated.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3294 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal/STM32F1xx/RTC')
-rw-r--r--testhal/STM32F1xx/RTC/halconf.h2
-rw-r--r--testhal/STM32F1xx/RTC/main.c22
2 files changed, 9 insertions, 15 deletions
diff --git a/testhal/STM32F1xx/RTC/halconf.h b/testhal/STM32F1xx/RTC/halconf.h
index 553decda8..58023ba58 100644
--- a/testhal/STM32F1xx/RTC/halconf.h
+++ b/testhal/STM32F1xx/RTC/halconf.h
@@ -209,7 +209,7 @@
* @brief Switch to TRUE if you need callbacks from RTC.
*/
#if !defined(RTC_SUPPORTS_CALLBACKS) || defined(__DOXYGEN__)
-#define RTC_SUPPORTS_CALLBACKS FALSE
+#define RTC_SUPPORTS_CALLBACKS TRUE
#endif
/**
diff --git a/testhal/STM32F1xx/RTC/main.c b/testhal/STM32F1xx/RTC/main.c
index 497b7f0cf..d68919ecf 100644
--- a/testhal/STM32F1xx/RTC/main.c
+++ b/testhal/STM32F1xx/RTC/main.c
@@ -21,7 +21,7 @@
#include "ch.h"
#include "hal.h"
-#define TEST_DEEPSLEEP_ENABLE
+//#define TEST_DEEPSLEEP_ENABLE
#ifdef TEST_DEEPSLEEP_ENABLE
@@ -62,36 +62,30 @@ int main(void) {
#else /* TEST_DEEPSLEEP_ENABLE */
-static void my_secondcb(RTCDriver *rtcp){
+static void my_overflowcb(RTCDriver *rtcp){
(void)rtcp;
- //palTogglePad(IOPORT3, GPIOC_LED);
+ palTogglePad(IOPORT3, GPIOC_LED);
+ rtcSetAlarm(rtcGetSec() + 10);
}
-static void my_alarmcb(RTCDriver *rtcp){
+static void my_secondcb(RTCDriver *rtcp){
(void)rtcp;
- palTogglePad(IOPORT3, GPIOC_LED);
- rtcSetAlarm(rtcGetSec() + 10);
+ //palTogglePad(IOPORT3, GPIOC_LED);
}
-static void my_overflowcb(RTCDriver *rtcp){
+static void my_alarmcb(RTCDriver *rtcp){
(void)rtcp;
palTogglePad(IOPORT3, GPIOC_LED);
rtcSetAlarm(rtcGetSec() + 10);
}
-static const RTCConfig rtccfg={
- my_overflowcb,
- my_secondcb,
- my_alarmcb,
-};
int main(void) {
halInit();
chSysInit();
rtcSetAlarm(rtcGetSec() + 10);
- rtcStart(&RTCD, &rtccfg);
-
+ rtcSetCallback(&RTCD, NULL, my_secondcb, my_alarmcb);
while (TRUE){
chThdSleepMilliseconds(500);
}