From 78bc023761635fbb8763f138ce8f2b74f815752e Mon Sep 17 00:00:00 2001 From: Alexandre Bourdiol Date: Mon, 18 Jan 2021 11:44:31 +0100 Subject: [PATCH] Wire: change definition of MASTER_ADDRESS to avoid potential conflict Define MASTER_ADDRESS in Wire.cpp to avoid potential conflict with other libraries. Use 0x01 for master as it is reserved for START and thus cannot be used by slave devices. Signed-off-by: Alexandre Bourdiol --- libraries/Wire/src/Wire.cpp | 4 ++++ libraries/Wire/src/Wire.h | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/Wire/src/Wire.cpp b/libraries/Wire/src/Wire.cpp index 99b1cc4ead..74037f709b 100644 --- a/libraries/Wire/src/Wire.cpp +++ b/libraries/Wire/src/Wire.cpp @@ -27,6 +27,10 @@ extern "C" { #include "Wire.h" +// Distinguish master from slave. +// 0x01 is a reserved value, and thus cannot be used by slave devices +static const uint8_t MASTER_ADDRESS = 0x01; + // Constructors //////////////////////////////////////////////////////////////// TwoWire::TwoWire() diff --git a/libraries/Wire/src/Wire.h b/libraries/Wire/src/Wire.h index dfeccfdd6d..dfba0aba69 100644 --- a/libraries/Wire/src/Wire.h +++ b/libraries/Wire/src/Wire.h @@ -30,8 +30,6 @@ extern "C" { #define BUFFER_LENGTH 32 -#define MASTER_ADDRESS 0x33 - // WIRE_HAS_END means Wire has end() #define WIRE_HAS_END 1