mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-23 08:06:13 +01:00
Update IO_VL53L0X.h
Configure XSHUT control so that the pull-up on the module raises the pin to +2.8V rather than trying to drive it to +5V.
This commit is contained in:
parent
4deb323802
commit
c3675367ed
14
IO_VL53L0X.h
14
IO_VL53L0X.h
|
@ -177,16 +177,18 @@ protected:
|
||||||
break;
|
break;
|
||||||
case STATE_RESTARTMODULE:
|
case STATE_RESTARTMODULE:
|
||||||
// On second entry, set XSHUT pin high to allow this module to restart.
|
// On second entry, set XSHUT pin high to allow this module to restart.
|
||||||
// On some modules, there is a diode in series with the XSHUT pin to
|
// I've observed that the device tends to randomly reset if the XSHUT
|
||||||
// protect the low-voltage pin against +5V, but we can provide additional
|
// pin is set high from a 5V arduino, even through a pullup resistor.
|
||||||
// protection by enabling the pull-up resistor on the microcontroller
|
// Assume that there will be a pull-up on the XSHUT pin to +2.8V as
|
||||||
// instead of driving the output directly.
|
// recommended in the device datasheet. Then we only need to
|
||||||
|
// turn our output pin high-impedence (by making it an input) and the
|
||||||
|
// on-board pullup will do its job.
|
||||||
// Ensure XSHUT is set for only one module at a time by using a
|
// Ensure XSHUT is set for only one module at a time by using a
|
||||||
// shared flag accessible to all device instances.
|
// shared flag accessible to all device instances.
|
||||||
if (!_addressConfigInProgress) {
|
if (!_addressConfigInProgress) {
|
||||||
_addressConfigInProgress = true;
|
_addressConfigInProgress = true;
|
||||||
// Set XSHUT pin (if connected) to bring the module out of sleep mode.
|
// Configure XSHUT pin (if connected) to bring the module out of sleep mode.
|
||||||
if (_xshutPin != VPIN_NONE) IODevice::configureInput(_xshutPin, true);
|
if (_xshutPin != VPIN_NONE) IODevice::configureInput(_xshutPin, false);
|
||||||
// Allow the module time to restart
|
// Allow the module time to restart
|
||||||
delayUntil(currentMicros+10000);
|
delayUntil(currentMicros+10000);
|
||||||
_nextState = STATE_CONFIGUREADDRESS;
|
_nextState = STATE_CONFIGUREADDRESS;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user