Skip to content

Commit 5b65497

Browse files
authored
Merge pull request #8 from NoahRosa/master
Bugfix for registers>0x00FF
2 parents cf46108 + 85f59dc commit 5b65497

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=STM32duino VL53L1X
2-
version=1.0.2
2+
version=1.0.3
33
author=AST
44
maintainer=stm32duino
55
sentence=Allows controlling the VL53L1X (Time-of-Flight and gesture detection sensor)

src/vl53l1x_class.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,8 +1044,8 @@ VL53L1X_ERROR VL53L1X::VL53L1_I2CWrite(uint8_t DeviceAddr, uint16_t RegisterAddr
10441044
Serial.println(RegisterAddr);
10451045
#endif
10461046
uint8_t buffer[2];
1047-
buffer[0]=(uint8_t) RegisterAddr>>8;
1048-
buffer[1]=(uint8_t) RegisterAddr&0xFF;
1047+
buffer[0]=(uint8_t) (RegisterAddr>>8);
1048+
buffer[1]=(uint8_t) (RegisterAddr&0xFF);
10491049
dev_i2c->write(buffer, 2);
10501050
for (uint16_t i = 0 ; i < NumByteToWrite ; i++)
10511051
dev_i2c->write(pBuffer[i]);
@@ -1070,8 +1070,8 @@ VL53L1X_ERROR VL53L1X::VL53L1_I2CRead(uint8_t DeviceAddr, uint16_t RegisterAddr,
10701070
Serial.println(RegisterAddr);
10711071
#endif
10721072
uint8_t buffer[2];
1073-
buffer[0]=(uint8_t) RegisterAddr>>8;
1074-
buffer[1]=(uint8_t) RegisterAddr&0xFF;
1073+
buffer[0]=(uint8_t) (RegisterAddr>>8);
1074+
buffer[1]=(uint8_t) (RegisterAddr&0xFF);
10751075
dev_i2c->write(buffer, 2);
10761076
status = dev_i2c->endTransmission(false);
10771077
//Fix for some STM32 boards

0 commit comments

Comments
 (0)