| | |
| | | extern "C" { |
| | | #endif |
| | | |
| | | /* |
| | | * Stringify the expression |
| | | */ |
| | | #define __PAN_STRINGIFY(x) #x |
| | | #define PAN_STRINGIFY(s) __PAN_STRINGIFY(s) |
| | | |
| | | /* |
| | | * Concatenate the values of the arguments into one |
| | | */ |
| | | #define __PAN_CONCAT(x, y) x ## y |
| | | #define PAN_CONCAT(x, y) __PAN_CONCAT(x, y) |
| | | |
| | | |
| | | /* Used internally by PAN_COND_CODE_1 and PAN_COND_CODE_0. */ |
| | | #define __PAN_COND_CODE_1(_flag, _if_1_code, _else_code) \ |
| | | __PAN_COND_CODE(_AAAAA##_flag, _if_1_code, _else_code) |
| | | #define __PAN_COND_CODE_0(_flag, _if_0_code, _else_code) \ |
| | | __PAN_COND_CODE(_BBBBB##_flag, _if_0_code, _else_code) |
| | | #define _AAAAA1 _ZZZZZ, |
| | | #define _BBBBB0 _ZZZZZ, |
| | | #define __PAN_COND_CODE(one_or_two_args, _if_code, _else_code) \ |
| | | __PAN_GET_ARG2_DEBRACKET(one_or_two_args _if_code, _else_code) |
| | | /* Gets second argument and removes brackets around that argument. It |
| | | is expected that the parameter is provided in brackets/parentheses. */ |
| | | #define __PAN_GET_ARG2_DEBRACKET(ignore_this, val, ...) __PAN_DEBRACKET val |
| | | /* Used to remove brackets from around a single argument. */ |
| | | #define __PAN_DEBRACKET(...) __VA_ARGS__ |
| | | |
| | | /** |
| | | * @brief Insert code depending on whether _flag expands to 1 or not. |
| | | * |
| | | * As the result of _flag expansion, results in either _if_1_code |
| | | * or _else_code is expanded. |
| | | * |
| | | * To prevent the preprocessor from treating commas as argument |
| | | * separators, the _if_1_code and _else_code expressions must be |
| | | * inside brackets/parentheses: (). These are stripped away |
| | | * during macro expansion. |
| | | * |
| | | * @param _flag evaluated flag |
| | | * @param _if_1_code result if _flag expands to 1; must be in parentheses |
| | | * @param _else_code result otherwise; must be in parentheses |
| | | */ |
| | | #define PAN_COND_CODE_1(_flag, _if_1_code, _else_code) \ |
| | | __PAN_COND_CODE_1(_flag, _if_1_code, _else_code) |
| | | |
| | | /** |
| | | * @brief Like PAN_COND_CODE_1() except tests if _flag is 0. |
| | | * |
| | | * This is like PAN_COND_CODE_1(), except that it tests whether _flag |
| | | * expands to the integer literal 0. It expands to _if_0_code if |
| | | * so, and _else_code otherwise; both of these must be enclosed in |
| | | * parentheses. |
| | | * |
| | | * @param _flag evaluated flag |
| | | * @param _if_0_code result if _flag expands to 0; must be in parentheses |
| | | * @param _else_code result otherwise; must be in parentheses |
| | | * @see PAN_COND_CODE_1() |
| | | */ |
| | | #define PAN_COND_CODE_0(_flag, _if_0_code, _else_code) \ |
| | | __PAN_COND_CODE_0(_flag, _if_0_code, _else_code) |
| | | |
| | | |
| | | typedef struct _adc_vbg_kb |
| | | { |
| | | uint16_t __attribute__((packed)) adc_vbg_k; |
| | |
| | | |
| | | extern bool isFtDataValid; |
| | | extern uint32_t SystemCoreClock; |
| | | extern uint32_t vec_remap_adr; |
| | | |
| | | /** |
| | | * Update SystemCoreClock variable |