embeddedlibrary
reusable software modules for embedded systems
|
Modules | |
(HAL) Timing module | |
Macros | |
#define | tint_t uint32_t |
#define | TIME_MAX 0xFFFFFFFFU |
Functions | |
void | Timing_Init (void) |
Initialize the timing module. More... | |
uint32_t | TimeNow (void) |
Returns the current system time in milliseconds. More... | |
uint32_t | TimeSince (tint_t t) |
Get the elapsed time. More... | |
void | DelayMs (tint_t delay) |
Delay a specific number of milliseconds. More... | |
void | Timing_Roll (void) |
This module provides some very basic functions to make timing easier. Several other modules rely on the services provided by this module.
The module uses the HAL layer to provide the hardware specific functionality for the timing module. In this module, the hal_timing.c file is included to allow the ISR to access the time variable without externing the variable or making a function call. This allows the ISR to be very efficient.
#define TIME_MAX 0xFFFFFFFFU |
Max time that can be held with the tint_t type.
#define tint_t uint32_t |
type for timer, change override this to uint16_t for better efficiency on a 8 or 16 bit system.
Note: a define is used instead of a typedef so that the define can be overriden.
void DelayMs | ( | tint_t | delay | ) |
Delay a specific number of milliseconds.
DelayMs uses TimeNow() and TimeSince() to implement the delay
delay | specifies the number of milliseconds to delay |
uint32_t TimeNow | ( | void | ) |
Returns the current system time in milliseconds.
uint32_t TimeSince | ( | tint_t | t | ) |
void Timing_Init | ( | void | ) |
Initialize the timing module.
Call the HAL layer to initialize a timer to interrupt every 1ms. Clears the timing count
void Timing_Roll | ( | void | ) |
Reset the system time
Reset system time (e.g. TimeNow() will return 0) and set appropriate rollover times so TimeSince will work properly.