From 5f9db70b1b06f715f3fa38aeae9c71e1d7ff84b2 Mon Sep 17 00:00:00 2001 From: James Foster Date: Thu, 1 Jul 2021 08:47:51 -0700 Subject: [PATCH 1/2] Replace `#define yield() _NOP()` with `inline void yield() { _NOP(); }` so that other code can define a `yield()` function. --- cpp/arduino/Arduino.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cpp/arduino/Arduino.h b/cpp/arduino/Arduino.h index ad7d5a99..7061023a 100644 --- a/cpp/arduino/Arduino.h +++ b/cpp/arduino/Arduino.h @@ -36,11 +36,11 @@ typedef uint8_t byte; #define highByte(w) ((uint8_t) ((w) >> 8)) #define lowByte(w) ((uint8_t) ((w) & 0xff)) -// might as well use that NO-op macro for these, while unit testing -// you need interrupts? interrupt yourself -#define yield() _NOP() -#define interrupts() _NOP() -#define noInterrupts() _NOP() +// using #define for these makes it impossible for other code to use as function +// names! +inline void yield() { _NOP(); } +inline void interrupts() { _NOP(); } +inline void noInterrupts() { _NOP(); } // TODO: correctly establish this per-board! #define F_CPU 1000000UL From e52667ed67831c9d0e45849c29eb258573a7f16d Mon Sep 17 00:00:00 2001 From: James Foster Date: Thu, 1 Jul 2021 08:49:33 -0700 Subject: [PATCH 2/2] CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f29be1a6..8f63503f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Changed - Change 266 files from CRLF to LF. +- Replace `#define yield() _NOP()` with `inline void yield() { _NOP(); }` so that other code can define a `yield()` function. ### Deprecated