SimpleOTA client v1.1.0
Shared core of the SimpleOTA Arduino and ESP-IDF clients
Loading...
Searching...
No Matches
sota_time.h File Reference

Duration to FreeRTOS tick conversion. More...

Go to the source code of this file.

Macros

#define SOTA_MAX_WAIT_TICKS   (UINT32_MAX - 1u)
 The longest finite wait.
 

Functions

static uint32_t sota_ms_to_ticks (uint64_t ms, uint32_t tick_hz)
 Ticks for a duration in milliseconds, saturated to SOTA_MAX_WAIT_TICKS.
 
static uint32_t sota_s_to_ticks (uint32_t s, uint32_t tick_hz)
 Ticks for a duration in seconds, saturated to SOTA_MAX_WAIT_TICKS.
 

Detailed Description

Duration to FreeRTOS tick conversion.

pdMS_TO_TICKS() multiplies in 32 bits, so long durations wrap: past about 71 minutes at a 1000 Hz tick rate, or about 11.9 hours at 100 Hz. These helpers multiply in 64 bits and saturate instead. Every delay and timer period in both clients goes through them.

No platform types, so the host tests can include this header.

Macro Definition Documentation

◆ SOTA_MAX_WAIT_TICKS

#define SOTA_MAX_WAIT_TICKS   (UINT32_MAX - 1u)

The longest finite wait.

UINT32_MAX is portMAX_DELAY, which never ends.