fix PR#487 and #488

This commit is contained in:
Ken Willmott 2018-04-10 10:37:26 -04:00 committed by GitHub
parent 463db9b0bf
commit 7374108bd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -169,8 +169,8 @@ uint32 rtc_get_count() {
rtc_wait_sync();
rtc_wait_finished();
do {
h = RTC->regs->CNTH & 0xffff;
l = RTC->regs->CNTL & 0xffff;
h = RTC->regs->CNTH & 0xffff;
l = RTC->regs->CNTL & 0xffff;
} while (h != (RTC->regs->CNTH & 0xffff));
return (h << 16) | l;
}
@ -184,8 +184,8 @@ void rtc_set_count(uint32 value) {
rtc_wait_sync();
rtc_wait_finished();
rtc_enter_config_mode();
h = RTC->regs->CNTH & 0xffff;
l = RTC->regs->CNTL & 0xffff;
RTC->regs->CNTH = (value >> 16) & 0xffff;
RTC->regs->CNTL = value & 0xffff;
rtc_exit_config_mode();
rtc_wait_finished();
}