Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Adafruit_BusIO_Register.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,12 @@ Adafruit_BusIO_Register::Adafruit_BusIO_Register(
/*!
* @brief Write a buffer of data to the register location
* @param buffer Pointer to data to write
* @param len Number of bytes to write
* @param len Number of bytes to write - don't exceed maxbuffersize()
* which may be as small as 32 bytes
* @return True on successful write (only really useful for I2C as SPI is
* uncheckable)
*/
bool Adafruit_BusIO_Register::write(uint8_t *buffer, uint8_t len) {
bool Adafruit_BusIO_Register::write(uint8_t *buffer, size_t len) {
uint8_t addrbuffer[2] = {(uint8_t)(_address & 0xFF),
(uint8_t)(_address >> 8)};
if (_i2cdevice) {
Expand Down Expand Up @@ -216,7 +217,7 @@ uint32_t Adafruit_BusIO_Register::readCached(void) { return _cached; }
@param len Number of bytes to read into the buffer
@return true on successful read, otherwise false
*/
bool Adafruit_BusIO_Register::read(uint8_t *buffer, uint8_t len) {
bool Adafruit_BusIO_Register::read(uint8_t *buffer, size_t len) {
uint8_t addrbuffer[2] = {(uint8_t)(_address & 0xFF),
(uint8_t)(_address >> 8)};
if (_i2cdevice) {
Expand Down
4 changes: 2 additions & 2 deletions Adafruit_BusIO_Register.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ class Adafruit_BusIO_Register {
uint8_t byteorder = LSBFIRST,
uint8_t address_width = 1);

bool read(uint8_t *buffer, uint8_t len);
bool read(uint8_t *buffer, size_t len);
bool read(uint8_t *value);
bool read(uint16_t *value);
uint32_t read(void);
uint32_t readCached(void);
bool write(uint8_t *buffer, uint8_t len);
bool write(uint8_t *buffer, size_t len);
bool write(uint32_t value, uint8_t numbytes = 0);

uint8_t width(void);
Expand Down
8 changes: 5 additions & 3 deletions Adafruit_I2CDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Adafruit_I2CDevice::Adafruit_I2CDevice(uint8_t addr, TwoWire *theWire) {
_maxBufferSize = 250; // as defined in Wire.h's RingBuffer
#elif defined(ESP32)
_maxBufferSize = I2C_BUFFER_LENGTH;
#elif defined(TwoWireKinetis_h) || defined(TwoWireIMXRT_h) // Teensy 3.x || 4.x
_maxBufferSize = BUFFER_LENGTH;
#else
_maxBufferSize = 32;
#endif
Expand Down Expand Up @@ -174,7 +176,7 @@ bool Adafruit_I2CDevice::write(const uint8_t *buffer, size_t len, bool stop,

/*!
* @brief Read from I2C into a buffer from the I2C device.
* Cannot be more than maxBufferSize() bytes.
* Unlimited length, in chunks of maxBufferSize() bytes.
* @param buffer Pointer to buffer of data to read into
* @param len Number of bytes from buffer to read.
* @param stop Whether to send an I2C STOP signal on read
Expand Down Expand Up @@ -235,8 +237,8 @@ bool Adafruit_I2CDevice::_read(uint8_t *buffer, size_t len, bool stop) {

/*!
* @brief Write some data, then read some data from I2C into another buffer.
* Cannot be more than maxBufferSize() bytes. The buffers can point to
* same/overlapping locations.
* Written buffer cannot be more than maxBufferSize() bytes. The buffers
* can point to same/overlapping locations.
* @param write_buffer Pointer to buffer of data to write from
* @param write_len Number of bytes from buffer to write.
* @param read_buffer Pointer to buffer of data to read into.
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Adafruit BusIO
version=1.17.4
version=1.17.5
author=Adafruit
maintainer=Adafruit <[email protected]>
sentence=This is a library for abstracting away UART, I2C and SPI interfacing
Expand Down