Greatly simplified Architecture, Identical Functions Removed: Platform Interfaces, STP6001 interface
Diff: VL53L0X.h
- Revision:
- 7:3a1115c2556b
- Parent:
- 6:fb11b746ceb5
- Child:
- 8:2fd7cb217068
--- a/VL53L0X.h Thu Jun 20 12:00:59 2019 +0000 +++ b/VL53L0X.h Thu Jun 20 12:54:25 2019 +0000 @@ -51,15 +51,11 @@ VL53L0X(I2C *i2c, DigitalOut *pin, PinName pin_gpio1, uint8_t dev_addr = VL53L0X_DEFAULT_ADDRESS) : _dev_i2c(i2c), _gpio0(pin) { - _my_device.I2cDevAddr = dev_addr; - _my_device.comms_type = 1; // VL53L0X_COMMS_I2C - _my_device.comms_speed_khz = 400; - _device = &_my_device; - if (pin_gpio1 != NC) { - _gpio1Int = new InterruptIn(pin_gpio1); - } else { - _gpio1Int = NULL; - } + I2cDevAddr = dev_addr; + comms_type = 1; // VL53L0X_COMMS_I2C + comms_speed_khz = 400; + if (pin_gpio1 != NC) { _gpio1Int = new InterruptIn(pin_gpio1); } + else { _gpio1Int = NULL; } } /** Destructor @@ -168,27 +164,6 @@ */ /** - * - * @brief One time device initialization - * - * To be called once and only once after device is brought out of reset (Chip enable) and booted. - * - * @par Function Description - * When not used after a fresh device "power up" or reset, it may return @a #CALIBRATION_WARNING - * meaning wrong calibration data may have been fetched from device that can result in ranging offset error\n - * If application cannot execute device reset or need to run VL53L0X_data_init multiple time - * then it must ensure proper offset calibration saving and restore on its own - * by using @a VL53L0X_get_offset_calibration_data_micro_meter() on first power up and then @a VL53L0X_set_offset_calibration_data_micro_meter() all all subsequent init - * - * @param void - * @return "0" on success, @a #CALIBRATION_WARNING if failed - */ - virtual int init(void *init) - { - return VL53L0X_data_init(_device); - } - - /** * @brief Prepare device for operation * @par Function Description * Does static initialization and reprogram common default settings \n @@ -258,12 +233,9 @@ { int status; - status = VL53L0X_set_device_address(_device, new_addr); - if (!status) { - _device->I2cDevAddr = new_addr; - } + status = VL53L0X_set_device_address(new_addr); + if (!status) { I2cDevAddr = new_addr; } return status; - } /** @@ -271,38 +243,12 @@ * * @par Function Description * Clear given interrupt cause by writing into register #SYSTEM_INTERRUPT_CLEAR register. - * @param dev The device - * @param int_clear Which interrupt source to clear. Use any combinations of #INTERRUPT_CLEAR_RANGING , #INTERRUPT_CLEAR_ALS , #INTERRUPT_CLEAR_ERROR. + * @param int_clear Which interrupt source to clear. Use any combinations of #INTERRUPT_CLEAR_RANGING , #INTERRUPT_CLEAR_ALS , #INTERRUPT_CLEAR_ERROR. * @return "0" on success */ int clear_interrupt(uint8_t int_clear) - { - return VL53L0X_clear_interrupt_mask(_device, int_clear); - } + { return VL53L0X_clear_interrupt_mask(int_clear); } - /** - * - * @brief Get the 53L0 device - * - * To be called to retrive the internal device descriptor to allow usage of - * low level API having device as parameter. To be called after set_device_address() - * (if any). - * - * @par Function Description - * To be called if low level API usage is needed as those functions requires - * device as a parameter.TICINIT. - * - * @note This function return a pointer to an object internal structure - * - * @param dev ptr to ptr to Device Handle - * @return VL53L0X_ERROR_NONE Success - * @return "Other error code" See ::VL53L0X_Error - */ - VL53L0X_Error vl53l0x_get_device(VL53L0X_DEV *dev) -{ - *dev = _device; - return VL53L0X_ERROR_NONE; -} /** * @@ -324,11 +270,11 @@ * * @note This function accesses to the device * - * @param dev Device Handle + * * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_data_init(VL53L0X_DEV dev); + VL53L0X_Error VL53L0X_data_init(void); /** * @brief Do basic device init (and eventually patch loading) @@ -338,11 +284,11 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_static_init(VL53L0X_DEV dev); + VL53L0X_Error VL53L0X_static_init(void); /** * @brief Perform Reference Calibration @@ -358,13 +304,13 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_vhv_settings Pointer to vhv settings parameter. * @param p_phase_cal Pointer to PhaseCal parameter. * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_perform_ref_calibration(VL53L0X_DEV dev, uint8_t *p_vhv_settings, + VL53L0X_Error VL53L0X_perform_ref_calibration( uint8_t *p_vhv_settings, uint8_t *p_phase_cal); /** @@ -375,16 +321,16 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_vhv_settings Pointer to VHV parameter * @param p_phase_cal Pointer to PhaseCal Parameter * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_ref_calibration(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_ref_calibration( uint8_t *p_vhv_settings, uint8_t *p_phase_cal); - VL53L0X_Error VL53L0X_set_ref_calibration(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_set_ref_calibration( uint8_t vhv_settings, uint8_t phase_cal); /** @@ -400,7 +346,7 @@ * @note This function change the device mode to * VL53L0X_DEVICEMODE_SINGLE_RANGING * - * @param dev Device Handle + * * @param ref_spad_count Reports ref Spad Count * @param is_aperture_spads Reports if spads are of type * aperture or non-aperture. @@ -409,7 +355,7 @@ * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the Ref Spad procedure. * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_perform_ref_spad_management(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_perform_ref_spad_management( uint32_t *ref_spad_count, uint8_t *is_aperture_spads); /** @@ -423,7 +369,7 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param refSpadCount Number of ref spads. * @param is_aperture_spads Defines if spads are of type * aperture or non-aperture. @@ -433,7 +379,7 @@ * spad configuration. * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_reference_spads(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_set_reference_spads( uint32_t refSpadCount, uint8_t is_aperture_spads); /** @@ -445,7 +391,7 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_spad_count Number ref Spad Count * @param p_is_aperture_spads Reports if spads are of type * aperture or non-aperture. @@ -455,7 +401,7 @@ * spad configuration. * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_reference_spads(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_reference_spads( uint32_t *p_spad_count, uint8_t *p_is_aperture_spads); /** @@ -467,13 +413,12 @@ * * @note This function Access to the device * - * @param dev Device Handle * @param p_offset_calibration_data_micro_meter Return part to part * calibration offset from device (microns) * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_offset_calibration_data_micro_meter(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_offset_calibration_data_micro_meter( int32_t *p_offset_calibration_data_micro_meter); /** * Set or over-hide part to part calibration offset @@ -481,19 +426,18 @@ * * @note This function Access to the device * - * @param dev Device Handle * @param p_offset_calibration_data_micro_meter Offset (microns) * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_offset_calibration_data_micro_meter(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_set_offset_calibration_data_micro_meter( int32_t offset_calibration_data_micro_meter); - VL53L0X_Error VL53L0X_perform_offset_calibration(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_perform_offset_calibration( FixPoint1616_t cal_distance_milli_meter, int32_t *p_offset_micro_meter); - VL53L0X_Error VL53L0X_perform_xtalk_calibration(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_perform_xtalk_calibration( FixPoint1616_t xtalk_cal_distance, FixPoint1616_t *p_xtalk_compensation_rate_mega_cps); @@ -513,7 +457,7 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param timeout_ms Histogram measurement duration. * @param p_xtalk_per_spad Output parameter containing the crosstalk * measurement result, in MCPS/Spad. @@ -527,40 +471,11 @@ * Must not be less than 10PCLKS. * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_perform_xtalk_measurement(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_perform_xtalk_measurement( uint32_t timeout_ms, FixPoint1616_t *p_xtalk_per_spad, uint8_t *p_ambient_too_high); /** - * @brief Enable/Disable Cross talk compensation feature - * - * @note This function is not Implemented. - * Enable/Disable Cross Talk by set to zero the Cross Talk value - * by using @a VL53L0X_SetXTalkCompensationRateMegaCps(). - * - * @param dev Device Handle - * @param x_talk_compensation_enable Cross talk compensation - * to be set 0=disabled else = enabled - * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented - */ - VL53L0X_Error VL53L0X_set_x_talk_compensation_enable(VL53L0X_DEV dev, - uint8_t x_talk_compensation_enable); - - /** - * @brief Get Cross talk compensation rate - * - * @note This function is not Implemented. - * Enable/Disable Cross Talk by set to zero the Cross Talk value by - * using @a VL53L0X_SetXTalkCompensationRateMegaCps(). - * - * @param dev Device Handle - * @param p_x_talk_compensation_enable Pointer to the Cross talk compensation - * state 0=disabled or 1 = enabled - * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented - */ - VL53L0X_Error VL53L0X_get_x_talk_compensation_enable(VL53L0X_DEV dev, - uint8_t *p_x_talk_compensation_enable); - /** * @brief Set Cross talk compensation rate * * @par Function Description @@ -568,7 +483,6 @@ * * @note This function Access to the device * - * @param dev Device Handle * @param x_talk_compensation_rate_mega_cps Compensation rate in * Mega counts per second * (16.16 fix point) see @@ -576,7 +490,7 @@ * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_x_talk_compensation_rate_mega_cps(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_set_x_talk_compensation_rate_mega_cps( FixPoint1616_t x_talk_compensation_rate_mega_cps); /** @@ -587,7 +501,6 @@ * * @note This function Access to the device * - * @param dev Device Handle * @param p_xtalk_compensation_rate_mega_cps Pointer to Compensation rate * in Mega counts per second * (16.16 fix point) see @@ -595,17 +508,31 @@ * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_x_talk_compensation_rate_mega_cps(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_x_talk_compensation_rate_mega_cps( FixPoint1616_t *p_xtalk_compensation_rate_mega_cps); /** + * @brief Get Cross talk enable + * + * Enable/Disable Cross Talk by set to zero the Cross Talk value by + * using @a VL53L0X_SetXTalkCompensationRateMegaCps(). + * + * @param dev Device Handle + * @param p_x_talk_compensation_enable Pointer to the Cross talk compensation + * state 0=disabled or 1 = enabled + * @return VL53L0X_ERROR_NONE Success + * @return "Other error code" See ::VL53L0X_Error + */ + VL53L0X_Error VL53L0X_get_x_talk_compensation_enable(uint8_t *p_x_talk_compensation_enable); + + /** * @brief Set a new device mode * @par Function Description * Set device to a new mode (ranging, histogram ...) * * @note This function doesn't Access to the device * - * @param dev Device Handle + * * @param device_mode New device mode to apply * Valid values are: * VL53L0X_DEVICEMODE_SINGLE_RANGING @@ -622,7 +549,7 @@ * DeviceMode is not in the * supported list */ - VL53L0X_Error VL53L0X_set_device_mode(VL53L0X_DEV dev, VL53L0X_DeviceModes device_mode); + VL53L0X_Error VL53L0X_set_device_mode( VL53L0X_DeviceModes device_mode); /** * @brief Get current new device mode @@ -631,7 +558,7 @@ * * @note This function doesn't Access to the device * - * @param dev Device Handle + * * @param p_device_mode Pointer to current apply mode value * Valid values are: * VL53L0X_DEVICEMODE_SINGLE_RANGING @@ -647,7 +574,7 @@ * DeviceMode is not in the * supported list */ - VL53L0X_Error VL53L0X_get_device_mode(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_device_mode( VL53L0X_DeviceModes *p_device_mode); /** @@ -655,7 +582,7 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param pin ID of the GPIO Pin * @param p_device_mode Pointer to Device Mode associated to the Gpio. * @param p_functionality Pointer to Pin functionality. @@ -676,7 +603,7 @@ * VL53L0X_GPIOFUNCTIONALITY_NEW_MEASURE_READY * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_gpio_config(VL53L0X_DEV dev, uint8_t pin, + VL53L0X_Error VL53L0X_get_gpio_config( uint8_t pin, VL53L0X_DeviceModes *p_device_mode, VL53L0X_GpioFunctionality *p_functionality, VL53L0X_InterruptPolarity *p_polarity); @@ -686,7 +613,7 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param pin ID of the GPIO Pin * @param functionality Select Pin functionality. * Refer to ::VL53L0X_GpioFunctionality @@ -705,7 +632,7 @@ * VL53L0X_GPIOFUNCTIONALITY_NEW_MEASURE_READY * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_gpio_config(VL53L0X_DEV dev, uint8_t pin, + VL53L0X_Error VL53L0X_set_gpio_config( uint8_t pin, VL53L0X_DeviceModes device_mode, VL53L0X_GpioFunctionality functionality, VL53L0X_InterruptPolarity polarity); @@ -721,7 +648,7 @@ * @note This function Access to the device * - * @param dev Device Handle + * * @return VL53L0X_ERROR_NONE Success * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when * DeviceMode programmed with @a VL53L0X_SetDeviceMode is not in the supported @@ -733,7 +660,7 @@ * @return VL53L0X_ERROR_TIME_OUT Time out on start measurement * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_start_measurement(VL53L0X_DEV dev); + VL53L0X_Error VL53L0X_start_measurement(void); /** * @brief Stop device measurement @@ -746,11 +673,11 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_stop_measurement(VL53L0X_DEV dev); + VL53L0X_Error VL53L0X_stop_measurement(void); /** * @brief Return device stop completion status @@ -761,12 +688,12 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_stop_status Pointer to status variable to update * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_stop_completed_status(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_stop_completed_status( uint32_t *p_stop_status); /** @@ -782,13 +709,13 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_measurement_data_ready Pointer to Measurement Data Ready. * 0=data not ready, 1 = data ready * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_measurement_data_ready(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_measurement_data_ready( uint8_t *p_measurement_data_ready); /** @@ -803,12 +730,12 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_ranging_measurement_data Pointer to the data structure to fill up. * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_ranging_measurement_data(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_ranging_measurement_data( VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data); /** @@ -819,14 +746,14 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param interrupt_mask Mask of interrupts to clear * @return VL53L0X_ERROR_NONE Success * @return VL53L0X_ERROR_INTERRUPT_NOT_CLEARED Cannot clear interrupts * * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_clear_interrupt_mask(VL53L0X_DEV dev, uint32_t interrupt_mask); + VL53L0X_Error VL53L0X_clear_interrupt_mask( uint32_t interrupt_mask); /** * @brief Return device interrupt status @@ -838,12 +765,12 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_interrupt_mask_status Pointer to status variable to update * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_interrupt_mask_status(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_interrupt_mask_status( uint32_t *p_interrupt_mask_status); /** @@ -863,12 +790,12 @@ * @note This function change the device mode to * VL53L0X_DEVICEMODE_SINGLE_RANGING * - * @param dev Device Handle + * * @param p_ranging_measurement_data Pointer to the data structure to fill up. * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_perform_single_ranging_measurement(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_perform_single_ranging_measurement( VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data); /** @@ -887,23 +814,23 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_perform_single_measurement(VL53L0X_DEV dev); + VL53L0X_Error VL53L0X_perform_single_measurement(void); /** * @brief Read current status of the error register for the selected device * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_device_error_status Pointer to current error code of the device * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_device_error_status(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_device_error_status( VL53L0X_DeviceError *p_device_error_status); /** @@ -933,11 +860,11 @@ VL53L0X_Error VL53L0X_get_range_status_string(uint8_t range_status, char *p_range_status_string); - VL53L0X_Error VL53L0X_get_total_signal_rate(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_total_signal_rate( VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data, FixPoint1616_t *p_total_signal_rate_mcps); - VL53L0X_Error VL53L0X_get_total_xtalk_rate(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_total_xtalk_rate( VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data, FixPoint1616_t *p_total_xtalk_rate_mcps); @@ -951,7 +878,7 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_measurement_timing_budget_micro_seconds Max measurement time in * microseconds. * Valid values are: @@ -960,7 +887,7 @@ * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_measurement_timing_budget_micro_seconds(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_measurement_timing_budget_micro_seconds( uint32_t *p_measurement_timing_budget_micro_seconds); /** @@ -972,7 +899,7 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param measurement_timing_budget_micro_seconds Max measurement time in * microseconds. * Valid values are: @@ -983,7 +910,7 @@ MeasurementTimingBudgetMicroSeconds out of range * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_measurement_timing_budget_micro_seconds(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_set_measurement_timing_budget_micro_seconds( uint32_t measurement_timing_budget_micro_seconds); /** @@ -995,7 +922,7 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param limit_check_id Limit Check ID * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). * @param p_limit_check_enable Pointer to the check limit enable @@ -1009,7 +936,7 @@ * when LimitCheckId value is out of range. * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_limit_check_enable(VL53L0X_DEV dev, uint16_t limit_check_id, + VL53L0X_Error VL53L0X_get_limit_check_enable( uint16_t limit_check_id, uint8_t *p_limit_check_enable); /** @@ -1021,7 +948,7 @@ * * @note This function doesn't Access to the device * - * @param dev Device Handle + * * @param limit_check_id Limit Check ID * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). * @param limit_check_enable if 1 the check limit @@ -1033,7 +960,7 @@ * when LimitCheckId value is out of range. * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_limit_check_enable(VL53L0X_DEV dev, uint16_t limit_check_id, + VL53L0X_Error VL53L0X_set_limit_check_enable( uint16_t limit_check_id, uint8_t limit_check_enable); /** @@ -1046,7 +973,7 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param limit_check_id Limit Check ID * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). * @param p_limit_check_value Pointer to Limit @@ -1056,7 +983,7 @@ * when LimitCheckId value is out of range. * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_limit_check_value(VL53L0X_DEV dev, uint16_t limit_check_id, + VL53L0X_Error VL53L0X_get_limit_check_value( uint16_t limit_check_id, FixPoint1616_t *p_limit_check_value); /** @@ -1068,7 +995,7 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param limit_check_id Limit Check ID * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). * @param limit_check_value Limit check Value for a given @@ -1078,7 +1005,7 @@ * LimitCheckId or LimitCheckValue value is out of range. * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_limit_check_value(VL53L0X_DEV dev, uint16_t limit_check_id, + VL53L0X_Error VL53L0X_set_limit_check_value( uint16_t limit_check_id, FixPoint1616_t limit_check_value); /** @@ -1092,7 +1019,7 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param limit_check_id Limit Check ID * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). * @param p_limit_check_current Pointer to current Value for a @@ -1102,7 +1029,7 @@ * LimitCheckId value is out of range. * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_limit_check_current(VL53L0X_DEV dev, uint16_t limit_check_id, + VL53L0X_Error VL53L0X_get_limit_check_current( uint16_t limit_check_id, FixPoint1616_t *p_limit_check_current); /** @@ -1115,7 +1042,7 @@ * * @note This function doesn't Access to the device * - * @param dev Device Handle + * * @param limit_check_id Limit Check ID (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). * @param p_limit_check_status Pointer to the @@ -1129,7 +1056,7 @@ returned when LimitCheckId value is out of range. * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_limit_check_status(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_limit_check_status( uint16_t limit_check_id, uint8_t *p_limit_check_status); /** @@ -1140,13 +1067,13 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_inter_measurement_period_milli_seconds Pointer to programmed * Inter-Measurement Period in milliseconds. * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_inter_measurement_period_milli_seconds(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_inter_measurement_period_milli_seconds( uint32_t *p_inter_measurement_period_milli_seconds); /** @@ -1157,13 +1084,13 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param inter_measurement_period_milli_seconds Inter-Measurement Period in ms. * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ VL53L0X_Error VL53L0X_set_inter_measurement_period_milli_seconds( - VL53L0X_DEV dev, uint32_t inter_measurement_period_milli_seconds); + uint32_t inter_measurement_period_milli_seconds); /** * @brief Set new device address @@ -1175,12 +1102,12 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param device_address The new Device address * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_device_address(VL53L0X_DEV dev, uint8_t device_address); + VL53L0X_Error VL53L0X_set_device_address( uint8_t device_address); /** * @brief Do an hard reset or soft reset (depending on implementation) of the @@ -1190,11 +1117,11 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_reset_device(VL53L0X_DEV dev); + VL53L0X_Error VL53L0X_reset_device(void); /** * @brief Get setup of Wrap around Check @@ -1204,13 +1131,13 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_wrap_around_check_enable Pointer to the Wrap around Check state * 0=disabled or 1 = enabled * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_wrap_around_check_enable(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_wrap_around_check_enable( uint8_t *p_wrap_around_check_enable); /** @@ -1218,13 +1145,13 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param wrap_around_check_enable Wrap around Check to be set * 0=disabled, other = enabled * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_wrap_around_check_enable(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_set_wrap_around_check_enable( uint8_t wrap_around_check_enable); /** @@ -1235,7 +1162,7 @@ * * @note This function Accesses the device * - * @param dev Device Handle + * * @param vcsel_period_type VCSEL period identifier (pre-range|final). * @param p_vcsel_pulse_period_pclk Pointer to VCSEL period value. * @return VL53L0X_ERROR_NONE Success @@ -1243,7 +1170,7 @@ * supported. * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_vcsel_pulse_period(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_vcsel_pulse_period( VL53L0X_VcselPeriod vcsel_period_type, uint8_t *p_vcsel_pulse_period_pclk); /** @@ -1254,7 +1181,7 @@ * * @note This function Accesses the device * - * @param dev Device Handle + * * @param vcsel_period_type VCSEL period identifier (pre-range|final). * @param vcsel_pulse_period VCSEL period value * @return VL53L0X_ERROR_NONE Success @@ -1262,7 +1189,7 @@ * supported. * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_vcsel_pulse_period(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_set_vcsel_pulse_period( VL53L0X_VcselPeriod vcsel_period_type, uint8_t vcsel_pulse_period); /** @@ -1277,14 +1204,14 @@ * * @note DeviceMode is ignored for the current device * - * @param dev Device Handle + * * @param device_mode Device Mode for which change thresholds * @param threshold_low Low threshold (mm, lux ..., depending on the mode) * @param threshold_high High threshold (mm, lux ..., depending on the mode) * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_interrupt_thresholds(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_set_interrupt_thresholds( VL53L0X_DeviceModes device_mode, FixPoint1616_t threshold_low, FixPoint1616_t threshold_high); @@ -1300,14 +1227,14 @@ * * @note DeviceMode is ignored for the current device * - * @param dev Device Handle + * * @param device_mode Device Mode from which read thresholds * @param p_threshold_low Low threshold (mm, lux ..., depending on the mode) * @param p_threshold_high High threshold (mm, lux ..., depending on the mode) * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_interrupt_thresholds(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_interrupt_thresholds( VL53L0X_DeviceModes device_mode, FixPoint1616_t *p_threshold_low, FixPoint1616_t *p_threshold_high); @@ -1316,13 +1243,13 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_VL53L0X_device_info Pointer to current device info for a given * Device * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_device_info(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_device_info( VL53L0X_DeviceInfo_t *p_VL53L0X_device_info); /** @@ -1333,12 +1260,12 @@ * * @note This function Accesses the device * - * @param dev Device Handle + * * @param p_scheduler_sequence_steps Pointer to struct containing result. * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_sequence_step_enables(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_sequence_step_enables( VL53L0X_SchedulerSequenceSteps_t *p_scheduler_sequence_steps); /** @@ -1349,7 +1276,7 @@ * * @note This function Accesses the device * - * @param dev Device Handle + * * @param sequence_step_id Sequence step identifier. * @param sequence_step_enabled Demanded state {0=Off,1=On} * is enabled. @@ -1358,7 +1285,7 @@ * supported. * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_sequence_step_enable(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_set_sequence_step_enable( VL53L0X_SequenceStepId sequence_step_id, uint8_t sequence_step_enabled); /** @@ -1372,13 +1299,13 @@ * * @note This function Accesses the device * - * @param dev Device Handle + * * @param p_enabled Output Parameter reporting the fraction enable state. * * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_fraction_enable(VL53L0X_DEV dev, uint8_t *p_enabled); + VL53L0X_Error VL53L0X_get_fraction_enable( uint8_t *p_enabled); /** * @brief Sets the resolution of range measurements. @@ -1388,13 +1315,13 @@ * * @note This function Accesses the device * - * @param dev Device Handle + * * @param enable Enable high resolution * * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_range_fraction_enable(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_set_range_fraction_enable( uint8_t enable); /** @@ -1414,7 +1341,7 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_product_revision_major Pointer to Product Revision Major * for a given Device * @param p_product_revision_minor Pointer to Product Revision Minor @@ -1422,7 +1349,7 @@ * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_product_revision(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_product_revision( uint8_t *p_product_revision_major, uint8_t *p_product_revision_minor); /** @@ -1433,12 +1360,12 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_device_parameters Pointer to store current device parameters. * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_device_parameters(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_device_parameters( VL53L0X_DeviceParameters_t *p_device_parameters); /** @@ -1473,13 +1400,13 @@ * * @note This function doesn't access to the device * - * @param dev Device Handle + * * @param p_pal_state Pointer to current state of the PAL for a * given Device * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_pal_state(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_pal_state( VL53L0X_State *p_pal_state); /** @@ -1500,65 +1427,51 @@ public: /* api.h functions */ - /** - * @brief Wait for device booted after chip enable (hardware standby) - * This function can be run only when VL53L0X_State is VL53L0X_STATE_POWERDOWN. - * - * @note This function is not Implemented - * - * @param dev Device Handle - * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented - * - */ - VL53L0X_Error VL53L0X_wait_device_booted(VL53L0X_DEV dev); - - - VL53L0X_Error sequence_step_enabled(VL53L0X_DEV dev, - VL53L0X_SequenceStepId sequence_step_id, uint8_t sequence_config, + VL53L0X_Error sequence_step_enabled(VL53L0X_SequenceStepId sequence_step_id, uint8_t sequence_config, uint8_t *p_sequence_step_enabled); - VL53L0X_Error VL53L0X_check_and_load_interrupt_settings(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_check_and_load_interrupt_settings( uint8_t start_not_stopflag); /* api_core.h functions */ - VL53L0X_Error VL53L0X_get_info_from_device(VL53L0X_DEV dev, uint8_t option); + VL53L0X_Error VL53L0X_get_info_from_device( uint8_t option); - VL53L0X_Error VL53L0X_device_read_strobe(VL53L0X_DEV dev); + VL53L0X_Error VL53L0X_device_read_strobe(void); - VL53L0X_Error wrapped_VL53L0X_get_measurement_timing_budget_micro_seconds(VL53L0X_DEV dev, + VL53L0X_Error wrapped_VL53L0X_get_measurement_timing_budget_micro_seconds( uint32_t *p_measurement_timing_budget_micro_seconds); - VL53L0X_Error wrapped_VL53L0X_get_vcsel_pulse_period(VL53L0X_DEV dev, + VL53L0X_Error wrapped_VL53L0X_get_vcsel_pulse_period( VL53L0X_VcselPeriod vcsel_period_type, uint8_t *p_vcsel_pulse_period_pclk); uint8_t VL53L0X_decode_vcsel_period(uint8_t vcsel_period_reg); uint32_t VL53L0X_decode_timeout(uint16_t encoded_timeout); - uint32_t VL53L0X_calc_timeout_us(VL53L0X_DEV dev, + uint32_t VL53L0X_calc_timeout_us( uint16_t timeout_period_mclks, uint8_t vcsel_period_pclks); - uint32_t VL53L0X_calc_macro_period_ps(VL53L0X_DEV dev, uint8_t vcsel_period_pclks); + uint32_t VL53L0X_calc_macro_period_ps( uint8_t vcsel_period_pclks); - VL53L0X_Error VL53L0X_measurement_poll_for_completion(VL53L0X_DEV dev); + VL53L0X_Error VL53L0X_measurement_poll_for_completion(void); - VL53L0X_Error VL53L0X_load_tuning_settings(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_load_tuning_settings( uint8_t *p_tuning_setting_buffer); - VL53L0X_Error VL53L0X_get_pal_range_status(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_pal_range_status( uint8_t device_range_status, FixPoint1616_t signal_rate, uint16_t effective_spad_rtn_count, VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data, uint8_t *p_pal_range_status); - VL53L0X_Error VL53L0X_calc_sigma_estimate(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_calc_sigma_estimate( VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data, FixPoint1616_t *p_sigma_estimate, uint32_t *p_dmax_mm); - uint32_t VL53L0X_calc_timeout_mclks(VL53L0X_DEV dev, + uint32_t VL53L0X_calc_timeout_mclks( uint32_t timeout_period_us, uint8_t vcsel_period_pclks); uint32_t VL53L0X_isqrt(uint32_t num); @@ -1566,7 +1479,7 @@ uint32_t VL53L0X_quadrature_sum(uint32_t a, uint32_t b); VL53L0X_Error VL53L0X_calc_dmax( - VL53L0X_DEV dev, + FixPoint1616_t total_signal_rate_mcps, FixPoint1616_t total_corr_signal_rate_mcps, FixPoint1616_t pw_mult, @@ -1574,43 +1487,43 @@ FixPoint1616_t sigma_estimate_p2, uint32_t peak_vcsel_duration_us, uint32_t *pd_max_mm); - VL53L0X_Error wrapped_VL53L0X_set_measurement_timing_budget_micro_seconds(VL53L0X_DEV dev, + VL53L0X_Error wrapped_VL53L0X_set_measurement_timing_budget_micro_seconds( uint32_t measurement_timing_budget_micro_seconds); - VL53L0X_Error get_sequence_step_timeout(VL53L0X_DEV dev, + VL53L0X_Error get_sequence_step_timeout( VL53L0X_SequenceStepId sequence_step_id, uint32_t *p_time_out_micro_secs); - VL53L0X_Error set_sequence_step_timeout(VL53L0X_DEV dev, + VL53L0X_Error set_sequence_step_timeout( VL53L0X_SequenceStepId sequence_step_id, uint32_t timeout_micro_secs); uint16_t VL53L0X_encode_timeout(uint32_t timeout_macro_clks); - VL53L0X_Error wrapped_VL53L0X_set_vcsel_pulse_period(VL53L0X_DEV dev, + VL53L0X_Error wrapped_VL53L0X_set_vcsel_pulse_period( VL53L0X_VcselPeriod vcsel_period_type, uint8_t vcsel_pulse_period_pclk); uint8_t lv53l0x_encode_vcsel_period(uint8_t vcsel_period_pclks); /* api_calibration.h functions */ - VL53L0X_Error VL53L0X_apply_offset_adjustment(VL53L0X_DEV dev); - VL53L0X_Error wrapped_VL53L0X_get_offset_calibration_data_micro_meter(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_apply_offset_adjustment(void); + VL53L0X_Error wrapped_VL53L0X_get_offset_calibration_data_micro_meter( int32_t *p_offset_calibration_data_micro_meter); - VL53L0X_Error wrapped_VL53L0X_set_offset_calibration_data_micro_meter(VL53L0X_DEV dev, + VL53L0X_Error wrapped_VL53L0X_set_offset_calibration_data_micro_meter( int32_t offset_calibration_data_micro_meter); - VL53L0X_Error wrapped_VL53L0X_perform_ref_spad_management(VL53L0X_DEV dev, + VL53L0X_Error wrapped_VL53L0X_perform_ref_spad_management( uint32_t *ref_spad_count, uint8_t *is_aperture_spads); - VL53L0X_Error VL53L0X_perform_ref_calibration(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_perform_ref_calibration( uint8_t *p_vhv_settings, uint8_t *p_phase_cal, uint8_t get_data_enable); - VL53L0X_Error VL53L0X_perform_vhv_calibration(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_perform_vhv_calibration( uint8_t *p_vhv_settings, const uint8_t get_data_enable, const uint8_t restore_config); - VL53L0X_Error VL53L0X_perform_single_ref_calibration(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_perform_single_ref_calibration( uint8_t vhv_init_byte); - VL53L0X_Error VL53L0X_ref_calibration_io(VL53L0X_DEV dev, uint8_t read_not_write, + VL53L0X_Error VL53L0X_ref_calibration_io( uint8_t read_not_write, uint8_t vhv_settings, uint8_t phase_cal, uint8_t *p_vhv_settings, uint8_t *p_phase_cal, const uint8_t vhv_enable, const uint8_t phase_enable); - VL53L0X_Error VL53L0X_perform_phase_calibration(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_perform_phase_calibration( uint8_t *p_phase_cal, const uint8_t get_data_enable, const uint8_t restore_config); - VL53L0X_Error enable_ref_spads(VL53L0X_DEV dev, + VL53L0X_Error enable_ref_spads( uint8_t aperture_spads, uint8_t good_spad_array[], uint8_t spad_array[], @@ -1624,17 +1537,17 @@ uint8_t is_aperture(uint32_t spad_index); VL53L0X_Error enable_spad_bit(uint8_t spad_array[], uint32_t size, uint32_t spad_index); - VL53L0X_Error set_ref_spad_map(VL53L0X_DEV dev, uint8_t *p_ref_spad_array); - VL53L0X_Error get_ref_spad_map(VL53L0X_DEV dev, uint8_t *p_ref_spad_array); - VL53L0X_Error perform_ref_signal_measurement(VL53L0X_DEV dev, + VL53L0X_Error set_ref_spad_map( uint8_t *p_ref_spad_array); + VL53L0X_Error get_ref_spad_map( uint8_t *p_ref_spad_array); + VL53L0X_Error perform_ref_signal_measurement( uint16_t *p_ref_signal_rate); - VL53L0X_Error wrapped_VL53L0X_set_reference_spads(VL53L0X_DEV dev, + VL53L0X_Error wrapped_VL53L0X_set_reference_spads( uint32_t count, uint8_t is_aperture_spads); /* api_strings.h functions */ - VL53L0X_Error wrapped_VL53L0X_get_device_info(VL53L0X_DEV dev, + VL53L0X_Error wrapped_VL53L0X_get_device_info( VL53L0X_DeviceInfo_t *p_VL53L0X_device_info); - VL53L0X_Error VL53L0X_check_part_used(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_check_part_used( uint8_t *revision, VL53L0X_DeviceInfo_t *p_VL53L0X_device_info); @@ -1642,102 +1555,102 @@ // virtual int read_id(); virtual int read_id(uint8_t *id); - VL53L0X_Error wait_measurement_data_ready(VL53L0X_DEV dev); + VL53L0X_Error wait_measurement_data_ready(void); - VL53L0X_Error wait_stop_completed(VL53L0X_DEV dev); + VL53L0X_Error wait_stop_completed(void); /* Write and read functions from I2C */ /** * Write single byte register - * @param dev Device Handle + * * @param index The register index * @param data 8 bit register data * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_write_byte(VL53L0X_DEV dev, uint8_t index, uint8_t data); + VL53L0X_Error VL53L0X_write_byte( uint8_t index, uint8_t data); /** * Write word register - * @param dev Device Handle + * * @param index The register index * @param data 16 bit register data * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_write_word(VL53L0X_DEV dev, uint8_t index, uint16_t data); + VL53L0X_Error VL53L0X_write_word( uint8_t index, uint16_t data); /** * Write double word (4 byte) register - * @param dev Device Handle + * * @param index The register index * @param data 32 bit register data * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_write_dword(VL53L0X_DEV dev, uint8_t index, uint32_t data); + VL53L0X_Error VL53L0X_write_dword( uint8_t index, uint32_t data); /** * Read single byte register - * @param dev Device Handle + * * @param index The register index * @param data pointer to 8 bit data * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_read_byte(VL53L0X_DEV dev, uint8_t index, uint8_t *p_data); + VL53L0X_Error VL53L0X_read_byte( uint8_t index, uint8_t *p_data); /** * Read word (2byte) register - * @param dev Device Handle + * * @param index The register index * @param data pointer to 16 bit data * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_read_word(VL53L0X_DEV dev, uint8_t index, uint16_t *p_data); + VL53L0X_Error VL53L0X_read_word( uint8_t index, uint16_t *p_data); /** * Read dword (4byte) register - * @param dev Device Handle + * * @param index The register index * @param data pointer to 32 bit data * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_read_dword(VL53L0X_DEV dev, uint8_t index, uint32_t *p_data); + VL53L0X_Error VL53L0X_read_dword( uint8_t index, uint32_t *p_data); /** * Threat safe Update (read/modify/write) single byte register * * Final_reg = (Initial_reg & and_data) |or_data * - * @param dev Device Handle + * * @param index The register index * @param and_data 8 bit and data * @param or_data 8 bit or data * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_update_byte(VL53L0X_DEV dev, uint8_t index, uint8_t and_data, uint8_t or_data); + VL53L0X_Error VL53L0X_update_byte( uint8_t index, uint8_t and_data, uint8_t or_data); /** * Writes the supplied byte buffer to the device - * @param dev Device Handle + * * @param index The register index * @param p_data Pointer to uint8_t buffer containing the data to be written * @param count Number of bytes in the supplied byte buffer * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_write_multi(VL53L0X_DEV dev, uint8_t index, uint8_t *p_data, uint32_t count); + VL53L0X_Error VL53L0X_write_multi( uint8_t index, uint8_t *p_data, uint32_t count); /** * Reads the requested number of bytes from the device - * @param dev Device Handle + * * @param index The register index * @param p_data Pointer to the uint8_t buffer to store read data * @param count Number of uint8_t's to read * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_read_multi(VL53L0X_DEV dev, uint8_t index, uint8_t *p_data, uint32_t count); + VL53L0X_Error VL53L0X_read_multi( uint8_t index, uint8_t *p_data, uint32_t count); /** * @brief Writes a buffer towards the I2C peripheral device. - * @param dev Device Handle + * * @param p_data pointer to the byte-array data to send * @param number_of_bytes number of bytes to be written. * @retval 0 if ok, @@ -1745,11 +1658,11 @@ * @note On some devices if NumByteToWrite is greater * than one, the RegisterAddr must be masked correctly! */ - VL53L0X_Error VL53L0X_i2c_write(uint8_t dev, uint8_t index, uint8_t *p_data, uint16_t number_of_bytes); + VL53L0X_Error VL53L0X_i2c_write(uint8_t index, uint8_t *p_data, uint16_t number_of_bytes); /** * @brief Reads a buffer from the I2C peripheral device. - * @param dev Device Handle + * * @param p_data pointer to the byte-array to read data in to * @param number_of_bytes number of bytes to be read. * @retval 0 if ok, @@ -1757,7 +1670,7 @@ * @note On some devices if NumByteToWrite is greater * than one, the RegisterAddr must be masked correctly! */ - VL53L0X_Error VL53L0X_i2c_read(uint8_t dev, uint8_t index, uint8_t *p_data, uint16_t number_of_bytes); + VL53L0X_Error VL53L0X_i2c_read(uint8_t index, uint8_t *p_data, uint16_t number_of_bytes); /** * @brief execute delay in all polling API call @@ -1767,11 +1680,11 @@ * @code * #define VL53L0X_PollingDelay(...) (void)0 * @endcode - * @param dev Device Handle + * * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_polling_delay(VL53L0X_DEV dev); /* usually best implemented as a real function */ + VL53L0X_Error VL53L0X_polling_delay(void); /* usually best implemented as a real function */ /////////////////////////////////////////////////////////////////////////////////////////////////////// //Added functions // @@ -1790,7 +1703,7 @@ VL53L0X_Error wrapped_VL53L0X_get_device_error_string(VL53L0X_DeviceError error_code, char *p_device_error_string); - VL53L0X_Error wrapped_VL53L0X_get_limit_check_info(VL53L0X_DEV dev, uint16_t limit_check_id, + VL53L0X_Error wrapped_VL53L0X_get_limit_check_info( uint16_t limit_check_id, char *p_limit_check_string); VL53L0X_Error wrapped_VL53L0X_get_pal_error_string(VL53L0X_Error pal_error_code, @@ -1802,7 +1715,7 @@ VL53L0X_Error wrapped_VL53L0X_get_range_status_string(uint8_t range_status, char *p_range_status_string); - VL53L0X_Error wrapped_VL53L0X_get_ref_calibration(VL53L0X_DEV dev, + VL53L0X_Error wrapped_VL53L0X_get_ref_calibration( uint8_t *p_vhv_settings, uint8_t *p_phase_cal); @@ -1853,31 +1766,16 @@ int32_t VL53L0X_get_timer_value(int32_t *p_timer_count); /** - * @brief Configure ranging interrupt reported to system - * - * @note This function is not Implemented - * - * @param dev Device Handle - * @param interrupt_mask Mask of interrupt to Enable/disable - * (0:interrupt disabled or 1: interrupt enabled) - * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented - */ - VL53L0X_Error VL53L0X_enable_interrupt_mask(VL53L0X_DEV dev, - uint32_t interrupt_mask); - - /** * @brief Get Dmax Calibration Parameters for a given device * - * * @note This function Access to the device * - * @param dev Device Handle * @param p_range_milli_meter Pointer to Calibration Distance * @param p_signal_rate_rtn_mega_cps Pointer to Signal rate return * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_dmax_cal_parameters(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_dmax_cal_parameters( uint16_t *p_range_milli_meter, FixPoint1616_t *p_signal_rate_rtn_mega_cps); /** @@ -1886,42 +1784,22 @@ * from NVM. * @note This function doesn't Access to the device * - * @param dev Device Handle + * * @param range_milli_meter Calibration Distance * @param signal_rate_rtn_mega_cps Signal rate return read at CalDistance * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_dmax_cal_parameters(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_dmax_cal_parameters( uint16_t range_milli_meter, FixPoint1616_t signal_rate_rtn_mega_cps); /** - * @brief Retrieve the measurements from device for a given setup - * - * @par Function Description - * Get data from last successful Histogram measurement - * @warning USER should take care about @a VL53L0X_GetNumberOfROIZones() - * before get data. - * PAL will fill a NumberOfROIZones times the corresponding data structure - * used in the measurement function. - * - * @note This function is not Implemented - * - * @param dev Device Handle - * @param p_histogram_measurement_data Pointer to the histogram data structure. - * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented - */ - VL53L0X_Error VL53L0X_get_histogram_measurement_data(VL53L0X_DEV dev, - VL53L0X_HistogramMeasurementData_t *p_histogram_measurement_data); - - /** * @brief Get current new device mode * @par Function Description * Get current Histogram mode of a Device * * @note This function doesn't Access to the device * - * @param dev Device Handle * @param p_histogram_mode Pointer to current Histogram Mode value * Valid values are: * VL53L0X_HISTOGRAMMODE_DISABLED @@ -1932,7 +1810,7 @@ * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_histogram_mode(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_histogram_mode( VL53L0X_HistogramModes *p_histogram_mode); /** @@ -1942,7 +1820,7 @@ * * @note This function doesn't Access to the device * - * @param dev Device Handle + * * @param histogram_mode New device mode to apply * Valid values are: * VL53L0X_HISTOGRAMMODE_DISABLED @@ -1956,7 +1834,7 @@ * HistogramMode is not in the supported list * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_histogram_mode(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_set_histogram_mode( VL53L0X_HistogramModes histogram_mode); /** @@ -1968,7 +1846,7 @@ * * @note This function doesn't Access to the device * - * @param dev Device Handle + * * @param limit_check_id Limit Check ID (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). * @param p_limit_check_string Pointer to the @@ -1978,7 +1856,7 @@ returned when LimitCheckId value is out of range. * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_limit_check_info(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_limit_check_info( uint16_t limit_check_id, char *p_limit_check_string); /** @@ -1990,14 +1868,14 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_linearity_corrective_gain Pointer to the linearity * corrective gain in x1000 * if value is 1000 then no modification is applied. * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_linearity_corrective_gain(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_linearity_corrective_gain( uint16_t *p_linearity_corrective_gain); /** @@ -2005,14 +1883,14 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param linearity_corrective_gain Linearity corrective * gain in x1000 * if value is 1000 then no modification is applied. * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_linearity_corrective_gain(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_set_linearity_corrective_gain( int16_t linearity_corrective_gain); /** @@ -2023,12 +1901,12 @@ * * @note This function doesn't Access to the device * - * @param dev Device Handle + * * @param p_max_number_of_roi_zones Pointer to the Maximum Number * of ROI Zones value. * @return VL53L0X_ERROR_NONE Success */ - VL53L0X_Error VL53L0X_get_max_number_of_roi_zones(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_max_number_of_roi_zones( uint8_t *p_max_number_of_roi_zones); /** @@ -2041,12 +1919,12 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_measurement_ref_signal Pointer to the Ref Signal to fill up. * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_measurement_ref_signal(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_measurement_ref_signal( FixPoint1616_t *p_measurement_ref_signal); /** @@ -2076,11 +1954,11 @@ * * @note This function doesn't Access to the device * - * @param dev Device Handle + * * @param p_number_of_roi_zones Pointer to the Number of ROI Zones value. * @return VL53L0X_ERROR_NONE Success */ - VL53L0X_Error VL53L0X_get_number_of_roi_zones(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_number_of_roi_zones( uint8_t *p_number_of_roi_zones); /** @@ -2092,14 +1970,14 @@ * with @a VL53L0X_GetMaxNumberOfROIZones(). * This version of API manage only one zone. * - * @param dev Device Handle + * * @param number_of_roi_zones Number of ROI Zones to be used for a * specific Device. * @return VL53L0X_ERROR_NONE Success * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned if * NumberOfROIZones != 1 */ - VL53L0X_Error VL53L0X_set_number_of_roi_zones(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_set_number_of_roi_zones( uint8_t number_of_roi_zones); /** @@ -2111,20 +1989,20 @@ * * @note This function Accesses the device * - * @param dev Device Handle + * * @param p_number_of_sequence_steps Out parameter reporting the number of * sequence steps. * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_number_of_sequence_steps(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_number_of_sequence_steps( uint8_t *p_number_of_sequence_steps); /** * @brief Get the power mode for a given Device * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_power_mode Pointer to the current value of the power * mode. see ::VL53L0X_PowerModes * Valid values are: @@ -2133,7 +2011,7 @@ * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_power_mode(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_power_mode( VL53L0X_PowerModes *p_power_mode); /** @@ -2144,7 +2022,7 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param power_mode The value of the power mode to set. * see ::VL53L0X_PowerModes * Valid values are: @@ -2155,7 +2033,7 @@ * is not in the supported list * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_power_mode(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_set_power_mode( VL53L0X_PowerModes power_mode); /** @@ -2167,7 +2045,7 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_spad_count Number ref Spad Count * @param p_is_aperture_spads Reports if spads are of type * aperture or non-aperture. @@ -2177,7 +2055,7 @@ * spad configuration. * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error wrapped_VL53L0X_get_reference_spads(VL53L0X_DEV dev, + VL53L0X_Error wrapped_VL53L0X_get_reference_spads( uint32_t *p_spad_count, uint8_t *p_is_aperture_spads); /** @@ -2188,7 +2066,7 @@ * * @note This function Accesses the device * - * @param dev Device Handle + * * @param sequence_step_id Sequence step identifier. * @param p_sequence_step_enabled Out parameter reporting if the sequence step * is enabled {0=Off,1=On}. @@ -2197,7 +2075,7 @@ * supported. * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_sequence_step_enable(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_sequence_step_enable( VL53L0X_SequenceStepId sequence_step_id, uint8_t *p_sequence_step_enabled); @@ -2209,7 +2087,7 @@ * * @note This function Accesses the device * - * @param dev Device Handle + * * @param sequence_step_id Sequence step identifier. * @param p_time_out_milli_secs Timeout value. * @return VL53L0X_ERROR_NONE Success @@ -2217,7 +2095,7 @@ * supported. * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_sequence_step_timeout(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_sequence_step_timeout( VL53L0X_SequenceStepId sequence_step_id, FixPoint1616_t *p_time_out_milli_secs); @@ -2229,7 +2107,7 @@ * * @note This function Accesses the device * - * @param dev Device Handle + * * @param sequence_step_id Sequence step identifier. * @param time_out_milli_secs Demanded timeout * @return VL53L0X_ERROR_NONE Success @@ -2237,7 +2115,7 @@ * supported. * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_sequence_step_timeout(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_set_sequence_step_timeout( VL53L0X_SequenceStepId sequence_step_id, FixPoint1616_t time_out_milli_secs); /** @@ -2248,13 +2126,13 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_spad_ambient_damper_factor Pointer to programmed SPAD Ambient * Damper Factor value * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_spad_ambient_damper_factor(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_spad_ambient_damper_factor( uint16_t *p_spad_ambient_damper_factor); /** * @brief Set the SPAD Ambient Damper Factor value @@ -2264,12 +2142,12 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param spad_ambient_damper_factor SPAD Ambient Damper Factor value * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_spad_ambient_damper_factor(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_set_spad_ambient_damper_factor( uint16_t spad_ambient_damper_factor); /** @@ -2280,13 +2158,13 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_spad_ambient_damper_threshold Pointer to programmed * SPAD Ambient Damper Threshold value * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_spad_ambient_damper_threshold(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_spad_ambient_damper_threshold( uint16_t *p_spad_ambient_damper_threshold); /** @@ -2297,34 +2175,14 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param spad_ambient_damper_threshold SPAD Ambient Damper Threshold value * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_spad_ambient_damper_threshold(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_set_spad_ambient_damper_threshold( uint16_t spad_ambient_damper_threshold); - /** - * @brief Get the maximal distance for actual setup - * @par Function Description - * Device must be initialized through @a VL53L0X_SetParameters() prior calling - * this function. - * - * Any range value more than the value returned is to be considered as - * "no target detected" or - * "no target in detectable range"\n - * @warning The maximal distance depends on the setup - * - * @note This function is not Implemented - * - * @param dev Device Handle - * @param p_upper_limit_milli_meter The maximal range limit for actual setup - * (in millimeter) - * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented - */ - VL53L0X_Error VL53L0X_get_upper_limit_milli_meter(VL53L0X_DEV dev, - uint16_t *p_upper_limit_milli_meter); /** * @brief Get the tuning settings pointer and the internal external switch @@ -2336,14 +2194,14 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param pp_tuning_setting_buffer Pointer to tuning settings buffer. * @param p_use_internal_tuning_settings Pointer to store Use internal tuning * settings value. * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_tuning_setting_buffer(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_get_tuning_setting_buffer( uint8_t **pp_tuning_setting_buffer, uint8_t *p_use_internal_tuning_settings); /** @@ -2357,13 +2215,13 @@ * * @note This function Access to the device * - * @param dev Device Handle + * * @param p_tuning_setting_buffer Pointer to tuning settings buffer. * @param use_internal_tuning_settings Use internal tuning settings value. * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_tuning_setting_buffer(VL53L0X_DEV dev, + VL53L0X_Error VL53L0X_set_tuning_setting_buffer( uint8_t *p_tuning_setting_buffer, uint8_t use_internal_tuning_settings); /** @@ -2374,19 +2232,19 @@ /** * Lock comms interface to serialize all commands to a shared I2C interface for a specific device - * @param dev Device Handle + * * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_lock_sequence_access(VL53L0X_DEV dev); + VL53L0X_Error VL53L0X_lock_sequence_access(void); /** * Unlock comms interface to serialize all commands to a shared I2C interface for a specific device - * @param dev Device Handle + * * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_unlock_sequence_access(VL53L0X_DEV dev); + VL53L0X_Error VL53L0X_unlock_sequence_access(void); /** * @brief Prepare device for operation @@ -2396,47 +2254,18 @@ * * @note This function Access to the device * - * @param Dev Device Handle + * * @param pDeviceParameters Pointer to store current device parameters. * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error vl53L0x_set_device_parameters(VL53L0X_DEV Dev, + VL53L0X_Error vl53L0x_set_device_parameters( const VL53L0X_DeviceParameters_t *pDeviceParameters); - /** - * Set Group parameter Hold state - * - * @par Function Description - * Set or remove device internal group parameter hold - * - * @note This function is not Implemented - * - * @param dev Device Handle - * @param group_param_hold Group parameter Hold state to be set (on/off) - * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented - */ - VL53L0X_Error VL53L0X_set_group_param_hold(VL53L0X_DEV dev, - uint8_t group_param_hold); - - /** - * @brief Wait for device ready for a new measurement command. - * Blocking function. - * - * @note This function is not Implemented - * - * @param dev Device Handle - * @param max_loop Max Number of polling loop (timeout). - * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented - */ - VL53L0X_Error VL53L0X_wait_device_ready_for_new_measurement(VL53L0X_DEV dev, - uint32_t max_loop); - VL53L0X_Error VL53L0X_reverse_bytes(uint8_t *data, uint32_t size); int range_meas_int_continuous_mode(void (*fptr)(void)); - VL53L0X_DeviceInfo_t _device_info; /* IO Device */ @@ -2446,8 +2275,10 @@ /* Measure detection IRQ */ InterruptIn *_gpio1Int; /* Device data */ - VL53L0X_Dev_t _my_device; - VL53L0X_DEV _device; + VL53L0X_DevData_t Data; /*!< embed ST Ewok Dev data as "Data"*/ + uint8_t I2cDevAddr; /*!< i2c device address user specific field */ + uint8_t comms_type; /*!< Type of comms : VL53L0X_COMMS_I2C or VL53L0X_COMMS_SPI */ + uint16_t comms_speed_khz; /*!< Comms speed [kHz] : typically 400kHz for I2C */ private: /** @brief Writes a buffer towards the I2C peripheral device. * @param pBuffer pointer to the byte-array data to send