Merge pull request #917 from d00616/nrf5_fix_sleep_caluclation

NRF5: Fix sleep() (#917)
This commit is contained in:
d00616
2017-08-29 19:38:22 +02:00
committed by GitHub
+1 -1
View File
@@ -214,7 +214,7 @@ void hwSleepPrepare(unsigned long ms)
// Set compare register to 1/30.517 µs to garantee event triggering
// A minimum of 2 ticks must be guaranteed
// (1000/32768)<<12 == 125
MY_HW_RTC->CC[0] = max((ms<<12 / 125), 2);
MY_HW_RTC->CC[0] = max(((ms << 12) / 125), 2);
} else {
// 8 Hz -> max 582.542 hours sleep.
MY_HW_RTC->PRESCALER = 4095;