added some math functions (min, max, clamp)
parent
78ea77179f
commit
ec1068f461
|
@ -25,6 +25,15 @@ static const char* APP_TAG="CINEKID_LEDS";
|
||||||
printf("\n");\
|
printf("\n");\
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int min(int a, int b) { return a < b ? a : b; }
|
||||||
|
static inline
|
||||||
|
int max(int a, int b) { return a > b ? a : b; }
|
||||||
|
static inline
|
||||||
|
int clamp(int x, int mi, int ma) {
|
||||||
|
return max(mi, min(ma, x));
|
||||||
|
}
|
||||||
|
|
||||||
#define GLOBAL(__a) (uint8_t)(__a|0xE0)
|
#define GLOBAL(__a) (uint8_t)(__a|0xE0)
|
||||||
|
|
||||||
#endif // !_shared_h
|
#endif // !_shared_h
|
||||||
|
|
Loading…
Reference in New Issue