Condensed Version of Public VL53L0X
Diff: VL53L0X.h
- Revision:
- 10:cd251e0fc2fd
- Parent:
- 8:abea9638127a
- Child:
- 11:c6f95a42d4d7
--- a/VL53L0X.h Sun Mar 24 18:38:00 2019 +0000 +++ b/VL53L0X.h Sun Mar 24 22:24:16 2019 +0000 @@ -29,28 +29,13 @@ #ifndef __VL53L0X_CLASS_H #define __VL53L0X_CLASS_H -/* -#ifdef _MSC_VER -# ifdef VL53L0X_API_EXPORTS -# define VL53L0X_API __declspec(dllexport) -# else -# define VL53L0X_API -# endif -#else -# define VL53L0X_API -#endif -*/ - /* Includes ------------------------------------------------------------------*/ #include "mbed.h" #include "pinmap.h" #include "PinNames.h" #include "VL53L0X_def.h" -#include "VL53L0X_tuning.h" -/** - * The device model ID - */ +/** The device model ID */ #define IDENTIFICATION_MODEL_ID 0x000 #define STATUS_OK 0x00 #define STATUS_FAIL 0x01 @@ -165,23 +150,16 @@ * @param[in] &pin_gpio1 pin Mbed InterruptIn PinName to be used as component GPIO_1 INT * @param[in] dev_addr device address, 0x29 by default */ - VL53L0X(DevI2C *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; - } + VL53L0X(DevI2C *i2c, DigitalOut *pin, PinName pin_gpio1, + uint8_t dev_addr = VL53L0X_DEFAULT_ADDRESS) : _dev_i2c(i2c), _gpio0(pin) + { 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 - */ + /** Destructor */ virtual ~VL53L0X() { if (_gpio1Int != NULL) { delete _gpio1Int; } } @@ -205,8 +183,7 @@ */ /* turns off the sensor */ void VL53L0X_off(void) - { - if (_gpio0) { *_gpio0 = 0; } + { if (_gpio0) { *_gpio0 = 0; } wait_ms(10); } @@ -288,26 +265,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(); - } /** * @brief Prepare device for operation @@ -338,7 +295,7 @@ if (status == VL53L0X_ERROR_NONE) { //printf("Call of VL53L0X_PerformRefCalibration\r\n"); status = VL53L0X_perform_ref_calibration( - &vhv_settings, &phase_cal); // Device Initialization + &vhv_settings, &phase_cal, 1); // Device Initialization } if (status == VL53L0X_ERROR_NONE) { @@ -389,9 +346,8 @@ VL53L0X_RangingMeasurementData_t p_ranging_measurement_data; status = start_measurement(range_single_shot_polling, NULL); - if (!status) { - status = get_measurement(range_single_shot_polling, &p_ranging_measurement_data); - } + if (!status) { status = get_measurement(range_single_shot_polling, + &p_ranging_measurement_data); } if (p_ranging_measurement_data.RangeStatus == 0) { // we have a valid range. *p_data = p_ranging_measurement_data.RangeMilliMeter; @@ -416,13 +372,9 @@ int set_device_address(int new_addr) { int status; - status = VL53L0X_set_device_address( new_addr); - if (!status) { - _device->I2cDevAddr = new_addr; - } + if (!status) { I2cDevAddr = new_addr; } return status; - } /** @@ -435,9 +387,7 @@ * @return "0" on success */ int clear_interrupt(uint8_t int_clear) - { - return VL53L0X_clear_interrupt_mask( int_clear); - } + { return VL53L0X_clear_interrupt_mask( int_clear); } /** @@ -497,11 +447,12 @@ * @param dev Device Handle * @param p_vhv_settings Pointer to vhv settings parameter. * @param p_phase_cal Pointer to PhaseCal parameter. + * @param get_data_enable 1 to enable to get the data * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_perform_ref_calibration( uint8_t *p_vhv_settings, - uint8_t *p_phase_cal); + VL53L0X_Error VL53L0X_perform_ref_calibration( + uint8_t *p_vhv_settings, uint8_t *p_phase_cal, uint8_t get_data_enable); /** * @brief Get Reference Calibration Parameters @@ -604,13 +555,13 @@ * @note This function Access to the device * * @param dev Device Handle - * @param p_offset_calibration_data_micro_meter Return part to part + * @param p_offsetCallDat_um 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( - int32_t *p_offset_calibration_data_micro_meter); + VL53L0X_Error VL53L0X_get_offsetCallDat_um( + int32_t *p_offsetCallDat_um); /** * Set or over-hide part to part calibration offset * \sa VL53L0X_DataInit() VL53L0X_GetOffsetCalibrationDataMicroMeter() @@ -618,16 +569,16 @@ * @note This function Access to the device * * @param dev Device Handle - * @param p_offset_calibration_data_micro_meter Offset (microns) + * @param p_offsetCallDat_um Offset (microns) * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_offset_calibration_data_micro_meter( - int32_t offset_calibration_data_micro_meter); + VL53L0X_Error VL53L0X_set_offsetCallDat_um( + int32_t offsetCallDat_um); VL53L0X_Error VL53L0X_perform_offset_calibration( FixPoint1616_t cal_distance_milli_meter, - int32_t *p_offset_micro_meter); + int32_t *p_offset_um); VL53L0X_Error VL53L0X_perform_xtalk_calibration( FixPoint1616_t xtalk_cal_distance, @@ -842,8 +793,8 @@ * @return "Other error code" See ::VL53L0X_Error */ VL53L0X_Error VL53L0X_set_gpio_config( uint8_t pin, - VL53L0X_DeviceModes device_mode, VL53L0X_GpioFunctionality functionality, - VL53L0X_InterruptPolarity polarity); + VL53L0X_DeviceModes device_mode, VL53L0X_GpioFunctionality functionality, + VL53L0X_InterruptPolarity polarity); /** * @brief Start device measurement @@ -902,8 +853,7 @@ * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_stop_completed_status( - uint32_t *p_stop_status); + VL53L0X_Error VL53L0X_get_stop_completed_status( uint32_t *p_stop_status); /** * @brief Return Measurement Data Ready @@ -924,8 +874,7 @@ * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_measurement_data_ready( - uint8_t *p_measurement_data_ready); + VL53L0X_Error VL53L0X_get_measurement_data_ready( uint8_t *p_measurement_data_ready); /** * @brief Retrieve the measurements from device for a given setup @@ -979,8 +928,8 @@ * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_interrupt_mask_status( - uint32_t *p_interrupt_mask_status); + VL53L0X_Error VL53L0X_get_interrupt_mask_status( + uint32_t *p_interrupt_mask_status); /** * @brief Performs a single ranging measurement and retrieve the ranging @@ -1088,7 +1037,7 @@ * @note This function Access to the device * * @param dev Device Handle - * @param p_measurement_timing_budget_micro_seconds Max measurement time in + * @param p_measurement_timing_budget_us Max measurement time in * microseconds. * Valid values are: * >= 17000 microsecs when wraparound enabled @@ -1096,8 +1045,8 @@ * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_measurement_timing_budget_micro_seconds( - uint32_t *p_measurement_timing_budget_micro_seconds); + VL53L0X_Error VL53L0X_get_measurement_timing_budget_us( + uint32_t *p_measurement_timing_budget_us); /** * @brief Set Ranging Timing Budget in microseconds @@ -1109,7 +1058,7 @@ * @note This function Access to the device * * @param dev Device Handle - * @param measurement_timing_budget_micro_seconds Max measurement time in + * @param measurement_timing_budget_us Max measurement time in * microseconds. * Valid values are: * >= 17000 microsecs when wraparound enabled @@ -1119,8 +1068,8 @@ MeasurementTimingBudgetMicroSeconds out of range * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_measurement_timing_budget_micro_seconds( - uint32_t measurement_timing_budget_micro_seconds); + VL53L0X_Error VL53L0X_set_measurement_timing_budget_us( + uint32_t measurement_timing_budget_us); /** * @brief Get specific limit check enable state @@ -1277,13 +1226,13 @@ * @note This function Access to the device * * @param dev Device Handle - * @param p_inter_measurement_period_milli_seconds Pointer to programmed + * @param p_inter_measurement_period_ms 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( - uint32_t *p_inter_measurement_period_milli_seconds); + VL53L0X_Error VL53L0X_get_inter_measurement_period_ms( + uint32_t *p_inter_measurement_period_ms); /** * Program continuous mode Inter-Measurement period in milliseconds @@ -1294,12 +1243,12 @@ * @note This function Access to the device * * @param dev Device Handle - * @param inter_measurement_period_milli_seconds Inter-Measurement Period in ms. + * @param inter_measurement_period_ms 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( - uint32_t inter_measurement_period_milli_seconds); + VL53L0X_Error VL53L0X_set_inter_measurement_period_ms( + uint32_t inter_measurement_period_ms); /** * @brief Set new device address @@ -1529,8 +1478,7 @@ * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_range_fraction_enable( - uint8_t enable); + VL53L0X_Error VL53L0X_set_range_fraction_enable( uint8_t enable); /** * @brief Return the VL53L0X PAL Implementation Version @@ -1600,8 +1548,8 @@ * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_pal_spec_version( - VL53L0X_Version_t *p_pal_spec_version); + VL53L0X_Error VL53L0X_get_pal_spec_version(VL53L0X_Version_t + *p_pal_spec_version); /** * @brief Reads the internal state of the PAL for a given Device @@ -1614,8 +1562,7 @@ * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_pal_state( - VL53L0X_State *p_pal_state); + VL53L0X_Error VL53L0X_get_pal_state(VL53L0X_State *p_pal_state); /** * @brief Human readable PAL State string @@ -1634,36 +1581,19 @@ /*** End High level API ***/ private: /* 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_Error sequence_step_enabled( - VL53L0X_SequenceStepId sequence_step_id, uint8_t sequence_config, - uint8_t *p_sequence_step_enabled); + 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( uint8_t start_not_stopflag); - /* api_core.h functions */ - VL53L0X_Error VL53L0X_get_info_from_device( uint8_t option); VL53L0X_Error VL53L0X_device_read_strobe(); - VL53L0X_Error wrapped_VL53L0X_get_measurement_timing_budget_micro_seconds( - uint32_t *p_measurement_timing_budget_micro_seconds); + VL53L0X_Error wrapped_VL53L0X_get_measurement_timing_budget_us( + uint32_t *p_measurement_timing_budget_us); VL53L0X_Error wrapped_VL53L0X_get_vcsel_pulse_period( VL53L0X_VcselPeriod vcsel_period_type, uint8_t *p_vcsel_pulse_period_pclk); @@ -1672,8 +1602,7 @@ uint32_t VL53L0X_decode_timeout(uint16_t encoded_timeout); - uint32_t VL53L0X_calc_timeout_us( - uint16_t timeout_period_mclks, + uint32_t VL53L0X_calc_timeout_us(uint16_t timeout_period_mclks, uint8_t vcsel_period_pclks); uint32_t VL53L0X_calc_macro_period_ps( uint8_t vcsel_period_pclks); @@ -1693,15 +1622,13 @@ VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data, FixPoint1616_t *p_sigma_estimate, uint32_t *p_dmax_mm); - uint32_t VL53L0X_calc_timeout_mclks( - uint32_t timeout_period_us, + uint32_t VL53L0X_calc_timeout_mclks(uint32_t timeout_period_us, uint8_t vcsel_period_pclks); uint32_t VL53L0X_isqrt(uint32_t num); uint32_t VL53L0X_quadrature_sum(uint32_t a, uint32_t b); VL53L0X_Error VL53L0X_calc_dmax( - FixPoint1616_t total_signal_rate_mcps, FixPoint1616_t total_corr_signal_rate_mcps, FixPoint1616_t pw_mult, @@ -1709,13 +1636,12 @@ 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( - uint32_t measurement_timing_budget_micro_seconds); - VL53L0X_Error get_sequence_step_timeout( - VL53L0X_SequenceStepId sequence_step_id, + + VL53L0X_Error wrapped_VL53L0X_set_measurement_timing_budget_us( + uint32_t measurement_timing_budget_us); + 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_SequenceStepId sequence_step_id, + 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( @@ -1724,15 +1650,13 @@ /* api_calibration.h functions */ VL53L0X_Error VL53L0X_apply_offset_adjustment(); - 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( - int32_t offset_calibration_data_micro_meter); + VL53L0X_Error wrapped_VL53L0X_get_offsetCallDat_um( + int32_t *p_offsetCallDat_um); + VL53L0X_Error wrapped_VL53L0X_set_offsetCallDat_um( + int32_t offsetCallDat_um); VL53L0X_Error wrapped_VL53L0X_perform_ref_spad_management( uint32_t *ref_spad_count, uint8_t *is_aperture_spads); - 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( uint8_t *p_vhv_settings, const uint8_t get_data_enable, const uint8_t restore_config); @@ -1745,8 +1669,7 @@ 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( - uint8_t aperture_spads, + VL53L0X_Error enable_ref_spads(uint8_t aperture_spads, uint8_t good_spad_array[], uint8_t spad_array[], uint32_t size, @@ -1767,7 +1690,7 @@ uint32_t count, uint8_t is_aperture_spads); VL53L0X_Error VL53L0X_check_part_used(uint8_t *revision, - VL53L0X_DeviceInfo_t *p_VL53L0X_device_info); + VL53L0X_DeviceInfo_t *p_VL53L0X_device_info); /* Read function of the ID device */ // virtual int read_id(); @@ -1787,6 +1710,7 @@ * @return "Other error code" See ::VL53L0X_Error */ VL53L0X_Error VL53L0X_write_byte( uint8_t index, uint8_t data); + /** * Write word register * @param dev Device Handle @@ -1844,7 +1768,8 @@ * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_update_byte( 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 @@ -1855,6 +1780,7 @@ * @return "Other error code" See ::VL53L0X_Error */ 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 @@ -1893,7 +1819,8 @@ /** * @brief execute delay in all polling API call * - * A typical multi-thread or RTOs implementation is to sleep the task for some 5ms (with 100Hz max rate faster polling is not needed) + * A typical multi-thread or RTOs implementation is to sleep the task for some + * 5ms (with 100Hz max rate faster polling is not needed) * if nothing specific is need you can define it as an empty/void macro * @code * #define VL53L0X_PollingDelay(...) (void)0 @@ -1908,9 +1835,7 @@ { int status; uint8_t id = 0; - status = read_id(&id); - return status; } @@ -1922,7 +1847,6 @@ * @brief Cycle Power to Device * * @return status - status 0 = ok, 1 = error - * */ int32_t VL53L0X_cycle_power(void); @@ -1978,7 +1902,6 @@ * @param[out] p_timer_freq_hz : pointer for timer frequency * * @return status : 0 = ok, 1 = error - * */ int32_t VL53L0X_get_timer_frequency(int32_t *p_timer_freq_hz); @@ -1988,7 +1911,6 @@ * @param[out] p_timer_count : pointer for timer count value * * @return status : 0 = ok, 1 = error - * */ int32_t VL53L0X_get_timer_value(int32_t *p_timer_count); @@ -2016,8 +1938,8 @@ * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_dmax_cal_parameters( - uint16_t *p_range_milli_meter, FixPoint1616_t *p_signal_rate_rtn_mega_cps); + VL53L0X_Error VL53L0X_get_dmax_cal_parameters(uint16_t *p_range_milli_meter, + FixPoint1616_t *p_signal_rate_rtn_mega_cps); /** * @brief Set Dmax Calibration Parameters for a given device @@ -2031,8 +1953,8 @@ * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_dmax_cal_parameters( - uint16_t range_milli_meter, FixPoint1616_t signal_rate_rtn_mega_cps); + 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 @@ -2201,7 +2123,7 @@ * @return "Other error code" See ::VL53L0X_Error */ VL53L0X_Error VL53L0X_get_number_of_limit_check( - uint16_t *p_number_of_limit_check); + uint16_t *p_number_of_limit_check); /** * @brief Get the number of ROI Zones managed by the Device @@ -2239,7 +2161,7 @@ * NumberOfROIZones != 1 */ VL53L0X_Error VL53L0X_set_number_of_roi_zones( - uint8_t number_of_roi_zones); + uint8_t number_of_roi_zones); /** * @brief Gets number of sequence steps managed by the API. @@ -2272,8 +2194,7 @@ * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_power_mode( - VL53L0X_PowerModes *p_power_mode); + VL53L0X_Error VL53L0X_get_power_mode( VL53L0X_PowerModes *p_power_mode); /** * @brief Set the power mode for a given Device @@ -2294,8 +2215,7 @@ * is not in the supported list * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_power_mode( - VL53L0X_PowerModes power_mode); + VL53L0X_Error VL53L0X_set_power_mode(VL53L0X_PowerModes power_mode); /** * @brief Retrieves SPAD configuration @@ -2377,7 +2297,8 @@ * @return "Other error code" See ::VL53L0X_Error */ VL53L0X_Error VL53L0X_set_sequence_step_timeout( - VL53L0X_SequenceStepId sequence_step_id, FixPoint1616_t time_out_milli_secs); + VL53L0X_SequenceStepId sequence_step_id, + FixPoint1616_t time_out_milli_secs); /** * @brief Get the current SPAD Ambient Damper Factor value @@ -2483,7 +2404,8 @@ * @return "Other error code" See ::VL53L0X_Error */ VL53L0X_Error VL53L0X_get_tuning_setting_buffer( - uint8_t **pp_tuning_setting_buffer, uint8_t *p_use_internal_tuning_settings); + uint8_t **pp_tuning_setting_buffer, + uint8_t *p_use_internal_tuning_settings); /** * @brief Set the tuning settings pointer @@ -2503,7 +2425,8 @@ * @return "Other error code" See ::VL53L0X_Error */ VL53L0X_Error VL53L0X_set_tuning_setting_buffer( - uint8_t *p_tuning_setting_buffer, uint8_t use_internal_tuning_settings); + uint8_t *p_tuning_setting_buffer, + uint8_t use_internal_tuning_settings); /** * @defgroup VL53L0X_registerAccess_group PAL Register Access Functions @@ -2575,7 +2498,6 @@ int range_meas_int_continuous_mode(void (*fptr)(void)); - /* IO Device */ DevI2C *_dev_i2c; /* Digital out pin */ @@ -2584,9 +2506,72 @@ InterruptIn *_gpio1Int; /* Device data */ VL53L0X_DeviceInfo_t _device_info; - VL53L0X_Dev_t _my_device; - VL53L0X_DEV _device; + +private: + /** + * @brief was VL53L0X_Dev_t, Generic device information + * + * merged with VL53L0X_DevData_t that embeds ST FlightSense Dev data + * VL53L0X PAL device ST private data structure \n + * End user should never access any of these field directly \n + */ + VL53L0X_DMaxData_t DMaxData; + /*!< Dmax Data */ + int32_t Part2PartOffsetNVMMicroMeter; + /*!< backed up NVM value */ + int32_t Part2PartOffsetAdjustmentNVMMicroMeter; + /*!< backed up NVM value representing additional offset adjustment */ + VL53L0X_DeviceParameters_t CurrentParameters; + /*!< Current Device Parameter */ + VL53L0X_RangingMeasurementData_t LastRangeMeasure; + /*!< Ranging Data */ + VL53L0X_HistogramMeasurementData_t LastHistogramMeasure; + /*!< Histogram Data */ + VL53L0X_DeviceSpecificParameters_t DevSpecParams; + /*!< Parameters specific to the device */ + VL53L0X_SpadData_t SpadData; + /*!< Spad Data */ + uint8_t SequenceConfig; + /*!< Internal value for the sequence config */ + uint8_t RangeFractionalEnable; + /*!< Enable/Disable fractional part of ranging data */ + VL53L0X_State PalState; + /*!< Current state of the PAL for this device */ + VL53L0X_PowerModes PowerMode; + /*!< Current Power Mode */ + uint16_t SigmaEstRefArray; + /*!< Reference array sigma value in 1/100th of [mm] e.g. 100 = 1mm */ + uint16_t SigmaEstEffPulseWidth; + /*!< Effective Pulse width for sigma estimate in 1/100th of ns e.g. 900 = 9.0ns */ + uint16_t SigmaEstEffAmbWidth; + /*!< Effective Ambient width for sigma estimate in 1/100th of ns + * e.g. 500 = 5.0ns */ + uint8_t StopVariable; + /*!< StopVariable used during the stop sequence */ + uint16_t targetRefRate; + /*!< Target Ambient Rate for Ref spad management */ + FixPoint1616_t SigmaEstimate; + /*!< Sigma Estimate - based on ambient & VCSEL rates and signal_total_events */ + FixPoint1616_t SignalEstimate; + /*!< Signal Estimate - based on ambient & VCSEL rates and cross talk */ + FixPoint1616_t LastSignalRefMcps; + /*!< Latest Signal ref in Mcps */ + uint8_t *pTuningSettingsPointer; + /*!< Pointer for Tuning Settings table */ + uint8_t UseInternalTuningSettings; + /*!< Indicate if we use Tuning Settings table */ + uint16_t LinearityCorrectiveGain; + /*!< Linearity Corrective Gain value in x1000 */ + uint16_t DmaxCalRangeMilliMeter; + /*!< Dmax Calibration Range millimeter */ + FixPoint1616_t DmaxCalSignalRateRtnMegaCps; + /*!< Dmax Calibration Signal Rate Return MegaCps */ + + /*!< user and application specific fields */ + 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 */ + // was VL53L0X_Dev_t; }; - #endif /* _VL53L0X_CLASS_H_ */