Skip to content

Commit

Permalink
Increase buffer indexing variable size
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
flaviut committed Dec 7, 2021
1 parent e7660b0 commit 733eef3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions libraries/Wire/Wire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ extern "C" {
// Initialize Class Variables //////////////////////////////////////////////////

uint8_t TwoWire::rxBuffer[I2C_BUFFER_LENGTH];
uint8_t TwoWire::rxBufferIndex = 0;
uint8_t TwoWire::rxBufferLength = 0;
size_t TwoWire::rxBufferIndex = 0;
size_t TwoWire::rxBufferLength = 0;

uint8_t TwoWire::txAddress = 0;
uint8_t TwoWire::txBuffer[I2C_BUFFER_LENGTH];
uint8_t TwoWire::txBufferIndex = 0;
uint8_t TwoWire::txBufferLength = 0;
size_t TwoWire::txBufferIndex = 0;
size_t TwoWire::txBufferLength = 0;

uint8_t TwoWire::transmitting = 0;
void (*TwoWire::user_onRequest)(void);
Expand Down
8 changes: 4 additions & 4 deletions libraries/Wire/Wire.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ class TwoWire : public Stream
{
private:
static uint8_t rxBuffer[];
static uint8_t rxBufferIndex;
static uint8_t rxBufferLength;
static size_t rxBufferIndex;
static size_t rxBufferLength;

static uint8_t txAddress;
static uint8_t txBuffer[];
static uint8_t txBufferIndex;
static uint8_t txBufferLength;
static size_t txBufferIndex;
static size_t txBufferLength;

static uint8_t transmitting;
static void (*user_onRequest)(void);
Expand Down

0 comments on commit 733eef3

Please sign in to comment.