Skip to content

Commit db88956

Browse files
committed
add maxBufferSize for I2C
1 parent 4163884 commit db88956

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Adafruit_I2CDevice.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Adafruit_I2CDevice::Adafruit_I2CDevice(uint8_t addr, TwoWire *theWire)
2626
_addr = addr;
2727
_begun = false;
2828
_i2c_bus_dev = RT_NULL;
29+
_maxBufferSize = 32;
2930
}
3031

3132
/*!

Adafruit_I2CDevice.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class Adafruit_I2CDevice
2929
uint8_t _addr;
3030
bool _begun;
3131
struct rt_i2c_bus_device *_i2c_bus_dev;
32+
size_t _maxBufferSize;
3233

3334
public:
3435
Adafruit_I2CDevice(uint8_t addr, TwoWire *theWire = &Wire);
@@ -43,6 +44,10 @@ class Adafruit_I2CDevice
4344
uint8_t *read_buffer, size_t read_len,
4445
bool stop = false);
4546
bool setSpeed(uint32_t desiredclk);
47+
48+
/*! @brief How many bytes we can read in a transaction
49+
* @return The size of the Wire receive/transmit buffer */
50+
size_t maxBufferSize() { return _maxBufferSize; }
4651
};
4752

4853
#endif /* RTDUINO_USING_WIRE */

0 commit comments

Comments
 (0)