The timer functions provide a high-level abstraction API to access the different timers in an NHS31xx for specific uses.
◆ Timer_Init()
Initialize the timers so that the other function calls become available.
- Precondition
- This must be the first call to this block of code.
◆ Timer_StartHostTimeout()
void Timer_StartHostTimeout |
( |
int |
seconds | ) |
|
Starts or restarts a timer. The timer will keep on running in Sleep and Deep Sleep modes.
- Note
- The 16-bit timer is used. It will run as slow as possible, i.e the resolution will be low, assuming accuracy is not a concern here.
- Parameters
-
- Precondition
seconds
must be a strict positive number
◆ Timer_StopHostTimeout()
void Timer_StopHostTimeout |
( |
void |
| ) |
|
◆ Timer_CheckHostTimeout()
bool Timer_CheckHostTimeout |
( |
void |
| ) |
|
Check if time as set by Timer_StartHostTimeout has elapsed.
- Returns
True
when the timer was started and the interrupt was fired. false
otherwise.
- Note
- When the timer has timed out, an explicit call to Timer_StartHostTimeout is required to restart the 16-bit timer.
◆ Timer_StartMeasurementTimeout()
void Timer_StartMeasurementTimeout |
( |
int |
seconds | ) |
|
Starts or restarts a timer.
- Note
- The RTC timer is used, which will continue running when going to the Deep Power Down mode, and wake up the IC when it expires.
- Parameters
-
- Precondition
seconds
must be a strict positive number.
- Postcondition
- The internal status is reset: an immediate call to Timer_CheckMeasurementTimeout will now return
false
.
◆ Timer_StopMeasurementTimeout()
void Timer_StopMeasurementTimeout |
( |
void |
| ) |
|
◆ Timer_CheckMeasurementTimeout()
bool Timer_CheckMeasurementTimeout |
( |
void |
| ) |
|
◆ Timer_StartFreeRunning()
void Timer_StartFreeRunning |
( |
void |
| ) |
|
Starts the 32-bit timer. The timer will keep on running in Sleep and Deep Sleep modes.
- Note
- The 32-bit timer is used without setting any interrupts. It will run as fast as possible.
◆ Timer_StopFreeRunning()
void Timer_StopFreeRunning |
( |
void |
| ) |
|
Stops the 32-bit timer.
- Postcondition
- All subsequent call to Timer_GetFreeRunning will now return the same value.
◆ Timer_GetFreeRunning()
uint32_t Timer_GetFreeRunning |
( |
void |
| ) |
|
Retrieve the current timer value.
- Returns
- A positive number. When the moment of calling this function is not deterministic, the outcome can be used as a source of entropy.