aboutsummaryrefslogtreecommitdiffstats
path: root/testhal
diff options
context:
space:
mode:
authorbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-12-16 14:42:23 +0000
committerbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-12-16 14:42:23 +0000
commit968d0cf6e9e8f362021e4288cd3336fe7922e00e (patch)
treebe576765d1d02f9ad6b36f18542f0f4f06295740 /testhal
parent172680aea3057dcea62fc4a053510d2dd03bb911 (diff)
downloadChibiOS-968d0cf6e9e8f362021e4288cd3336fe7922e00e.tar.gz
ChibiOS-968d0cf6e9e8f362021e4288cd3336fe7922e00e.tar.bz2
ChibiOS-968d0cf6e9e8f362021e4288cd3336fe7922e00e.zip
RTC. High level API rolled back.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3619 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal')
-rw-r--r--testhal/STM32F1xx/RTC/main.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/testhal/STM32F1xx/RTC/main.c b/testhal/STM32F1xx/RTC/main.c
index e8e3480ec..ea7155f47 100644
--- a/testhal/STM32F1xx/RTC/main.c
+++ b/testhal/STM32F1xx/RTC/main.c
@@ -45,9 +45,9 @@ int main(void) {
chThdCreateStatic(blinkWA, sizeof(blinkWA), NORMALPRIO, blink_thd, NULL);
/* set alarm in near future */
- rtcGetTime(&RTCD1, &timespec);
+ rtcGetTime(&timespec);
alarmspec.tv_sec = timespec.tv_sec + 60;
- rtcSetAlarm(&RTCD1, 0, &alarmspec);
+ rtcSetAlarm(&alarmspec);
while (TRUE){
chThdSleepSeconds(10);
@@ -63,10 +63,8 @@ int main(void) {
#else /* TEST_ALARM_WAKEUP */
-/**
- * Callback function for RTC.
- */
static void my_cb(RTCDriver *rtcp, rtcevent_t event) {
+
(void)rtcp;
switch (event) {
@@ -79,31 +77,21 @@ static void my_cb(RTCDriver *rtcp, rtcevent_t event) {
case RTC_EVENT_ALARM:
palTogglePad(GPIOC, GPIOC_LED);
rtcGetTime(&RTCD1, &timespec);
- alarmspec.tv_sec = timespec.tv_sec + 5;
+ alarmspec.tv_sec = timespec.tv_sec + 10;
rtcSetAlarm(&RTCD1, 0, &alarmspec);
break;
}
}
-/**
- * Configuration structure with all callbacks supported by platform.
- */
-static RTCCallbackConfig rtc_cb_cfg = {
- my_cb
-};
-
-/**
- * Main function.
- */
-int main(void){
+int main(void) {
halInit();
chSysInit();
rtcGetTime(&RTCD1, &timespec);
- alarmspec.tv_sec = timespec.tv_sec + 5;
+ alarmspec.tv_sec = timespec.tv_sec + 10;
rtcSetAlarm(&RTCD1, 0, &alarmspec);
- rtcSetCallback(&RTCD1, &rtc_cb_cfg);
+ rtcSetCallback(&RTCD1, my_cb);
while (TRUE){
chThdSleepMilliseconds(500);
}