Add unified BCD macros for SPD and (in the future) VPCEXT

This commit is contained in:
RichardG867
2020-07-25 13:19:24 -03:00
parent 4d621e2f4f
commit 01b6662809
2 changed files with 9 additions and 7 deletions

View File

@@ -45,8 +45,11 @@
# define ENABLE_LOG_COMMANDS 1
#endif
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define BCD8(x) ((((x) / 10) << 4) | ((x) % 10))
#define BCD16(x) ((((x) / 1000) << 12) | (((x) / 100) << 8) | BCD8(x))
#define BCD32(x) ((((x) / 10000000) << 28) | (((x) / 1000000) << 24) | (((x) / 100000) << 20) | (((x) / 10000) << 16) | BCD16(x))
#ifdef __cplusplus
extern "C" {