Skip to content

Commit 830daf0

Browse files
ABOSTMfpistm
authored andcommitted
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 <[email protected]>
1 parent 0303f55 commit 830daf0

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

libraries/Wire/src/Wire.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ extern "C" {
2727

2828
#include "Wire.h"
2929

30+
// Distinguish master from slave.
31+
// 0x01 is a reserved value, and thus cannot be used by slave devices
32+
static const uint8_t MASTER_ADDRESS = 0x01;
33+
3034
// Constructors ////////////////////////////////////////////////////////////////
3135

3236
TwoWire::TwoWire()

libraries/Wire/src/Wire.h

-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ extern "C" {
3030

3131
#define BUFFER_LENGTH 32
3232

33-
#define MASTER_ADDRESS 0x33
34-
3533
// WIRE_HAS_END means Wire has end()
3634
#define WIRE_HAS_END 1
3735

0 commit comments

Comments
 (0)