From af5c1e3902e0eb79789af976d708a92cbbe21423 Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Thu, 13 Oct 2016 14:37:43 +0100 Subject: [PATCH] Added ARRAYEND and DEBUG_SET utilities --- src/main/build/debug.h | 2 ++ src/main/common/utils.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/main/build/debug.h b/src/main/build/debug.h index 42745e9e89..408aece237 100644 --- a/src/main/build/debug.h +++ b/src/main/build/debug.h @@ -21,6 +21,8 @@ extern int16_t debug[DEBUG16_VALUE_COUNT]; extern uint8_t debugMode; +#define DEBUG_SET(mode, index, value) {if (debugMode == (mode)) {debug[(index)] = (value);}} + #define DEBUG_SECTION_TIMES #ifdef DEBUG_SECTION_TIMES diff --git a/src/main/common/utils.h b/src/main/common/utils.h index 27a51f3984..2b9d7d66e4 100644 --- a/src/main/common/utils.h +++ b/src/main/common/utils.h @@ -21,6 +21,7 @@ #include #define ARRAYLEN(x) (sizeof(x) / sizeof((x)[0])) +#define ARRAYEND(x) (&(x)[ARRAYLEN(x)]) #define CONCAT_HELPER(x,y) x ## y #define CONCAT(x,y) CONCAT_HELPER(x, y)