Skip to content

Commit 565ee43

Browse files
committed
feat: increase i2c max burst
1 parent d3a735b commit 565ee43

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/BMI270.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ int8_t BoschSensorClass::configure_sensor(struct bmm150_dev *dev)
282282

283283
int8_t BoschSensorClass::bmi2_i2c_read(uint8_t reg_addr, uint8_t *reg_data, uint32_t len, void *intf_ptr)
284284
{
285-
if ((reg_data == NULL) || (len == 0) || (len > 32)) {
285+
if ((reg_data == NULL) || (len == 0) || (len > 250)) {
286286
return -1;
287287
}
288288
uint8_t bytes_received;
@@ -308,18 +308,15 @@ int8_t BoschSensorClass::bmi2_i2c_read(uint8_t reg_addr, uint8_t *reg_data, uint
308308

309309
int8_t BoschSensorClass::bmi2_i2c_write(uint8_t reg_addr, const uint8_t *reg_data, uint32_t len, void *intf_ptr)
310310
{
311-
if ((reg_data == NULL) || (len == 0) || (len > 32)) {
311+
if ((reg_data == NULL) || (len == 0) || (len > 250)) {
312312
return -1;
313313
}
314314

315315
struct dev_info* dev_info = (struct dev_info*)intf_ptr;
316316
uint8_t dev_id = dev_info->dev_addr;
317317
dev_info->_wire->beginTransmission(dev_id);
318318
dev_info->_wire->write(reg_addr);
319-
for (uint16_t i = 0; i < len; i++)
320-
{
321-
dev_info->_wire->write(reg_data[i]);
322-
}
319+
dev_info->_wire->write(reg_data, (size_t)len);
323320
if (dev_info->_wire->endTransmission() != 0) {
324321
return -1;
325322
}

0 commit comments

Comments
 (0)