i2c driver for VL6180x distance sensor
vl6180x.h
- Committer:
- sillevl
- Date:
- 2015-12-19
- Revision:
- 1:6a00afc8dc84
- Parent:
- 0:84c73bed7d92
- Child:
- 2:2e0406672e67
File content as of revision 1:6a00afc8dc84:
#pragma once #include "mbed.h" class VL6180x { public: struct Identification { char model; char modelRevMajor; char modelRevMinor; char moduleRevMajor; char moduleRevMinor; int date; int time; }; VL6180x(PinName sda, PinName scl, char _address = 0xE0); VL6180x(I2C &i2c, char address = 0xE0 ); void initialize(); int getDistance(); float getAmbientLight(); Identification getIdentification(); static void printIdentification(Identification id); void setRegister(int register, int value); int getRegister(int reg); void setAddress(int address); protected: int address; I2C i2c; static const int I2C_SLAVE_DEFAULT_ADDRESS = 0x52; static const int I2C_SLAVE_DEVICE_ADDRESS = 0x212; static const int INTERLEAVED_MODE_ENABLE = 0x2A3; };