Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of X_NUCLEO_53L0A1 by
Revision 11:ceaa5a026412, committed 2017-06-12
- Comitter:
- JerrySzczurak
- Date:
- Mon Jun 12 13:59:20 2017 +0000
- Parent:
- 10:faf8d62ce6d1
- Child:
- 12:f6e2bad00dc7
- Commit message:
- Change to vl53lO class: aligning ARM mbed codding standard. Deprecated functions kept for backward compatibility.
Changed in this revision
--- a/Components/VL53L0X/vl53l0x_class.cpp Wed Jun 07 14:58:36 2017 +0000
+++ b/Components/VL53L0X/vl53l0x_class.cpp Mon Jun 12 13:59:20 2017 +0000
@@ -5030,8 +5030,7 @@
return 0;
}
-
-int VL53L0X::ReadID(uint8_t *id)
+int VL53L0X::read_id(uint8_t *id)
{
int status = 0;
uint16_t rl_id=0;
@@ -5042,6 +5041,11 @@
return -1;
}
+
+int VL53L0X::ReadID(uint8_t *id)
+{
+ return read_id(id);
+}
VL53L0X_Error VL53L0X::WaitMeasurementDataReady(VL53L0X_DEV Dev)
--- a/Components/VL53L0X/vl53l0x_class.h Wed Jun 07 14:58:36 2017 +0000
+++ b/Components/VL53L0X/vl53l0x_class.h Mon Jun 12 13:59:20 2017 +0000
@@ -61,7 +61,7 @@
#define STATUS_FAIL 0x01
-#define VL53L0X_OsDelay(...) HAL_Delay(2)
+#define VL53L0X_OsDelay(...) wait_ms(2) // 2 msec delay. can also use wait(float secs)/wait_us(int)
#ifdef USE_EMPTY_STRING
#define VL53L0X_STRING_DEVICE_INFO_NAME ""
@@ -303,7 +303,7 @@
* @param[in] &pin_gpio1 pin Mbed InterruptIn PinName to be used as component GPIO_1 INT
* @param[in] DevAddr device address, 0x29 by default
*/
- VL53L0X(DevI2C &i2c, DigitalOut &pin, PinName pin_gpio1, uint8_t DevAddr=DEFAULT_DEVICE_ADDRESS) : RangeSensor(), dev_i2c(i2c), gpio0(&pin)
+ VL53L0X(DevI2C &i2c, DigitalOut &pin, PinName pin_gpio1, uint8_t DevAddr=DEFAULT_DEVICE_ADDRESS) : dev_i2c(i2c), gpio0(&pin)
{
MyDevice.I2cDevAddr=DevAddr;
MyDevice.comms_type=1; // VL53L0X_COMMS_I2C
@@ -320,7 +320,7 @@
* @param[in] pin_gpio1 pin Mbed InterruptIn PinName to be used as component GPIO_1 INT
* @param[in] device address, 0x29 by default
*/
- VL53L0X(DevI2C &i2c, STMPE1600DigiOut &pin, PinName pin_gpio1, uint8_t DevAddr=DEFAULT_DEVICE_ADDRESS) : RangeSensor(), dev_i2c(i2c), expgpio0(&pin)
+ VL53L0X(DevI2C &i2c, STMPE1600DigiOut &pin, PinName pin_gpio1, uint8_t DevAddr=DEFAULT_DEVICE_ADDRESS) : dev_i2c(i2c), expgpio0(&pin)
{
MyDevice.I2cDevAddr=DevAddr;
MyDevice.comms_type=1; // VL53L0X_COMMS_I2C
@@ -479,6 +479,7 @@
// return 1;
}
+
/**
*
* @brief One time device initialization
@@ -495,9 +496,16 @@
* @param void
* @return 0 on success, @a #CALIBRATION_WARNING if failed
*/
+ virtual int init(void *init)
+ {
+ return VL53L0X_DataInit(Device);
+ }
+
+/** deprecated Init funtion from ComponentObject. for backward compatibility
+*/
virtual int Init(void * NewAddr)
{
- return VL53L0X_DataInit(Device);
+ return init(NewAddr);
}
/**
@@ -687,7 +695,7 @@
* @param pRange_mm Pointer to range distance
* @return 0 on success
*/
- virtual int GetDistance(uint32_t *piData)
+ virtual int get_distance(uint32_t *piData)
{
int status=0;
VL53L0X_RangingMeasurementData_t pRangingMeasurementData;
@@ -707,7 +715,11 @@
StopMeasurement(range_single_shot_polling);
return status;
}
-
+/* Deprecated funtion from RangeSensor class. For backward compatibility*/
+ virtual int GetDistance(uint32_t *piData)
+ {
+ return get_distance(piData);
+ }
/**
* @brief Configure ranging interrupt reported to application
*
@@ -1339,9 +1351,13 @@
uint8_t *Revision,
VL53L0X_DeviceInfo_t *pVL53L0X_DeviceInfo);
- /* Read function of the ID device */
-// virtual int ReadID();
+ /* deprecated Read function from Component class for backward compatibility*/
+ // virtual int ReadID();
virtual int ReadID(uint8_t *id);
+
+ /* Read function of the ID device */
+ // virtual int read_id();
+ virtual int read_id(uint8_t *id);
VL53L0X_Error WaitMeasurementDataReady(VL53L0X_DEV Dev);
VL53L0X_Error WaitStopCompleted(VL53L0X_DEV Dev);
--- a/ST_INTERFACES.lib Wed Jun 07 14:58:36 2017 +0000 +++ b/ST_INTERFACES.lib Mon Jun 12 13:59:20 2017 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/ST/code/ST_INTERFACES/#e2bf4d06a8fc +https://developer.mbed.org/teams/ST/code/ST_INTERFACES/#d3c9b33b992c
--- a/X_NUCLEO_COMMON.lib Wed Jun 07 14:58:36 2017 +0000 +++ b/X_NUCLEO_COMMON.lib Mon Jun 12 13:59:20 2017 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/ST/code/X_NUCLEO_COMMON/#12be3dfc15fd +https://developer.mbed.org/teams/ST/code/X_NUCLEO_COMMON/#0dbcdb8dab03
--- a/x_nucleo_53l0a1.cpp Wed Jun 07 14:58:36 2017 +0000
+++ b/x_nucleo_53l0a1.cpp Mon Jun 12 13:59:20 2017 +0000
@@ -119,4 +119,3 @@
else
return 0;
}
-
