|
ADV-utils v1.28.1
Collection of useful C utilities (MISRA-compliant)
|
fastSqrt, fastInvSqrt, fastSin and fastCosvoid(*)(void) and void(*)(void* val)UTILS_STATUS_ERROR on a singular system or on non-finite (NaN/Inf) pivots or results instead of propagating themADVUTILS_USE_STATIC_ALLOCATION and/or ADVUTILS_USE_DYNAMIC_ALLOCATION to select wheter to use static and/or dynamic memory management. list, LPHashTable and LKHashTable are available only with ADVUTILS_USE_DYNAMIC_ALLOCATIONStatic suffixmalloc, calloc and free) user can add set(ADVUtils_DYN_MEM_MGMT "USE_FREERTOS" CACHE STRING "" FORCE) before add_subdirectory() in project CMakeLists. This will automatically add the following defines to ADVUtils compilation:ADVUTILS_MEMORY_MGMT_HEADER="FreeRTOS.h"ADVUTILS_MALLOC=pvPortMallocADVUTILS_CALLOC=pvPortCallocADVUTILS_FREE=vPortFreetarget_link_libraries(ADVUtils freertos_kernel)ADVUTILS_MEMORY_MGMT_HEADER is not defined, the library will use stdlib version of malloc, calloc and freemalloc, calloc and free by defining the following four macros:ADVUTILS_MEMORY_MGMT_HEADERADVUTILS_MALLOCADVUTILS_CALLOCADVUTILS_FREEbasicMath by adding USE_FAST_MATH to compile definitionsDEBUG is defined the library checks input parameters with ADVUTILS_ASSERT, whose built-in handler traps in an infinite loop; it is compiled out in release builds. To keep the checks active in release as well, define ADVUTILS_USE_ASSERT_ALWAYS. The handler is fully overridable, either by defining ADVUTILS_ASSERT(x) directly, or by defining ADVUTILS_ASSERT_HEADER to point at a header that declares your own assert. Two common override patterns:c #define ADVUTILS_ASSERT(x) \ do { \ if (!(x)) { \ printf("assert failed: %s:%d\n", __FILE__, __LINE__); \ for (;;) { } \ } \ } while (0) ADVUtils_assertFailed you can breakpoint or override at link time): c void ADVUtils_assertFailed(const char* file, int line); #define ADVUTILS_ASSERT(x) \ do { \ if (!(x)) { \ ADVUtils_assertFailed(__FILE__, __LINE__); \ } \ } while (0) LIST_STYPE: type of list size property, defining the maximum amount of values that can be stored in the list. Default is uint16_tLKHT_LIST_SIZE: maximum size of the list objects used by the hash-table. Default it UINT16_MAXLKHT_HASHFUN: hash function used by hash-table. Default is hash_FNV1A (FNV-1a hash) and other options are hash_djb (Dan Bernstein hash) and hash_sdbm (sdbm hash)LPHT_MIN_SIZE: minimum size of hash-table when resizing. Default is 5LPHT_MAX_SIZE: maximum size of hash-table when resizing. Default is UINT32_MAXLPHT_MIN_SATURATION: minimum saturation of hash-table, that triggers a down-sizing. Default is 0.2, meaning 20%LPHT_MAX_SATURATION: maximum saturation of hash-table, that triggers an up-sizing. Default is 0.7, meaning 70%LPHT_HASHFUN: hash function used by hash-table. Default is hash_FNV1A (FNV-1a hash) and other options are hash_djb (Dan Bernstein hash) and hash_sdbm (sdbm hash)MOVAVG_STYPE: type of moving average size property, defining the maximum amount of values that can be stored in the moving average. Default is uint16_tQUEUE_STYPE: type of queue size property, defining the maximum amount of values that can be stored in the queue. Default is uint16_t| Object | Coverage |
|---|---|
| basicMath | 100% |
| button | 100% |
| event | 100% |
| fix16 | 100% |
| IIRFilters | 100% |
| list | 100% |
| LKHashTable | 100% |
| LPHashTable | 100% |
| matrix | 100% |
| movingAvg | 100% |
| numMethods | 100% |
| PID | 100% |
| quaternion | 100% |
| queue | 100% |
| timer | 100% |
| vector3f | 100% |