INSAT Mini Project
Dependencies: ST_INTERFACES X_NUCLEO_COMMON
Fork of X_NUCLEO_6180XA1 by
Diff: Components/VL6180X/vl6180x_class.h
- Revision:
- 8:f943a1fca15f
- Parent:
- 7:2dc81120c917
- Child:
- 9:9cbc1736f148
--- a/Components/VL6180X/vl6180x_class.h Fri Sep 25 12:12:51 2015 +0200 +++ b/Components/VL6180X/vl6180x_class.h Tue Sep 29 14:50:15 2015 +0200 @@ -42,12 +42,12 @@ #include "RangeSensor.h" #include "LightSensor.h" #include "DevI2C.h" //temporaneo fino alla creazione della classe x_nucleo_6180xa1 -#include "vl6180x_api.h" -#include "vl6180x_cfg.h" -#include "vl6180x_def.h" -#include "vl6180x_types.h" +//#include "vl6180x_api.h" +//#include "vl6180x_cfg.h" +//#include "vl6180x_def.h" +//#include "vl6180x_types.h" #include "vl6180x_platform.h" -#include "vl6180x_appcfg.h" +//#include "vl6180x_appcfg.h" #include "STMPE1600_class.h" /** default device address */ @@ -69,16 +69,20 @@ VL6180X(DevI2C &i2c, DigitalOut &pin, uint8_t DevAddr=DEFAULT_DEVICE_ADDRESS) : RangeSensor(), LightSensor(), dev_i2c(i2c), gpio0(&pin) { - MyDeviceAddress=DevAddr; - Present=0; - Ready=0; +// MyDeviceAddress=DevAddr; + DevData.I2cAddr = DevAddr; + DevData.Present=0; + DevData.Ready=0; + expgpio0 = NULL; } VL6180X(DevI2C &i2c, STMPE1600DigiOut &pin, uint8_t DevAddr=DEFAULT_DEVICE_ADDRESS) : RangeSensor(), LightSensor(), dev_i2c(i2c), expgpio0(&pin) { - MyDeviceAddress=DevAddr; - Present=0; - Ready=0; +// MyDeviceAddress=DevAddr; + DevData.I2cAddr = DevAddr; + DevData.Present=0; + DevData.Ready=0; + gpio0 = NULL; } @@ -102,7 +106,7 @@ /*** Interface Methods ***/ /*virtual*/ int Init() { - return VL6180x_InitData(MyDeviceAddress); // ritorna 0 se corretto + return VL6180x_InitData(DevData); // ritorna 0 se corretto } /*virtual*/ int ReadID() @@ -126,7 +130,8 @@ MyDevice.Ready=1; } - /* + */ +/* virtual int GetRange(int *piData) { return VL6180X_GetRange(piData); } @@ -134,7 +139,7 @@ virtual int GetLight(int *piData) { return VL6180X_GetLight(piData); } - +*/ /* api.c functions */ int VL6180x_WaitDeviceBooted(VL6180xDev_t dev); int VL6180x_InitData(VL6180xDev_t dev ); @@ -201,7 +206,8 @@ /* Read functions from registers and write functions into registers */ int VL6180X_ReadID(); - int VL6180X_IO_Read(uint8_t *pBuffer, uint8_t RegisterAddress, uint16_t NumByteToRead); + int VL6180X_IO_Read(uint8_t *pBuffer, uint16_t RegisterAddress, uint16_t NumByteToRead); + int VL6180X_IO_Write(uint8_t *pBuffer, uint16_t RegisterAddress, uint16_t NumByteToWrite); /* Write and read functions from I2C */ int VL6180x_WrByte(VL6180xDev_t dev, uint16_t index, uint8_t data); @@ -221,10 +227,11 @@ DevI2C &dev_i2c; DigitalOut *gpio0; STMPE1600DigiOut *expgpio0; - - VL6180xDev_t MyDeviceAddress; - unsigned Present; - unsigned Ready; + + VL6180xDev_t DevData; +// VL6180xDev_t MyDeviceAddress; +// unsigned Present; +// unsigned Ready; };