File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 1010
1111#include " PCF8574.h"
1212
13- const int I2C_BUFFER_LENGTH = 30 ; // AVR limit - 1 for address
13+ #ifndef I2C_BUFFER_LENGTH
14+ #define I2C_BUFFER_LENGTH (32 )
15+ #endif
1416
1517
1618PCF8574::PCF8574 (const uint8_t deviceAddress, TwoWire *wire)
@@ -98,7 +100,7 @@ void PCF8574::write(const uint8_t pin, const uint8_t value)
98100// experimental 0.4.4
99101bool PCF8574::writeArray (uint8_t *array, uint8_t size)
100102{
101- if (size > I2C_BUFFER_LENGTH)
103+ if (size > ( I2C_BUFFER_LENGTH - 1 ) )
102104 {
103105 _error = PCF8574_BUFFER_LENGTH_ERROR;
104106 return false ;
@@ -117,7 +119,7 @@ bool PCF8574::writeArray(uint8_t *array, uint8_t size)
117119
118120bool PCF8574::readArray (uint8_t *array, uint8_t size)
119121{
120- if (size > I2C_BUFFER_LENGTH)
122+ if (size > ( I2C_BUFFER_LENGTH - 1 ) )
121123 {
122124 _error = PCF8574_BUFFER_LENGTH_ERROR;
123125 return false ;
You can’t perform that action at this time.
0 commit comments