mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #815 from toyowata/master
Targets: LPC4337 - Fix RTC clock setting issuepull/817/head
commit
2f63fa7d78
|
@ -35,10 +35,20 @@
|
|||
* The RTC may already be running, so we should set it up
|
||||
* without impacting if it is the case
|
||||
*/
|
||||
void rtc_init(void) {
|
||||
LPC_RTC->CCR = 0x00;
|
||||
|
||||
LPC_RTC->CCR |= 1 << 0; // Ensure the RTC is enabled
|
||||
void rtc_init(void) {
|
||||
// Return, if already enabled
|
||||
if (LPC_RTC->CCR & 1)
|
||||
return;
|
||||
|
||||
// Enable 1kHz output of 32kHz oscillator
|
||||
LPC_CREG->CREG0 &= ~((1 << 3) | (1 << 2));
|
||||
LPC_CREG->CREG0 |= (0x03 << 6) | (1 << 1) | (1 << 0);
|
||||
|
||||
// Enable RTC
|
||||
do {
|
||||
LPC_RTC->CCR |= 1 << 0;
|
||||
} while ((LPC_RTC->CCR & 1) == 0);
|
||||
}
|
||||
|
||||
void rtc_free(void) {
|
||||
|
|
Loading…
Reference in New Issue