mirror of https://github.com/ARMmbed/mbed-os.git
Fix overflow calculation for reload_value.
Please, note that this patch fixes upstream bug. See: https://devzone.nordicsemi.com/f/nordic-q-a/51674/maximum-reload-time-for-wdtpull/11894/head
parent
688e436bd9
commit
a42ff3212c
|
|
@ -69,7 +69,7 @@ watchdog_status_t hal_watchdog_stop(void)
|
|||
uint32_t hal_watchdog_get_reload_value(void)
|
||||
{
|
||||
// Convert to milliseconds from 32768 Hz clock ticks.
|
||||
return nrf_wdt_reload_value_get() / 32768U * 1000;
|
||||
return (uint64_t)nrf_wdt_reload_value_get() / 32768U * 1000;
|
||||
}
|
||||
|
||||
watchdog_features_t hal_watchdog_get_platform_features(void)
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ nrfx_err_t nrfx_wdt_init(nrfx_wdt_config_t const * p_config,
|
|||
|
||||
nrf_wdt_behaviour_set(p_config->behaviour);
|
||||
|
||||
nrf_wdt_reload_value_set((p_config->reload_value * 32768) / 1000);
|
||||
nrf_wdt_reload_value_set(((uint64_t)p_config->reload_value * 32768) / 1000);
|
||||
|
||||
NRFX_IRQ_PRIORITY_SET(WDT_IRQn, p_config->interrupt_priority);
|
||||
NRFX_IRQ_ENABLE(WDT_IRQn);
|
||||
|
|
|
|||
Loading…
Reference in New Issue