|
shengine pre-release
shengine by mrsinho
|
Handling time-related functionalities in the shengine framework.
More...
Go to the source code of this file.
Data Structures | |
| struct | ShTime |
Structure representing time in the shengine framework. More... | |
Macros | |
| #define | SH_TIME_MAX_TICK_COUNT 1024 |
| Maximum number of ticks in the time structure. | |
| #define | shOnTick(time, seconds_d, tick_idx, expression) |
Macro to execute an expression on a tick in the shengine framework. | |
Typedefs | |
| typedef uint64_t | ShTimeFunc(void *) |
| Function type for time-related callbacks. | |
| typedef enum ShTickStatus | ShTickStatus |
| typedef struct ShTime | ShTime |
Enumerations | |
| enum | ShTickStatus { SH_TICK_UNDEFINED = 0 , SH_TICK_INITIALIZED = 1 , SH_TICK_WAITING = 2 , SH_TICK_EXECUTING = 3 , SH_TICK_FINISHED_EXECUTING = 4 , SH_TICK_STATUS_MAX_ENUM } |
| Enumerates possible tick statuses. More... | |
Functions | |
| uint8_t | shGetTime (ShTime *p_time) |
Gets the current time in the shengine framework. | |
| uint8_t | shSetTime (double now, ShTime *p_time) |
Sets the time in the shengine framework. | |
| uint8_t | shCallOnTick (ShTime *p_time, double seconds, uint32_t tick_idx, ShTimeFunc *p_func, void *p_arg, uint64_t *p_return_value) |
Calls a function on a tick in the shengine framework. | |
| void | shSleep (uint32_t ms) |
| Sleeps for a specified number of milliseconds. | |
Handling time-related functionalities in the shengine framework.
The shTime.h file contains structures and functions related to handling time in the shengine framework.
| #define SH_TIME_MAX_TICK_COUNT 1024 |
Maximum number of ticks in the time structure.
SH_TIME_MAX_TICK_COUNT defines the maximum number of ticks that can be tracked in the ShTime structure.
| #define shOnTick | ( | time, | |
| seconds_d, | |||
| tick_idx, | |||
| expression | |||
| ) |
Macro to execute an expression on a tick in the shengine framework.
The shOnTick macro executes the specified expression when a tick condition is met in the ShTime structure.
Example:
| time | ShTime structure to check for ticks. |
| seconds_d | Time interval in seconds for the tick. |
| tick_idx | Index of the tick. |
| expression | Expression to execute when the tick condition is met. |
| typedef enum ShTickStatus ShTickStatus |
| ShTimeFunc |
Function type for time-related callbacks.
The ShTimeFunc typedef defines a function type for time-related callbacks, taking a void pointer as an argument and returning a uint64_t.
| enum ShTickStatus |
Enumerates possible tick statuses.
The ShTickStatus enumeration defines possible statuses of a tick in the ShTime structure, including undefined, initialized, waiting, executing, and finished executing.
|
extern |
Calls a function on a tick in the shengine framework.
| p_time | Pointer to a valid ShTime structure. |
| seconds | Time interval in seconds for the tick. |
| tick_idx | Index of the tick. |
| p_func | Pointer to the time function to call. |
| p_arg | Pointer to an argument for the time function. |
| p_return_value | Pointer to store the return value of the time function. |
|
extern |
Gets the current time in the shengine framework.
| p_time | Pointer to a valid ShTime structure. |
|
extern |
Sets the time in the shengine framework.
| now | Current time to set. |
| p_time | Pointer to a valid ShTime structure. |
|
extern |
Sleeps for a specified number of milliseconds.
| ms | Number of milliseconds to sleep. |