Merge pull request #2984 from blckmn/timer_simplified

Simplify timer definitions
This commit is contained in:
J Blackman 2017-05-06 13:23:19 +10:00 committed by GitHub
commit b9347e8a79
2 changed files with 519 additions and 643 deletions

View File

@ -27,6 +27,9 @@
#define CONCAT_HELPER(x,y) x ## y #define CONCAT_HELPER(x,y) x ## y
#define CONCAT(x,y) CONCAT_HELPER(x, y) #define CONCAT(x,y) CONCAT_HELPER(x, y)
#define CONCAT2(_1,_2) CONCAT(_1, _2)
#define CONCAT3(_1,_2,_3) CONCAT(CONCAT(_1, _2), _3)
#define CONCAT4(_1,_2,_3,_4) CONCAT(CONCAT3(_1, _2, _3), _4)
#define STR_HELPER(x) #x #define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x) #define STR(x) STR_HELPER(x)
@ -34,6 +37,18 @@
#define EXPAND_I(x) x #define EXPAND_I(x) x
#define EXPAND(x) EXPAND_I(x) #define EXPAND(x) EXPAND_I(x)
// expand to t if bit is 1, f when bit is 0. Other bit values are not supported
#define PP_IIF(bit, t, f) PP_IIF_I(bit, t, f)
#define PP_IIF_I(bit, t, f) PP_IIF_ ## bit(t, f)
#define PP_IIF_0(t, f) f
#define PP_IIF_1(t, f) t
// Expand all argumens and call macro with them. When expansion of some argument contains ',', it will be passed as multiple arguments
// #define TAKE3(_1,_2,_3) CONCAT3(_1,_2,_3)
// #define MULTI2 A,B
// PP_CALL(TAKE3, MULTI2, C) expands to ABC
#define PP_CALL(macro, ...) macro(__VA_ARGS__)
#if !defined(UNUSED) #if !defined(UNUSED)
#define UNUSED(x) (void)(x) #define UNUSED(x) (void)(x)
#endif #endif

File diff suppressed because it is too large Load Diff