From 85f59dcc376518fd90719334a7f80863a044b9b5 Mon Sep 17 00:00:00 2001 From: noah-jonathan rosa Date: Fri, 26 Apr 2019 09:35:45 +0200 Subject: [PATCH] Bugfix for registers>0x00FF --- library.properties | 2 +- src/vl53l1x_class.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/library.properties b/library.properties index ac3e0d3..54e5e2e 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=STM32duino VL53L1X -version=1.0.2 +version=1.0.3 author=AST maintainer=stm32duino sentence=Allows controlling the VL53L1X (Time-of-Flight and gesture detection sensor) diff --git a/src/vl53l1x_class.cpp b/src/vl53l1x_class.cpp index 17fdad9..28d4a90 100644 --- a/src/vl53l1x_class.cpp +++ b/src/vl53l1x_class.cpp @@ -1044,8 +1044,8 @@ VL53L1X_ERROR VL53L1X::VL53L1_I2CWrite(uint8_t DeviceAddr, uint16_t RegisterAddr Serial.println(RegisterAddr); #endif uint8_t buffer[2]; - buffer[0]=(uint8_t) RegisterAddr>>8; - buffer[1]=(uint8_t) RegisterAddr&0xFF; + buffer[0]=(uint8_t) (RegisterAddr>>8); + buffer[1]=(uint8_t) (RegisterAddr&0xFF); dev_i2c->write(buffer, 2); for (uint16_t i = 0 ; i < NumByteToWrite ; i++) dev_i2c->write(pBuffer[i]); @@ -1070,8 +1070,8 @@ VL53L1X_ERROR VL53L1X::VL53L1_I2CRead(uint8_t DeviceAddr, uint16_t RegisterAddr, Serial.println(RegisterAddr); #endif uint8_t buffer[2]; - buffer[0]=(uint8_t) RegisterAddr>>8; - buffer[1]=(uint8_t) RegisterAddr&0xFF; + buffer[0]=(uint8_t) (RegisterAddr>>8); + buffer[1]=(uint8_t) (RegisterAddr&0xFF); dev_i2c->write(buffer, 2); status = dev_i2c->endTransmission(false); //Fix for some STM32 boards