SAE Teensy ECU
IIT SAE Microcontroller programming
Loading...
Searching...
No Matches
PPHelp.h
Go to the documentation of this file.
1
11
// @cond
12
#ifndef __ECU_PPHELP_H__
13
#define __ECU_PPHELP_H__
14
15
#define CONCAT(A, B) A##B
16
#define EXPAND_CONCAT(A, B) CONCAT(A, B)
17
18
#define PP_ARG_N( \
19
_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
20
_11, _12, _13, _14, _15, _16, _17, _18, _19, _20, \
21
_21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \
22
_31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \
23
_41, _42, _43, _44, _45, _46, _47, _48, _49, _50, \
24
_51, _52, _53, _54, _55, _56, _57, _58, _59, _60, \
25
_61, _62, _63, N, ...) N
26
27
#define PP_RSEQ_N() \
28
63, 62, 61, 60, \
29
59, 58, 57, 56, 55, 54, 53, 52, 51, 50, \
30
49, 48, 47, 46, 45, 44, 43, 42, 41, 40, \
31
39, 38, 37, 36, 35, 34, 33, 32, 31, 30, \
32
29, 28, 27, 26, 25, 24, 23, 22, 21, 20, \
33
19, 18, 17, 16, 15, 14, 13, 12, 11, 10, \
34
9, 8, 7, 6, 5, 4, 3, 2, 1, 0
35
36
#define PP_NARG_(...) PP_ARG_N(__VA_ARGS__)
37
#define PP_NARG(...) PP_NARG_(__VA_ARGS__, PP_RSEQ_N())
38
#define PP_NARG_MO(...) PP_NARG_(__VA_ARGS__ PP_RSEQ_N())
39
40
#define CAT(a, ...) PRIMITIVE_CAT(a, __VA_ARGS__)
41
#define PRIMITIVE_CAT(a, ...) a##__VA_ARGS__
42
#define M(...) CAT(__VA_ARGS__)
43
44
#define EVAL(...) EVAL1024(__VA_ARGS__)
45
#define EVAL1024(...) EVAL512(EVAL512(__VA_ARGS__))
46
#define EVAL512(...) EVAL256(EVAL256(__VA_ARGS__))
47
#define EVAL256(...) EVAL128(EVAL128(__VA_ARGS__))
48
#define EVAL128(...) EVAL64(EVAL64(__VA_ARGS__))
49
#define EVAL64(...) EVAL32(EVAL32(__VA_ARGS__))
50
#define EVAL32(...) EVAL16(EVAL16(__VA_ARGS__))
51
#define EVAL16(...) EVAL8(EVAL8(__VA_ARGS__))
52
#define EVAL8(...) EVAL4(EVAL4(__VA_ARGS__))
53
#define EVAL4(...) EVAL2(EVAL2(__VA_ARGS__))
54
#define EVAL2(...) EVAL1(EVAL1(__VA_ARGS__))
55
#define EVAL1(...) __VA_ARGS__
56
57
#define STRINGIZE(x) #x
58
#define EMPTY()
59
#define EXPAND(x) x
60
61
#define float_map(x, in_min, in_max, out_min, out_max) (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
62
63
#define pwrtwo(x) (1 << (x))
64
65
// #define DEC(x) DEC_##x
66
// #define DEC_1 0
67
// #define DEC_2 1
68
// #define DEC_3 2
69
// #define DEC_4 3
70
// #define DEC_5 4
71
// #define DEC_6 5
72
// #define DEC_7 6
73
// #define DEC_8 7
74
// #define DEC_9 8
75
// #define DEC_10 9
76
77
#endif
// __ECU_PPHELP_H__
78
79
// @endcond
libraries
PPHelp
PPHelp.h
Generated by
1.9.8