RTC. Small fixes.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/rtc_dev@3271 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
2991a47733
commit
c8f60c27e1
|
@ -10,16 +10,9 @@
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: defines look in 4492 stm32f10x.h
|
// TODO: defines look in 4492 stm32f10x.h
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** The RTCCLK clock source can be either the HSE/128, LSE or LSI clocks. This is selected
|
/** The RTCCLK clock source can be either the HSE/128, LSE or LSI clocks. This is selected
|
||||||
by programming the RTCSEL[1:0] bits in the Backup domain control register (RCC_BDCR).
|
by programming the RTCSEL[1:0] bits in the Backup domain control register (RCC_BDCR).
|
||||||
This selection
|
This selection
|
||||||
|
@ -69,7 +62,7 @@ RTCDriver RTCD;
|
||||||
|
|
||||||
static void rtc_lld_serve_interrupt(RTCDriver *rtcp){
|
static void rtc_lld_serve_interrupt(RTCDriver *rtcp){
|
||||||
chSysLockFromIsr();
|
chSysLockFromIsr();
|
||||||
//TODO: do not forget to reset flags manually
|
|
||||||
if ((RTC->CRH & RTC_CRH_SECIE) && \
|
if ((RTC->CRH & RTC_CRH_SECIE) && \
|
||||||
(RTC->CRL & RTC_CRL_SECF) && \
|
(RTC->CRL & RTC_CRL_SECF) && \
|
||||||
(rtcp->config->second_cb != NULL)){
|
(rtcp->config->second_cb != NULL)){
|
||||||
|
@ -88,6 +81,7 @@ static void rtc_lld_serve_interrupt(RTCDriver *rtcp){
|
||||||
rtcp->config->overflow_cb(rtcp);
|
rtcp->config->overflow_cb(rtcp);
|
||||||
RTC->CRL &= ~RTC_CRL_OWF;
|
RTC->CRL &= ~RTC_CRL_OWF;
|
||||||
}
|
}
|
||||||
|
|
||||||
chSysUnlockFromIsr();
|
chSysUnlockFromIsr();
|
||||||
}
|
}
|
||||||
#endif /* RTC_SUPPORTS_CALLBACKS */
|
#endif /* RTC_SUPPORTS_CALLBACKS */
|
||||||
|
@ -136,6 +130,10 @@ void rtc_lld_init(void){
|
||||||
while (!(RTC->CRL & RTC_CRL_RSF))
|
while (!(RTC->CRL & RTC_CRL_RSF))
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/* disable all interrupts and clear all even flags just to be safe */
|
||||||
|
RTC->CRH &= ~(RTC_CRH_OWIE | RTC_CRH_ALRIE | RTC_CRH_SECIE);
|
||||||
|
RTC->CRL &= ~(RTC_CRL_SECF | RTC_CRL_ALRF | RTC_CRL_OWF);
|
||||||
|
|
||||||
RTCD.config = NULL;
|
RTCD.config = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue