Comparison functions
Comparison functions include comparison for 8, 16, and 32-bit integers (Util_cmpUint8, Util_cmpUint16, Util_cmpUint32). The functions compare two values, and return the comparison result in UTIL_CMP_XXX value. For convenience, the following macros have been defined:
- Util_isLtUint{8,16,32}(a,b)
- Util_isGtUint{8,16,32}(a,b)
- Util_isEqUint{8,16,32}(a,b)
- Util_isLtOrEqUint{8,16,32}(a,b)
- Util_isGtOrEqUint{8,16,32}(a,b)
For example:
Low-resolution timer
Low-resolution timers have a granularity of one second. Timers can be added with Util_addTimer(). When a timer is created, the user defines whether the timer is an application timer or not. The application timers generate App_timer() event, other timers must be checked with Util_checkTimer(). A timer can be modified and/or removed with Util_setTimer() function.
Definition in file util.h.
|
#define | Util_isLtUint8(a, b) ((int8_t)((a) - (b)) < 0) |
|
#define | Util_isGtOrEqUint8(a, b) ((int8_t)((a) - (b)) >= 0) |
|
#define | Util_isLtUint16(a, b) ((int16_t)((a) - (b)) < 0) |
|
#define | Util_isGtOrEqUint16(a, b) ((int16_t)((a) - (b)) >= 0) |
|
#define | Util_isGtOrEqUint32(a, b) !Util_isLtUint32(a, b) |
|
#define | Util_isGtUint8(a, b) (!Util_isGtOrEqUint8(b, a)) |
|
#define | Util_isGtUint16(a, b) (!Util_isGtOrEqUint16(b, a)) |
|
#define | Util_isGtUint32(a, b) (!Util_isGtOrEqUint32(b, a)) |
|
#define | SA_MEMBERNAME(line) align ## line |
|
#define | SA_BASE(prev_type, size, line) |
|
#define | STRUCT_ALIGN_4(prev_type) SA_BASE(prev_type, 4, __LINE__) |
|
#define | STRUCT_ALIGN_2(prev_type) SA_BASE(prev_type, 2, __LINE__) |
|