Skip to content

Commit

Permalink
Update vl53l8cx_class.h
Browse files Browse the repository at this point in the history
Signed-off-by: Carlo Parata <carlo.parata@st.com>
  • Loading branch information
cparata authored Jun 18, 2024
1 parent cf908ae commit 57d3bb6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/vl53l8cx_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ class VL53L8CX {
}
if (_dev.platform.i2c_rst_pin >= 0) {
pinMode(_dev.platform.i2c_rst_pin, OUTPUT);
digitalWrite(_dev.platform.i2c_rst_pin, LOW);
if (_dev.platform.dev_i2c) {
digitalWrite(_dev.platform.i2c_rst_pin, LOW);
}
if (_dev.platform.dev_spi) {
digitalWrite(_dev.platform.i2c_rst_pin, HIGH);
}
}

if (_dev.platform.dev_spi) {
Expand Down Expand Up @@ -165,7 +170,7 @@ class VL53L8CX {
*/
virtual void vl53l8cx_i2c_reset(void)
{
if (_dev.platform.i2c_rst_pin >= 0) {
if (_dev.platform.dev_i2c && _dev.platform.i2c_rst_pin >= 0) {
digitalWrite(_dev.platform.i2c_rst_pin, LOW);
delay(10);
digitalWrite(_dev.platform.i2c_rst_pin, HIGH);
Expand Down

0 comments on commit 57d3bb6

Please sign in to comment.