![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
This library allows you to read from multiple VL53L1X sensors.
Fork of VL53L1X_Pololu by
Diff: VL53L1X.h
- Revision:
- 1:e54ded4af43a
- Parent:
- 0:76ea242a637f
- Child:
- 2:f570ff03fb81
diff -r 76ea242a637f -r e54ded4af43a VL53L1X.h --- a/VL53L1X.h Mon Jul 30 18:45:53 2018 +0000 +++ b/VL53L1X.h Wed Aug 08 21:44:33 2018 +0000 @@ -7,7 +7,7 @@ { public: Timer t; - VL53L1X(PinName SDA, PinName SCL); + VL53L1X(PinName SDA, PinName SCL, PinName shutDown); // register addresses from API vl53l1x_register_map.h enum regAddr : uint16_t @@ -1301,7 +1301,7 @@ // assumes interrupt is active low (GPIO_HV_MUX__CTRL bit 4 is 1) bool dataReady() { int isThereData = readReg(GPIO__TIO_HV_STATUS); - printf("%x\r\n", isThereData); + // printf("%x\r\n", isThereData); return (isThereData & 0x01) == 0; } @@ -1311,10 +1311,16 @@ uint16_t getTimeout() { return io_timeout; } bool timeoutOccurred(); + bool initReading(int addr, int timing_budget); + void turnOff(void); + void resetPin(void); + void turnOn(void); + + private: I2C _i2c; - - + DigitalOut _shutDown; + // The Arduino two-wire interface uses a 7-bit number for the address, // and sets the last bit correctly based on reads and writes static const uint8_t AddressDefault = 0b0101001; @@ -1372,10 +1378,10 @@ DistanceMode distance_mode; // Record the current time to check an upcoming timeout against - void startTimeout() { timeout_start_ms = t.read()/10000; } + void startTimeout() { timeout_start_ms = t.read()*1000; } // Check if timeout is enabled (set to nonzero value) and has expired - bool checkTimeoutExpired() {return (io_timeout > 0) && ((uint16_t)(t.read()/10000 - timeout_start_ms) > io_timeout); } + bool checkTimeoutExpired() {return (io_timeout > 0) && ((uint16_t)(t.read()*1000 - timeout_start_ms) > io_timeout); } void setupManualCalibration(); void readResults();