added some math functions (min, max, clamp)

animation
Sara 2023-09-22 12:30:43 +02:00
parent 78ea77179f
commit ec1068f461
1 changed files with 9 additions and 0 deletions

View File

@ -25,6 +25,15 @@ static const char* APP_TAG="CINEKID_LEDS";
printf("\n");\
} 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)
#endif // !_shared_h