Skip to content

Commit 733eef3

Browse files
committed
Increase buffer indexing variable size
I looked over the users of these variables and they should be fine with no additional changes. The existing methods already have an option to use size_t rather than uint8_t. There's a few methods which return int instead of size_t, which isn't great from a portability perspective but will be fine since this only is designed to run on the ESP8266.
1 parent e7660b0 commit 733eef3

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Diff for: libraries/Wire/Wire.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ extern "C" {
4141
// Initialize Class Variables //////////////////////////////////////////////////
4242

4343
uint8_t TwoWire::rxBuffer[I2C_BUFFER_LENGTH];
44-
uint8_t TwoWire::rxBufferIndex = 0;
45-
uint8_t TwoWire::rxBufferLength = 0;
44+
size_t TwoWire::rxBufferIndex = 0;
45+
size_t TwoWire::rxBufferLength = 0;
4646

4747
uint8_t TwoWire::txAddress = 0;
4848
uint8_t TwoWire::txBuffer[I2C_BUFFER_LENGTH];
49-
uint8_t TwoWire::txBufferIndex = 0;
50-
uint8_t TwoWire::txBufferLength = 0;
49+
size_t TwoWire::txBufferIndex = 0;
50+
size_t TwoWire::txBufferLength = 0;
5151

5252
uint8_t TwoWire::transmitting = 0;
5353
void (*TwoWire::user_onRequest)(void);

Diff for: libraries/Wire/Wire.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ class TwoWire : public Stream
3838
{
3939
private:
4040
static uint8_t rxBuffer[];
41-
static uint8_t rxBufferIndex;
42-
static uint8_t rxBufferLength;
41+
static size_t rxBufferIndex;
42+
static size_t rxBufferLength;
4343

4444
static uint8_t txAddress;
4545
static uint8_t txBuffer[];
46-
static uint8_t txBufferIndex;
47-
static uint8_t txBufferLength;
46+
static size_t txBufferIndex;
47+
static size_t txBufferLength;
4848

4949
static uint8_t transmitting;
5050
static void (*user_onRequest)(void);

0 commit comments

Comments
 (0)