Add function for MAP

This commit is contained in:
Candas1 2020-10-27 19:22:23 +01:00 committed by GitHub
parent 4fbf2549c9
commit 76a27b086c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -181,6 +181,8 @@
#define MIN3(a, b, c) MIN(a, MIN(b, c)) #define MIN3(a, b, c) MIN(a, MIN(b, c))
#define MAX3(a, b, c) MAX(a, MAX(b, c)) #define MAX3(a, b, c) MAX(a, MAX(b, c))
#define ARRAY_LEN(x) (uint32_t)(sizeof(x) / sizeof(*(x))) #define ARRAY_LEN(x) (uint32_t)(sizeof(x) / sizeof(*(x)))
#define MAP(x, in_min, in_max, out_min, out_max) ((((x - in_min) * (out_max - out_min)) / (in_max - in_min)) + out_min )
typedef struct { typedef struct {
uint16_t dcr; uint16_t dcr;