RTC. Test code updated.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3294 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
d077159389
commit
076c173385
|
@ -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
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
#define TEST_DEEPSLEEP_ENABLE
|
||||
//#define TEST_DEEPSLEEP_ENABLE
|
||||
|
||||
#ifdef TEST_DEEPSLEEP_ENABLE
|
||||
|
||||
|
@ -62,6 +62,12 @@ int main(void) {
|
|||
|
||||
#else /* TEST_DEEPSLEEP_ENABLE */
|
||||
|
||||
static void my_overflowcb(RTCDriver *rtcp){
|
||||
(void)rtcp;
|
||||
palTogglePad(IOPORT3, GPIOC_LED);
|
||||
rtcSetAlarm(rtcGetSec() + 10);
|
||||
}
|
||||
|
||||
static void my_secondcb(RTCDriver *rtcp){
|
||||
(void)rtcp;
|
||||
//palTogglePad(IOPORT3, GPIOC_LED);
|
||||
|
@ -73,25 +79,13 @@ static void my_alarmcb(RTCDriver *rtcp){
|
|||
rtcSetAlarm(rtcGetSec() + 10);
|
||||
}
|
||||
|
||||
static void my_overflowcb(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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue