Various types and definitions available to all applications. More...
Data Structures | |
struct | uint8_array_t |
Byte array type. More... | |
struct | regcertdatalist_t |
IEEE 11073-20601 Regulatory Certification Data List Structure. More... | |
struct | sfloat_t |
SFLOAT format (IEEE-11073 16-bit FLOAT, meaning 4 bits for exponent (base 10) and 12 bits mantissa) More... | |
struct | ble_date_time_t |
Date and Time structure. More... | |
Macros | |
#define | STACK_BASE &STACK$$Base |
#define | STACK_TOP ((void*)((uint32_t)STACK_BASE + (uint32_t)&STACK$$Length)) |
#define | STRING_CONCATENATE_IMPL(lhs, rhs) lhs ## rhs |
Implementation specific macro for delayed macro expansion used in string concatenation. More... | |
#define | STRING_CONCATENATE(lhs, rhs) STRING_CONCATENATE_IMPL(lhs, rhs) |
Macro used to concatenate string using delayed macro expansion. More... | |
#define | STATIC_ASSERT_MSG(EXPR, MSG) ;enum { STRING_CONCATENATE(MSG, __LINE__) = 1 / (!!(EXPR)) } |
Macro for doing static (i.e. compile time) assertion. More... | |
#define | STATIC_ASSERT(EXPR) STATIC_ASSERT_MSG((EXPR), static_assert_) |
Macro for doing static (i.e. compile time) assertion. More... | |
#define | NUM_VA_ARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10,_11, _12, _13, _14, _15, _16, _17, _18, _19, _20,_21, _22, _23, _24, _25, _26, _27, _28, _29, _30,_31, _32, _33, _34, _35, _36, _37, _38, _39, _40,_41, _42, _43, _44, _45, _46, _47, _48, _49, _50,_51, _52, _53, _54, _55, _56, _57, _58, _59, _60,_61, _62, N,...) N |
Implementation details for NUM_VAR_ARGS. | |
#define | NUM_VA_ARGS(...) |
Macro to get the number of arguments in a call variadic macro call. More... | |
#define | NUM_VA_ARGS_LESS_1_IMPL(_ignored,_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10,_11, _12, _13, _14, _15, _16, _17, _18, _19, _20,_21, _22, _23, _24, _25, _26, _27, _28, _29, _30,_31, _32, _33, _34, _35, _36, _37, _38, _39, _40,_41, _42, _43, _44, _45, _46, _47, _48, _49, _50,_51, _52, _53, _54, _55, _56, _57, _58, _59, _60,_61, _62, N,...) N |
Implementation details for NUM_VAR_ARGS. | |
#define | NUM_VA_ARGS_LESS_1(...) |
Macro to get the number of arguments in a call variadic macro call. First argument is not counted. More... | |
#define | ROUNDED_DIV(A, B) (((A) + ((B) / 2)) / (B)) |
Macro for performing rounded integer division (as opposed to truncating the result). More... | |
#define | IS_POWER_OF_TWO(A) ( ((A) != 0) && ((((A) - 1) & (A)) == 0) ) |
Macro for checking if an integer is a power of two. More... | |
#define | MSEC_TO_UNITS(TIME, RESOLUTION) (((TIME) * 1000) / (RESOLUTION)) |
Macro for converting milliseconds to ticks. More... | |
#define | CEIL_DIV(A, B) (((A) + (B) - 1) / (B)) |
Macro for performing integer division, making sure the result is rounded up. More... | |
#define | WORD_ALIGNED_MEM_BUFF(NAME, MIN_SIZE) static uint32_t NAME[CEIL_DIV(MIN_SIZE, sizeof(uint32_t))] |
Macro for creating a buffer aligned to 4 bytes. More... | |
#define | BYTES_TO_WORDS(n_bytes) (((n_bytes) + 3) >> 2) |
Macro for calculating the number of words that are needed to hold a number of bytes. More... | |
#define | BYTES_PER_WORD (4) |
The number of bytes in a word. | |
#define | ALIGN_NUM(alignment, number) ((number - 1) + alignment - ((number - 1) % alignment)) |
Macro for increasing a number to the nearest (larger) multiple of another number. More... | |
#define | GET_ARG_1(a1, a2) a1 |
Macro for getting first of 2 parameters. More... | |
#define | GET_ARG_2(a1, a2) a2 |
Macro for getting second of 2 parameters. More... | |
#define | CONTAINER_OF(ptr, type, member) (type *)((char *)ptr - offsetof(type, member)) |
Container of macro (borrowed from Linux kernel). More... | |
#define | BF_MASK(bcnt, boff) ( ((1U << (bcnt)) - 1U) << (boff) ) |
Define Bit-field mask. More... | |
#define | BF_GET(val, bcnt, boff) ( ( (val) & BF_MASK((bcnt), (boff)) ) >> (boff) ) |
Get bit-field. More... | |
#define | BF_VAL(val, bcnt, boff) ( (((uint32_t)(val)) << (boff)) & BF_MASK(bcnt, boff) ) |
Create bit-field value. More... | |
#define | BF_CX(bcnt, boff) ( ((((uint32_t)(bcnt)) << BF_CX_BCNT_POS) & BF_CX_BCNT_MASK) | ((((uint32_t)(boff)) << BF_CX_BOFF_POS) & BF_CX_BOFF_MASK) ) |
Define complex bit-field. More... | |
#define | BF_CX_BCNT(bf_cx) ( ((bf_cx) & BF_CX_BCNT_MASK) >> BF_CX_BCNT_POS ) |
Get number of bits in bit-field. More... | |
#define | BF_CX_BOFF(bf_cx) ( ((bf_cx) & BF_CX_BOFF_MASK) >> BF_CX_BOFF_POS ) |
Get lowest bit number in the field. More... | |
#define | BF_CX_MASK(bf_cx) BF_MASK(BF_CX_BCNT(bf_cx), BF_CX_BOFF(bf_cx)) |
Get bit mask of the selected field. More... | |
#define | BF_CX_GET(val, bf_cx) BF_GET(val, BF_CX_BCNT(bf_cx), BF_CX_BOFF(bf_cx)) |
Get bit-field. More... | |
#define | BF_CX_VAL(val, bf_cx) BF_VAL(val, BF_CX_BCNT(bf_cx), BF_CX_BOFF(bf_cx)) |
Create bit-field value. More... | |
#define | BRACKET_EXTRACT(a) BRACKET_EXTRACT_(a) |
Extracting data from the brackets. More... | |
#define | BRACKET_EXTRACT_(a) BRACKET_EXTRACT__ a |
#define | BRACKET_EXTRACT__(...) __VA_ARGS__ |
#define | NUM_VA_ARGS_IS_MORE_THAN_1(...) NUM_IS_MORE_THAN_1(NUM_VA_ARGS(__VA_ARGS__)) |
Check if number of parameters is more than 1. More... | |
#define | NUM_IS_MORE_THAN_1(N) NUM_IS_MORE_THAN_1_(N) |
Check if given numeric value is bigger than 1. More... | |
#define | NUM_IS_MORE_THAN_1_(N) NUM_IS_MORE_THAN_1_PROBE_(NUM_IS_MORE_THAN_1_PROBE_ ## N, 1) |
#define | NUM_IS_MORE_THAN_1_PROBE_(...) GET_VA_ARG_1(GET_ARGS_AFTER_1(__VA_ARGS__)) |
#define | NUM_IS_MORE_THAN_1_PROBE_0 ~, 0 |
#define | NUM_IS_MORE_THAN_1_PROBE_1 ~, 0 |
#define | GET_VA_ARG_1(...) GET_VA_ARG_1_(__VA_ARGS__, ) |
Get the first argument. More... | |
#define | GET_VA_ARG_1_(a1,...) a1 |
#define | GET_ARGS_AFTER_1(...) GET_ARGS_AFTER_1_(__VA_ARGS__, ) |
Get all the arguments but the first one. More... | |
#define | GET_ARGS_AFTER_1_(a1,...) __VA_ARGS__ |
#define | FIELD_SIZE(struct_type, field) sizeof(((struct struct_type*)NULL)->field) |
Size of a field in declared structure. More... | |
#define | FIELD_ARRAY_SIZE(struct_type, field) (FIELD_SIZE(struct_type, field) / FIELD_SIZE(struct_type, field[0])) |
Number of elements in field array in declared structure. More... | |
#define | MACRO_MAP(...) MACRO_MAP_(__VA_ARGS__) |
Mapping macro. More... | |
#define | MACRO_MAP_(...) MACRO_MAP_N(NUM_VA_ARGS_LESS_1(__VA_ARGS__), __VA_ARGS__) |
#define | MACRO_MAP_REC(...) MACRO_MAP_REC_(__VA_ARGS__) |
Mapping macro, recursive version. More... | |
#define | MACRO_MAP_REC_(...) MACRO_MAP_REC_N(NUM_VA_ARGS_LESS_1(__VA_ARGS__), __VA_ARGS__) |
#define | MACRO_MAP_N(N,...) MACRO_MAP_N_(N, __VA_ARGS__) |
Mapping N arguments macro. More... | |
#define | MACRO_MAP_N_(N,...) CONCAT_2(MACRO_MAP_, N)(__VA_ARGS__, ) |
#define | MACRO_MAP_REC_N(N,...) MACRO_MAP_REC_N_(N, __VA_ARGS__) |
Mapping N arguments macro, recursive version. More... | |
#define | MACRO_MAP_REC_N_(N,...) CONCAT_2(MACRO_MAP_REC_, N)(__VA_ARGS__, ) |
#define | MACRO_MAP_0(...) |
#define | MACRO_MAP_1(macro, a,...) macro(a) |
#define | MACRO_MAP_2(macro, a,...) macro(a) MACRO_MAP_1 (macro, __VA_ARGS__, ) |
#define | MACRO_MAP_3(macro, a,...) macro(a) MACRO_MAP_2 (macro, __VA_ARGS__, ) |
#define | MACRO_MAP_4(macro, a,...) macro(a) MACRO_MAP_3 (macro, __VA_ARGS__, ) |
#define | MACRO_MAP_5(macro, a,...) macro(a) MACRO_MAP_4 (macro, __VA_ARGS__, ) |
#define | MACRO_MAP_6(macro, a,...) macro(a) MACRO_MAP_5 (macro, __VA_ARGS__, ) |
#define | MACRO_MAP_7(macro, a,...) macro(a) MACRO_MAP_6 (macro, __VA_ARGS__, ) |
#define | MACRO_MAP_8(macro, a,...) macro(a) MACRO_MAP_7 (macro, __VA_ARGS__, ) |
#define | MACRO_MAP_9(macro, a,...) macro(a) MACRO_MAP_8 (macro, __VA_ARGS__, ) |
#define | MACRO_MAP_10(macro, a,...) macro(a) MACRO_MAP_9 (macro, __VA_ARGS__, ) |
#define | MACRO_MAP_11(macro, a,...) macro(a) MACRO_MAP_10(macro, __VA_ARGS__, ) |
#define | MACRO_MAP_12(macro, a,...) macro(a) MACRO_MAP_11(macro, __VA_ARGS__, ) |
#define | MACRO_MAP_13(macro, a,...) macro(a) MACRO_MAP_12(macro, __VA_ARGS__, ) |
#define | MACRO_MAP_14(macro, a,...) macro(a) MACRO_MAP_13(macro, __VA_ARGS__, ) |
#define | MACRO_MAP_15(macro, a,...) macro(a) MACRO_MAP_14(macro, __VA_ARGS__, ) |
#define | MACRO_MAP_REC_0(...) |
#define | MACRO_MAP_REC_1(macro, a,...) macro(a) |
#define | MACRO_MAP_REC_2(macro, a,...) macro(a) MACRO_MAP_REC_1 (macro, __VA_ARGS__, ) |
#define | MACRO_MAP_REC_3(macro, a,...) macro(a) MACRO_MAP_REC_2 (macro, __VA_ARGS__, ) |
#define | MACRO_MAP_REC_4(macro, a,...) macro(a) MACRO_MAP_REC_3 (macro, __VA_ARGS__, ) |
#define | MACRO_MAP_REC_5(macro, a,...) macro(a) MACRO_MAP_REC_4 (macro, __VA_ARGS__, ) |
#define | MACRO_MAP_REC_6(macro, a,...) macro(a) MACRO_MAP_REC_5 (macro, __VA_ARGS__, ) |
#define | MACRO_MAP_REC_7(macro, a,...) macro(a) MACRO_MAP_REC_6 (macro, __VA_ARGS__, ) |
#define | MACRO_MAP_REC_8(macro, a,...) macro(a) MACRO_MAP_REC_7 (macro, __VA_ARGS__, ) |
#define | MACRO_MAP_REC_9(macro, a,...) macro(a) MACRO_MAP_REC_8 (macro, __VA_ARGS__, ) |
#define | MACRO_MAP_REC_10(macro, a,...) macro(a) MACRO_MAP_REC_9 (macro, __VA_ARGS__, ) |
#define | MACRO_MAP_REC_11(macro, a,...) macro(a) MACRO_MAP_REC_10(macro, __VA_ARGS__, ) |
#define | MACRO_MAP_REC_12(macro, a,...) macro(a) MACRO_MAP_REC_11(macro, __VA_ARGS__, ) |
#define | MACRO_MAP_REC_13(macro, a,...) macro(a) MACRO_MAP_REC_12(macro, __VA_ARGS__, ) |
#define | MACRO_MAP_REC_14(macro, a,...) macro(a) MACRO_MAP_REC_13(macro, __VA_ARGS__, ) |
#define | MACRO_MAP_REC_15(macro, a,...) macro(a) MACRO_MAP_REC_14(macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR(...) MACRO_MAP_FOR_(__VA_ARGS__) |
Mapping macro with current index. More... | |
#define | MACRO_MAP_FOR_N_LIST 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 |
#define | MACRO_MAP_FOR_(...) MACRO_MAP_FOR_N(NUM_VA_ARGS_LESS_1(__VA_ARGS__), __VA_ARGS__) |
#define | MACRO_MAP_FOR_N(N,...) MACRO_MAP_FOR_N_(N, __VA_ARGS__) |
Mapping N arguments macro with current index. More... | |
#define | MACRO_MAP_FOR_N_(N,...) CONCAT_2(MACRO_MAP_FOR_, N)((MACRO_MAP_FOR_N_LIST), __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_0(n_list,...) |
#define | MACRO_MAP_FOR_1(n_list, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) |
#define | MACRO_MAP_FOR_2(n_list, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_1 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_3(n_list, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_2 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_4(n_list, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_3 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_5(n_list, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_4 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_6(n_list, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_5 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_7(n_list, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_6 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_8(n_list, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_7 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_9(n_list, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_8 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_10(n_list, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_9 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_11(n_list, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_10((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_12(n_list, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_11((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_13(n_list, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_12((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_14(n_list, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_13((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_15(n_list, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list))) MACRO_MAP_FOR_14((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_PARAM(param,...) MACRO_MAP_FOR_PARAM_(param, __VA_ARGS__) |
Mapping macro with current index and parameter. More... | |
#define | MACRO_MAP_FOR_PARAM_(param,...) MACRO_MAP_FOR_PARAM_N(NUM_VA_ARGS_LESS_1(__VA_ARGS__), param, __VA_ARGS__) |
#define | MACRO_MAP_FOR_PARAM_N(N, param,...) MACRO_MAP_FOR_PARAM_N_(N, param, __VA_ARGS__) |
Mapping N arguments macro with with current index and parameter. More... | |
#define | MACRO_MAP_FOR_PARAM_N_(N, param,...) CONCAT_2(MACRO_MAP_FOR_PARAM_, N)((MACRO_MAP_FOR_N_LIST), param, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_PARAM_0(n_list, param,...) |
#define | MACRO_MAP_FOR_PARAM_1(n_list, param, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) |
#define | MACRO_MAP_FOR_PARAM_2(n_list, param, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_1 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_PARAM_3(n_list, param, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_2 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_PARAM_4(n_list, param, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_3 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_PARAM_5(n_list, param, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_4 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_PARAM_6(n_list, param, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_5 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_PARAM_7(n_list, param, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_6 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_PARAM_8(n_list, param, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_7 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_PARAM_9(n_list, param, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_8 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_PARAM_10(n_list, param, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_9 ((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_PARAM_11(n_list, param, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_10((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_PARAM_12(n_list, param, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_11((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_PARAM_13(n_list, param, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_12((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_PARAM_14(n_list, param, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_13((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) |
#define | MACRO_MAP_FOR_PARAM_15(n_list, param, macro, a,...) macro(a, GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), param) MACRO_MAP_FOR_PARAM_14((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), param, macro, __VA_ARGS__, ) |
#define | MACRO_REPEAT(count, macro,...) MACRO_REPEAT_(count, macro, __VA_ARGS__) |
Repeating macro. More... | |
#define | MACRO_REPEAT_(count, macro,...) CONCAT_2(MACRO_REPEAT_, count)(macro, __VA_ARGS__) |
#define | MACRO_REPEAT_0(macro,...) |
#define | MACRO_REPEAT_1(macro,...) macro(__VA_ARGS__) MACRO_REPEAT_0(macro, __VA_ARGS__) |
#define | MACRO_REPEAT_2(macro,...) macro(__VA_ARGS__) MACRO_REPEAT_1(macro, __VA_ARGS__) |
#define | MACRO_REPEAT_3(macro,...) macro(__VA_ARGS__) MACRO_REPEAT_2(macro, __VA_ARGS__) |
#define | MACRO_REPEAT_4(macro,...) macro(__VA_ARGS__) MACRO_REPEAT_3(macro, __VA_ARGS__) |
#define | MACRO_REPEAT_5(macro,...) macro(__VA_ARGS__) MACRO_REPEAT_4(macro, __VA_ARGS__) |
#define | MACRO_REPEAT_6(macro,...) macro(__VA_ARGS__) MACRO_REPEAT_5(macro, __VA_ARGS__) |
#define | MACRO_REPEAT_7(macro,...) macro(__VA_ARGS__) MACRO_REPEAT_6(macro, __VA_ARGS__) |
#define | MACRO_REPEAT_8(macro,...) macro(__VA_ARGS__) MACRO_REPEAT_7(macro, __VA_ARGS__) |
#define | MACRO_REPEAT_9(macro,...) macro(__VA_ARGS__) MACRO_REPEAT_8(macro, __VA_ARGS__) |
#define | MACRO_REPEAT_10(macro,...) macro(__VA_ARGS__) MACRO_REPEAT_9(macro, __VA_ARGS__) |
#define | MACRO_REPEAT_11(macro,...) macro(__VA_ARGS__) MACRO_REPEAT_10(macro, __VA_ARGS__) |
#define | MACRO_REPEAT_12(macro,...) macro(__VA_ARGS__) MACRO_REPEAT_11(macro, __VA_ARGS__) |
#define | MACRO_REPEAT_13(macro,...) macro(__VA_ARGS__) MACRO_REPEAT_12(macro, __VA_ARGS__) |
#define | MACRO_REPEAT_14(macro,...) macro(__VA_ARGS__) MACRO_REPEAT_13(macro, __VA_ARGS__) |
#define | MACRO_REPEAT_15(macro,...) macro(__VA_ARGS__) MACRO_REPEAT_14(macro, __VA_ARGS__) |
#define | MACRO_REPEAT_FOR(count, macro,...) MACRO_REPEAT_FOR_(count, macro, __VA_ARGS__) |
Repeating macro with current index. More... | |
#define | MACRO_REPEAT_FOR_(count, macro,...) CONCAT_2(MACRO_REPEAT_FOR_, count)((MACRO_MAP_FOR_N_LIST), macro, __VA_ARGS__) |
#define | MACRO_REPEAT_FOR_0(n_list, macro,...) |
#define | MACRO_REPEAT_FOR_1(n_list, macro,...) macro(GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), __VA_ARGS__) MACRO_REPEAT_FOR_0((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__) |
#define | MACRO_REPEAT_FOR_2(n_list, macro,...) macro(GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), __VA_ARGS__) MACRO_REPEAT_FOR_1((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__) |
#define | MACRO_REPEAT_FOR_3(n_list, macro,...) macro(GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), __VA_ARGS__) MACRO_REPEAT_FOR_2((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__) |
#define | MACRO_REPEAT_FOR_4(n_list, macro,...) macro(GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), __VA_ARGS__) MACRO_REPEAT_FOR_3((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__) |
#define | MACRO_REPEAT_FOR_5(n_list, macro,...) macro(GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), __VA_ARGS__) MACRO_REPEAT_FOR_4((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__) |
#define | MACRO_REPEAT_FOR_6(n_list, macro,...) macro(GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), __VA_ARGS__) MACRO_REPEAT_FOR_5((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__) |
#define | MACRO_REPEAT_FOR_7(n_list, macro,...) macro(GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), __VA_ARGS__) MACRO_REPEAT_FOR_6((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__) |
#define | MACRO_REPEAT_FOR_8(n_list, macro,...) macro(GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), __VA_ARGS__) MACRO_REPEAT_FOR_7((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__) |
#define | MACRO_REPEAT_FOR_9(n_list, macro,...) macro(GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), __VA_ARGS__) MACRO_REPEAT_FOR_8((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__) |
#define | MACRO_REPEAT_FOR_10(n_list, macro,...) macro(GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), __VA_ARGS__) MACRO_REPEAT_FOR_9((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__) |
#define | MACRO_REPEAT_FOR_11(n_list, macro,...) macro(GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), __VA_ARGS__) MACRO_REPEAT_FOR_10((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__) |
#define | MACRO_REPEAT_FOR_12(n_list, macro,...) macro(GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), __VA_ARGS__) MACRO_REPEAT_FOR_11((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__) |
#define | MACRO_REPEAT_FOR_13(n_list, macro,...) macro(GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), __VA_ARGS__) MACRO_REPEAT_FOR_12((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__) |
#define | MACRO_REPEAT_FOR_14(n_list, macro,...) macro(GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), __VA_ARGS__) MACRO_REPEAT_FOR_13((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__) |
#define | MACRO_REPEAT_FOR_15(n_list, macro,...) macro(GET_VA_ARG_1(BRACKET_EXTRACT(n_list)), __VA_ARGS__) MACRO_REPEAT_FOR_14((GET_ARGS_AFTER_1(BRACKET_EXTRACT(n_list))), macro, __VA_ARGS__) |
#define | PARAM_CBRACE(p) { p }, |
Adding curly brace to the macro parameter. More... | |
Typedefs | |
typedef uint8_t | uint16_le_t [2] |
type for holding an encoded (i.e. little endian) 16 bit unsigned integer. | |
typedef uint8_t | uint32_le_t [4] |
Type for holding an encoded (i.e. little endian) 32 bit unsigned integer. | |
typedef uint8_t | nibble_t |
typedef uint32_t | uint24_t |
typedef uint64_t | uint40_t |
Enumerations | |
enum | { UNIT_0_625_MS = 625, UNIT_1_25_MS = 1250, UNIT_10_MS = 10000 } |
Functions | |
static __INLINE uint64_t | value_rescale (uint32_t value, uint32_t old_unit_reversal, uint16_t new_unit_reversal) |
Function for changing the value unit. More... | |
static __INLINE uint8_t | uint16_encode (uint16_t value, uint8_t *p_encoded_data) |
Function for encoding a uint16 value. More... | |
static __INLINE uint8_t | uint24_encode (uint32_t value, uint8_t *p_encoded_data) |
Function for encoding a three-byte value. More... | |
static __INLINE uint8_t | uint32_encode (uint32_t value, uint8_t *p_encoded_data) |
Function for encoding a uint32 value. More... | |
static __INLINE uint8_t | uint48_encode (uint64_t value, uint8_t *p_encoded_data) |
Function for encoding a uint48 value. More... | |
static __INLINE uint16_t | uint16_decode (const uint8_t *p_encoded_data) |
Function for decoding a uint16 value. More... | |
static __INLINE uint16_t | uint16_big_decode (const uint8_t *p_encoded_data) |
Function for decoding a uint16 value in big-endian format. More... | |
static __INLINE uint32_t | uint24_decode (const uint8_t *p_encoded_data) |
Function for decoding a three-byte value. More... | |
static __INLINE uint32_t | uint32_decode (const uint8_t *p_encoded_data) |
Function for decoding a uint32 value. More... | |
static __INLINE uint32_t | uint32_big_decode (const uint8_t *p_encoded_data) |
Function for decoding a uint32 value in big-endian format. More... | |
static __INLINE uint8_t | uint16_big_encode (uint16_t value, uint8_t *p_encoded_data) |
Function for encoding an uint16 value in big-endian format. More... | |
static __INLINE uint8_t | uint32_big_encode (uint32_t value, uint8_t *p_encoded_data) |
Function for encoding a uint32 value in big-endian format. More... | |
static __INLINE uint64_t | uint48_decode (const uint8_t *p_encoded_data) |
Function for decoding a uint48 value. More... | |
static __INLINE uint8_t | battery_level_in_percent (const uint16_t mvolts) |
Function for converting the input voltage (in milli volts) into percentage of 3.0 Volts. More... | |
static __INLINE bool | is_word_aligned (void const *p) |
Function for checking if a pointer value is aligned to a 4 byte boundary. More... | |
static __INLINE bool | is_address_from_stack (void *ptr) |
Function for checking if provided address is located in stack space. More... | |
static __INLINE uint8_t | bds_uint16_encode (const uint16_t *p_value, uint8_t *p_encoded_data) |
Function for encoding a uint16 value. More... | |
static __INLINE uint8_t | bds_int16_encode (const int16_t *p_value, uint8_t *p_encoded_data) |
static __INLINE uint8_t | bds_uint24_encode (const uint32_t *p_value, uint8_t *p_encoded_data) |
Function for encoding a uint24 value. More... | |
static __INLINE uint8_t | bds_uint32_encode (const uint32_t *p_value, uint8_t *p_encoded_data) |
Function for encoding a uint32 value. More... | |
static __INLINE uint8_t | bds_uint40_encode (const uint64_t *p_value, uint8_t *p_encoded_data) |
Function for encoding a uint40 value. More... | |
static __INLINE uint8_t | bds_sfloat_encode (const sfloat_t *p_value, uint8_t *p_encoded_data) |
Function for encoding a sfloat value. More... | |
static __INLINE uint8_t | bds_uint8_array_encode (const uint8_array_t *p_value, uint8_t *p_encoded_data) |
Function for encoding a uint8_array value. More... | |
static __INLINE uint8_t | bds_ble_srv_utf8_str_encode (const ble_srv_utf8_str_t *p_value, uint8_t *p_encoded_data) |
Function for encoding a utf8_str value. More... | |
static __INLINE uint8_t | bds_regcertdatalist_encode (const regcertdatalist_t *p_value, uint8_t *p_encoded_data) |
Function for encoding a regcertdatalist value. More... | |
static __INLINE uint8_t | bds_ble_date_time_encode (const ble_date_time_t *p_date_time, uint8_t *p_encoded_data) |
Function for decoding a date_time value. More... | |
static __INLINE uint8_t | bds_uint16_decode (const uint8_t len, const uint8_t *p_encoded_data, uint16_t *p_decoded_val) |
Function for decoding a uint16 value. More... | |
static __INLINE uint8_t | bds_int16_decode (const uint8_t len, const uint8_t *p_encoded_data, int16_t *p_decoded_val) |
Function for decoding a int16 value. More... | |
static __INLINE uint8_t | bds_uint24_decode (const uint8_t len, const uint8_t *p_encoded_data, uint32_t *p_decoded_val) |
Function for decoding a uint24 value. More... | |
static __INLINE uint8_t | bds_uint32_decode (const uint8_t len, const uint8_t *p_encoded_data, uint32_t *p_decoded_val) |
Function for decoding a uint32 value. More... | |
static __INLINE uint8_t | bds_uint40_decode (const uint8_t len, const uint8_t *p_encoded_data, uint64_t *p_decoded_val) |
Function for decoding a uint40 value. More... | |
static __INLINE uint8_t | bds_sfloat_decode (const uint8_t len, const uint8_t *p_encoded_data, sfloat_t *p_decoded_val) |
Function for decoding a sfloat value. More... | |
static __INLINE uint8_t | bds_uint8_array_decode (const uint8_t len, const uint8_t *p_encoded_data, uint8_array_t *p_decoded_val) |
Function for decoding a uint8_array value. More... | |
static __INLINE uint8_t | bds_ble_srv_utf8_str_decode (const uint8_t len, const uint8_t *p_encoded_data, ble_srv_utf8_str_t *p_decoded_val) |
Function for decoding a utf8_str value. More... | |
static __INLINE uint8_t | bds_regcertdatalist_decode (const uint8_t len, const uint8_t *p_encoded_data, regcertdatalist_t *p_decoded_val) |
Function for decoding a regcertdatalist value. More... | |
static __INLINE uint8_t | bds_ble_date_time_decode (const uint8_t len, const uint8_t *p_encoded_data, ble_date_time_t *p_date_time) |
Function for decoding a date_time value. More... | |
Variables | |
char STACK | $$Base |
char STACK | $$Length |
Configuration of complex bit-field | |
| |
#define | BF_CX_BCNT_POS 0U |
Position of bit count in complex bit-field value. | |
#define | BF_CX_BCNT_MASK (0xffU << BF_CX_BCNT_POS) |
Mask of bit count in complex bit-field value. | |
#define | BF_CX_BOFF_POS 8U |
Position of bit position in complex bit-field value. | |
#define | BF_CX_BOFF_MASK (0xffU << BF_CX_BOFF_POS) |
Mask of bit position in complex bit-field value. | |
Various types and definitions available to all applications.
#define ALIGN_NUM | ( | alignment, | |
number | |||
) | ((number - 1) + alignment - ((number - 1) % alignment)) |
Macro for increasing a number to the nearest (larger) multiple of another number.
[in] | alignment | The number to align to. |
[in] | number | The number to align (increase). |
number
. #define BF_CX | ( | bcnt, | |
boff | |||
) | ( ((((uint32_t)(bcnt)) << BF_CX_BCNT_POS) & BF_CX_BCNT_MASK) | ((((uint32_t)(boff)) << BF_CX_BOFF_POS) & BF_CX_BOFF_MASK) ) |
Define complex bit-field.
Complex bit-field would contain its position and size in one number.
[in] | bcnt | Number of bits in the bit-field |
[in] | boff | Lowest bit number |
#define BF_CX_BCNT | ( | bf_cx | ) | ( ((bf_cx) & BF_CX_BCNT_MASK) >> BF_CX_BCNT_POS ) |
Get number of bits in bit-field.
bf_cx | Complex bit-field |
#define BF_CX_BOFF | ( | bf_cx | ) | ( ((bf_cx) & BF_CX_BOFF_MASK) >> BF_CX_BOFF_POS ) |
Get lowest bit number in the field.
[in] | bf_cx | Complex bit-field |
#define BF_CX_GET | ( | val, | |
bf_cx | |||
) | BF_GET(val, BF_CX_BCNT(bf_cx), BF_CX_BOFF(bf_cx)) |
#define BF_CX_MASK | ( | bf_cx | ) | BF_MASK(BF_CX_BCNT(bf_cx), BF_CX_BOFF(bf_cx)) |
Get bit mask of the selected field.
[in] | bf_cx | Complex bit-field |
#define BF_CX_VAL | ( | val, | |
bf_cx | |||
) | BF_VAL(val, BF_CX_BCNT(bf_cx), BF_CX_BOFF(bf_cx)) |
Create bit-field value.
Value is masked and shifted to match given bit-field.
[in] | val | Value to set on bit-field |
[in] | bf_cx | Complex bit-field |
#define BF_GET | ( | val, | |
bcnt, | |||
boff | |||
) | ( ( (val) & BF_MASK((bcnt), (boff)) ) >> (boff) ) |
Get bit-field.
Macro that extracts selected bit-field from provided value
[in] | val | Value from witch selected bit-field would be extracted |
[in] | bcnt | Number of bits in the bit-field |
[in] | boff | Lowest bit number |
#define BF_MASK | ( | bcnt, | |
boff | |||
) | ( ((1U << (bcnt)) - 1U) << (boff) ) |
Define Bit-field mask.
Macro that defined the mask with selected number of bits set, starting from provided bit number.
[in] | bcnt | Number of bits in the bit-field |
[in] | boff | Lowest bit number |
#define BF_VAL | ( | val, | |
bcnt, | |||
boff | |||
) | ( (((uint32_t)(val)) << (boff)) & BF_MASK(bcnt, boff) ) |
Create bit-field value.
Value is masked and shifted to match given bit-field
[in] | val | Value to set on bit-field |
[in] | bcnt | Number of bits for bit-field |
[in] | boff | Offset of bit-field |
#define BRACKET_EXTRACT | ( | a | ) | BRACKET_EXTRACT_(a) |
Extracting data from the brackets.
This macro get rid of brackets around the argument. It can be used to pass multiple arguments in logical one argument to a macro. Call it with arguments inside brackets:
It would produce:
a | Argument with anything inside brackets |
#define BYTES_TO_WORDS | ( | n_bytes | ) | (((n_bytes) + 3) >> 2) |
Macro for calculating the number of words that are needed to hold a number of bytes.
Adds 3 and divides by 4.
[in] | n_bytes | The number of bytes. |
n_bytes
take up (rounded up). #define CEIL_DIV | ( | A, | |
B | |||
) | (((A) + (B) - 1) / (B)) |
Macro for performing integer division, making sure the result is rounded up.
One typical use for this is to compute the number of objects with size B is needed to hold A number of bytes.
[in] | A | Numerator. |
[in] | B | Denominator. |
#define CONTAINER_OF | ( | ptr, | |
type, | |||
member | |||
) | (type *)((char *)ptr - offsetof(type, member)) |
Container of macro (borrowed from Linux kernel).
This macro returns parent structure address basing on child member address.
ptr | Address of child type. |
type | Type of parent structure. |
member | Name of child field in parent structure. |
#define FIELD_ARRAY_SIZE | ( | struct_type, | |
field | |||
) | (FIELD_SIZE(struct_type, field) / FIELD_SIZE(struct_type, field[0])) |
Number of elements in field array in declared structure.
Macro that returns number of elementy in structure field.
struct_type | Variable type to get the field size from |
field | Field name to analyze. |
#define FIELD_SIZE | ( | struct_type, | |
field | |||
) | sizeof(((struct struct_type*)NULL)->field) |
Size of a field in declared structure.
Macro that returns the size of the structure field.
struct_type | Variable type to get the field size from |
field | Field name to analyze. It can be even field inside field (field.somethingelse.and_another). |
#define GET_ARG_1 | ( | a1, | |
a2 | |||
) | a1 |
Macro for getting first of 2 parameters.
[in] | a1 | First parameter. |
[in] | a2 | Second parameter. |
#define GET_ARG_2 | ( | a1, | |
a2 | |||
) | a2 |
Macro for getting second of 2 parameters.
[in] | a1 | First parameter. |
[in] | a2 | Second parameter. |
#define GET_ARGS_AFTER_1 | ( | ... | ) | GET_ARGS_AFTER_1_(__VA_ARGS__, ) |
Get all the arguments but the first one.
... | Arguments to select |
#define GET_VA_ARG_1 | ( | ... | ) | GET_VA_ARG_1_(__VA_ARGS__, ) |
Get the first argument.
... | Arguments to select |
#define IS_POWER_OF_TWO | ( | A | ) | ( ((A) != 0) && ((((A) - 1) & (A)) == 0) ) |
Macro for checking if an integer is a power of two.
[in] | A | Number to be tested. |
#define MACRO_MAP | ( | ... | ) | MACRO_MAP_(__VA_ARGS__) |
Mapping macro.
Macro that process all arguments using given macro
... | Macro name to be used for argument processing followed by arguments to process. Macro should have following form: MACRO(argument) |
#define MACRO_MAP_FOR | ( | ... | ) | MACRO_MAP_FOR_(__VA_ARGS__) |
Mapping macro with current index.
Basically macro similar to MACRO_MAP, but the processing function would get an argument and current argument index (beginning from 0).
... | Macro name to be used for argument processing followed by arguments to process. Macro should have following form: MACRO(argument, index) |
#define MACRO_MAP_FOR_N | ( | N, | |
... | |||
) | MACRO_MAP_FOR_N_(N, __VA_ARGS__) |
Mapping N arguments macro with current index.
Macro is similar to MACRO_MAP_FOR but maps exact number of arguments. If there is more arguments given, the rest would be ignored.
N | Number of arguments to map |
... | Macro name to be used for argument processing followed by arguments to process. Macro should have following form: MACRO(argument, index) |
#define MACRO_MAP_FOR_PARAM | ( | param, | |
... | |||
) | MACRO_MAP_FOR_PARAM_(param, __VA_ARGS__) |
Mapping macro with current index and parameter.
Version of MACRO_MAP_FOR that passes also the same parameter to all macros.
param | Parameter that would be passed to each macro call during mapping. |
... | Macro name to be used for argument processing followed by arguments to process. Macro should have following form: MACRO(argument, index, param) |
#define MACRO_MAP_FOR_PARAM_N | ( | N, | |
param, | |||
... | |||
) | MACRO_MAP_FOR_PARAM_N_(N, param, __VA_ARGS__) |
Mapping N arguments macro with with current index and parameter.
N | Number of arguments to map |
param | Parameter that would be passed to each macro call during mapping. |
... | Macro name to be used for argument processing followed by arguments to process. Macro should have following form: MACRO(argument, index, param) |
#define MACRO_MAP_N | ( | N, | |
... | |||
) | MACRO_MAP_N_(N, __VA_ARGS__) |
Mapping N arguments macro.
Macro similar to MACRO_MAP but maps exact number of arguments. If there is more arguments given, the rest would be ignored.
N | Number of arguments to map |
... | Macro name to be used for argument processing followed by arguments to process. Macro should have following form: MACRO(argument) |
#define MACRO_MAP_REC | ( | ... | ) | MACRO_MAP_REC_(__VA_ARGS__) |
Mapping macro, recursive version.
Can be used in MACRO_MAP macro
#define MACRO_MAP_REC_N | ( | N, | |
... | |||
) | MACRO_MAP_REC_N_(N, __VA_ARGS__) |
Mapping N arguments macro, recursive version.
Can be used in MACRO_MAP_N macro
#define MACRO_REPEAT | ( | count, | |
macro, | |||
... | |||
) | MACRO_REPEAT_(count, macro, __VA_ARGS__) |
Repeating macro.
count | Count of repeats. |
macro | Macro must have the following form: MACRO(arguments). |
... | Arguments passed to the macro. |
#define MACRO_REPEAT_FOR | ( | count, | |
macro, | |||
... | |||
) | MACRO_REPEAT_FOR_(count, macro, __VA_ARGS__) |
Repeating macro with current index.
Macro similar to MACRO_REPEAT but the processing function gets the arguments and the current argument index (beginning from 0).
count | Count of repeats. |
macro | Macro must have the following form: MACRO(index, arguments). |
... | Arguments passed to the macro. |
#define MSEC_TO_UNITS | ( | TIME, | |
RESOLUTION | |||
) | (((TIME) * 1000) / (RESOLUTION)) |
Macro for converting milliseconds to ticks.
[in] | TIME | Number of milliseconds to convert. |
[in] | RESOLUTION | Unit to be converted to in [us/ticks]. |
#define NUM_IS_MORE_THAN_1 | ( | N | ) | NUM_IS_MORE_THAN_1_(N) |
Check if given numeric value is bigger than 1.
This macro accepts numeric value, that may be the result of argument expansion. This numeric value is then converted to 0 if it is lover than 1 or to 1 if its value is higher than 1. The generated result can be used to glue it into other macro mnemonic name.
N | Numeric value to check |
#define NUM_VA_ARGS | ( | ... | ) |
Macro to get the number of arguments in a call variadic macro call.
param[in] ... List of arguments
Number | of variadic arguments in the argument list |
#define NUM_VA_ARGS_IS_MORE_THAN_1 | ( | ... | ) | NUM_IS_MORE_THAN_1(NUM_VA_ARGS(__VA_ARGS__)) |
Check if number of parameters is more than 1.
... | Arguments to count |
#define NUM_VA_ARGS_LESS_1 | ( | ... | ) |
Macro to get the number of arguments in a call variadic macro call. First argument is not counted.
param[in] ... List of arguments
Number | of variadic arguments in the argument list |
#define PARAM_CBRACE | ( | p | ) | { p }, |
Adding curly brace to the macro parameter.
Useful in array of structures initialization.
p | Parameter to put into the curly brace. |
#define ROUNDED_DIV | ( | A, | |
B | |||
) | (((A) + ((B) / 2)) / (B)) |
Macro for performing rounded integer division (as opposed to truncating the result).
[in] | A | Numerator. |
[in] | B | Denominator. |
#define STATIC_ASSERT | ( | EXPR | ) | STATIC_ASSERT_MSG((EXPR), static_assert_) |
Macro for doing static (i.e. compile time) assertion.
[in] | EXPR | Constant expression to be verified. |
#define STATIC_ASSERT_MSG | ( | EXPR, | |
MSG | |||
) | ;enum { STRING_CONCATENATE(MSG, __LINE__) = 1 / (!!(EXPR)) } |
Macro for doing static (i.e. compile time) assertion.
[in] | EXPR | Constant expression to be verified. |
[in] | MSG | Name of the static assert. |
#define STRING_CONCATENATE | ( | lhs, | |
rhs | |||
) | STRING_CONCATENATE_IMPL(lhs, rhs) |
Macro used to concatenate string using delayed macro expansion.
[in] | lhs | Left hand side in concatenation |
[in] | rhs | Right hand side in concatenation |
#define STRING_CONCATENATE_IMPL | ( | lhs, | |
rhs | |||
) | lhs ## rhs |
Implementation specific macro for delayed macro expansion used in string concatenation.
[in] | lhs | Left hand side in concatenation |
[in] | rhs | Right hand side in concatenation |
#define WORD_ALIGNED_MEM_BUFF | ( | NAME, | |
MIN_SIZE | |||
) | static uint32_t NAME[CEIL_DIV(MIN_SIZE, sizeof(uint32_t))] |
Macro for creating a buffer aligned to 4 bytes.
[in] | NAME | Name of the buffor. |
[in] | MIN_SIZE | Size of this buffor (it will be rounded up to multiples of 4 bytes). |
anonymous enum |
|
static |
Function for converting the input voltage (in milli volts) into percentage of 3.0 Volts.
The calculation is based on a linearized version of the battery's discharge curve. 3.0V returns 100% battery level. The limit for power failure is 2.1V and is considered to be the lower boundary.
The discharge curve for CR2032 is non-linear. In this model it is split into 4 linear sections:
These numbers are by no means accurate. Temperature and load in the actual application is not accounted for!
[in] | mvolts | The voltage in mV |
|
static |
Function for decoding a date_time value.
[in] | len | length of the field to be decoded. |
[in] | p_encoded_data | Buffer where the encoded data is stored. |
[in] | p_date_time | pointer to the decoded value |
|
static |
Function for decoding a date_time value.
[in] | p_date_time | pointer to the date_time structure to encode. |
[in] | p_encoded_data | pointer to the encoded data |
|
static |
Function for decoding a utf8_str value.
[in] | len | length of the field to be decoded. |
[in] | p_encoded_data | Buffer where the encoded data is stored. |
[in] | p_decoded_val | pointer to the decoded value |
|
static |
Function for encoding a utf8_str value.
[in] | p_value | Value to be encoded. |
[out] | p_encoded_data | Buffer where the encoded data is to be written. |
|
static |
Function for decoding a int16 value.
[in] | len | length of the field to be decoded. |
[in] | p_encoded_data | Buffer where the encoded data is stored. |
[in] | p_decoded_val | pointer to the decoded value |
|
static |
Function for decoding a regcertdatalist value.
[in] | len | length of the field to be decoded. |
[in] | p_encoded_data | Buffer where the encoded data is stored. |
[in] | p_decoded_val | pointer to the decoded value |
|
static |
Function for encoding a regcertdatalist value.
[in] | p_value | Value to be encoded. |
[out] | p_encoded_data | Buffer where the encoded data is to be written. |
|
static |
Function for decoding a sfloat value.
[in] | len | length of the field to be decoded. |
[in] | p_encoded_data | Buffer where the encoded data is stored. |
[in] | p_decoded_val | pointer to the decoded value |
|
static |
Function for encoding a sfloat value.
[in] | p_value | Value to be encoded. |
[out] | p_encoded_data | Buffer where the encoded data is to be written. |
|
static |
Function for decoding a uint16 value.
[in] | len | length of the field to be decoded. |
[in] | p_encoded_data | Buffer where the encoded data is stored. |
[in] | p_decoded_val | pointer to the decoded value |
|
static |
Function for encoding a uint16 value.
[in] | p_value | Value to be encoded. |
[out] | p_encoded_data | Buffer where the encoded data is to be written. |
|
static |
Function for decoding a uint24 value.
[in] | len | length of the field to be decoded. |
[in] | p_encoded_data | Buffer where the encoded data is stored. |
[in] | p_decoded_val | pointer to the decoded value |
|
static |
Function for encoding a uint24 value.
[in] | p_value | Value to be encoded. |
[out] | p_encoded_data | Buffer where the encoded data is to be written. |
|
static |
Function for decoding a uint32 value.
[in] | len | length of the field to be decoded. |
[in] | p_encoded_data | Buffer where the encoded data is stored. |
[in] | p_decoded_val | pointer to the decoded value |
|
static |
Function for encoding a uint32 value.
[in] | p_value | Value to be encoded. |
[out] | p_encoded_data | Buffer where the encoded data is to be written. |
|
static |
Function for decoding a uint40 value.
[in] | len | length of the field to be decoded. |
[in] | p_encoded_data | Buffer where the encoded data is stored. |
[in] | p_decoded_val | pointer to the decoded value |
|
static |
Function for encoding a uint40 value.
[in] | p_value | Value to be encoded. |
[out] | p_encoded_data | Buffer where the encoded data is to be written. |
|
static |
Function for decoding a uint8_array value.
[in] | len | length of the field to be decoded. |
[in] | p_encoded_data | Buffer where the encoded data is stored. |
[in] | p_decoded_val | pointer to the decoded value |
|
static |
Function for encoding a uint8_array value.
[in] | p_value | Value to be encoded. |
[out] | p_encoded_data | Buffer where the encoded data is to be written. |
|
static |
Function for checking if provided address is located in stack space.
[in] | ptr | Pointer to be checked. |
|
static |
Function for checking if a pointer value is aligned to a 4 byte boundary.
[in] | p | Pointer value to be checked. |
|
static |
Function for decoding a uint16 value in big-endian format.
[in] | p_encoded_data | Buffer where the encoded data is stored. |
|
static |
Function for encoding an uint16 value in big-endian format.
[in] | value | Value to be encoded. |
[out] | p_encoded_data | Buffer where the encoded data will be written. |
|
static |
Function for decoding a uint16 value.
[in] | p_encoded_data | Buffer where the encoded data is stored. |
|
static |
Function for encoding a uint16 value.
[in] | value | Value to be encoded. |
[out] | p_encoded_data | Buffer where the encoded data is to be written. |
|
static |
Function for decoding a three-byte value.
[in] | p_encoded_data | Buffer where the encoded data is stored. |
|
static |
Function for encoding a three-byte value.
[in] | value | Value to be encoded. |
[out] | p_encoded_data | Buffer where the encoded data is to be written. |
|
static |
Function for decoding a uint32 value in big-endian format.
[in] | p_encoded_data | Buffer where the encoded data is stored. |
|
static |
Function for encoding a uint32 value in big-endian format.
[in] | value | Value to be encoded. |
[out] | p_encoded_data | Buffer where the encoded data will be written. |
|
static |
Function for decoding a uint32 value.
[in] | p_encoded_data | Buffer where the encoded data is stored. |
|
static |
Function for encoding a uint32 value.
[in] | value | Value to be encoded. |
[out] | p_encoded_data | Buffer where the encoded data is to be written. |
|
static |
Function for decoding a uint48 value.
[in] | p_encoded_data | Buffer where the encoded data is stored. |
|
static |
Function for encoding a uint48 value.
[in] | value | Value to be encoded. |
[out] | p_encoded_data | Buffer where the encoded data is to be written. |
|
static |
Function for changing the value unit.
[in] | value | Value to be rescaled. |
[in] | old_unit_reversal | Reversal of the incoming unit. |
[in] | new_unit_reversal | Reversal of the desired unit. |