@@ -40,7 +40,7 @@ class sfeTkArdI2C : public sfeTkII2C
4040 /*
4141 @brief Constructor
4242 */
43- sfeTkArdI2C (void ) : _i2cPort(nullptr )
43+ sfeTkArdI2C (void ) : _i2cPort(nullptr ), _bufferChunkSize{ kDefaultBufferChunk }
4444 {
4545 }
4646
@@ -163,10 +163,43 @@ class sfeTkArdI2C : public sfeTkII2C
163163 */
164164 sfeTkError_t readRegisterRegion (uint8_t devReg, uint8_t *data, size_t numBytes);
165165
166+ // Buffer size chunk getter/setter
167+ /* --------------------------------------------------------------------------
168+ @brief set the buffer chunk size
169+
170+ @note default size is 32
171+
172+ @param theChunk the new size - must be > 0
173+
174+ */
175+ void setBufferChunkSize (size_t theChunk)
176+ {
177+ if (theChunk > 0 )
178+ _bufferChunkSize = theChunk;
179+ }
180+
181+ /* --------------------------------------------------------------------------
182+ @brief set the buffer chunk size
183+
184+ @retval The current chunk size
185+
186+ */
187+ size_t bufferChunkSize (void )
188+ {
189+ return _bufferChunkSize;
190+ }
191+
166192 protected:
167193 // note: The wire port is protected, allowing access if a sub-class is
168194 // created to implement a special read/write routine
169195 //
170196 // The actual Arduino i2c port
171197 TwoWire *_i2cPort;
198+
199+ private:
200+ static constexpr size_t kDefaultBufferChunk = 32 ;
201+
202+ // the I2C buffer chunker size
203+
204+ size_t _bufferChunkSize;
172205};
0 commit comments