Skip to content

Commit 847a471

Browse files
committed
Added BUFFER_LENGTH macro in Wire.h
Added this macro to simplify changing the buffer size Matching [AVR core](https://github.com/arduino/ArduinoCore-avr/blob/master/libraries/Wire/src/Wire.h#L29) and [Arduino docs](https://support.arduino.cc/hc/en-us/articles/4406686928786-Modify-the-buffer-size-of-the-Wire-library)
1 parent 8983308 commit 847a471

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: libraries/Wire/Wire.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#include "variant.h"
2525
#include "SERCOM.h"
2626

27+
#define BUFFER_LENGTH 256
28+
2729
// WIRE_HAS_END means Wire has end()
2830
#define WIRE_HAS_END 1
2931

@@ -74,10 +76,10 @@ class TwoWire : public HardwareI2C
7476
bool transmissionBegun;
7577

7678
// RX Buffer
77-
arduino::RingBufferN<256> rxBuffer;
79+
arduino::RingBufferN<BUFFER_LENGTH> rxBuffer;
7880

7981
//TX buffer
80-
arduino::RingBufferN<256> txBuffer;
82+
arduino::RingBufferN<BUFFER_LENGTH> txBuffer;
8183
uint8_t txAddress;
8284

8385
// Callback user functions

0 commit comments

Comments
 (0)