RTC. Added state checks.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/rtc_dev@3279 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
barthess 2011-09-01 18:09:40 +00:00
parent ca3cc2d555
commit ac429a2a76
2 changed files with 7 additions and 5 deletions

View File

@ -241,13 +241,13 @@ void rtc_lld_set_alarm(uint32_t tv_alarm){
RTC->ALRL = (uint16_t)(tv_alarm & 0xFFFF); RTC->ALRL = (uint16_t)(tv_alarm & 0xFFFF);
RTC->CRL &= ~RTC_CRL_CNF; /* switch off configure mode */ RTC->CRL &= ~RTC_CRL_CNF; /* switch off configure mode */
while(!(RTC->CRL & RTC_CRL_RTOFF)) /* wait for completion */
;
#if !(RTC_SUPPORTS_CALLBACKS) #if !(RTC_SUPPORTS_CALLBACKS)
RTC->CRL &= ~RTC_CRL_ALRF; RTC->CRL &= ~RTC_CRL_ALRF;
RTC->CRH |= RTC_CRH_ALRIE; RTC->CRH |= RTC_CRH_ALRIE;
#endif /* !(RTC_SUPPORTS_CALLBACKS) */ #endif /* !(RTC_SUPPORTS_CALLBACKS) */
while(!(RTC->CRL & RTC_CRL_RTOFF)) /* wait for completion */
;
} }
/** /**

View File

@ -68,7 +68,8 @@ void rtcInit(void){
* @param[in] rtccfgp - pointer to RTC config structure. * @param[in] rtccfgp - pointer to RTC config structure.
*/ */
#if RTC_SUPPORTS_CALLBACKS #if RTC_SUPPORTS_CALLBACKS
void rtcStart(RTCDriver *rtcp, const RTCConfig *rtccfgp){ void rtcStartI(RTCDriver *rtcp, const RTCConfig *rtccfgp){
chDbgCheckClassI();
chDbgCheck(((rtcp != NULL) && (rtccfgp != NULL)), "rtcStart"); chDbgCheck(((rtcp != NULL) && (rtccfgp != NULL)), "rtcStart");
rtc_lld_start(rtcp, rtccfgp); rtc_lld_start(rtcp, rtccfgp);
} }
@ -76,7 +77,8 @@ void rtcStart(RTCDriver *rtcp, const RTCConfig *rtccfgp){
/** /**
* @brief Stop interrupt servicing routines. * @brief Stop interrupt servicing routines.
*/ */
void rtcStop(void){ void rtcStopI(void){
chDbgCheckClassI();
rtc_lld_stop(); rtc_lld_stop();
} }
#endif /* RTC_SUPPORTS_CALLBACKS */ #endif /* RTC_SUPPORTS_CALLBACKS */