Greatly simplified Architecture, Identical Functions Removed: Platform Interfaces, STP6001 interface
Diff: VL53L0X.h
- Revision:
- 10:cd1758e186a4
- Parent:
- 9:cb4c6d4e5030
- Child:
- 11:d8dbe3b87f9f
--- a/VL53L0X.h Tue Jun 25 11:03:34 2019 +0000 +++ b/VL53L0X.h Thu Jun 27 12:51:34 2019 +0000 @@ -1158,14 +1158,11 @@ * @brief Reads the Device information for given Device * * @note This function Access to the device - * - * - * @param p_VL53L0X_device_info Pointer to current device info for a given - * Device + * _device_info structure is directly filled * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_device_info( VL53L0X_DeviceInfo_t *p_VL53L0X_device_info); + VL53L0X_Error VL53L0X_get_device_info( ); /** * @brief Gets the (on/off) state of all sequence steps. @@ -1370,10 +1367,7 @@ uint32_t count, uint8_t is_aperture_spads); /* api_strings.h functions */ - VL53L0X_Error wrapped_VL53L0X_get_device_info( - VL53L0X_DeviceInfo_t *p_VL53L0X_device_info); - VL53L0X_Error VL53L0X_check_part_used(uint8_t *revision, - VL53L0X_DeviceInfo_t *p_VL53L0X_device_info); + VL53L0X_Error VL53L0X_check_part_used(uint8_t *revision); /* Read function of the ID device */ // virtual int read_id(); @@ -1383,84 +1377,6 @@ VL53L0X_Error wait_stop_completed(void); - /* Write and read functions from I2C */ - /** - * Write single byte register - * - * @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( uint8_t index, uint8_t data); - /** - * Write word register - * - * @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( uint8_t index, uint16_t data); - /** - * Write double word (4 byte) register - * - * @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( uint8_t index, uint32_t data); - /** - * Read single byte register - * - * @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( uint8_t index, uint8_t *p_data); - /** - * Read word (2byte) register - * - * @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( uint8_t index, uint16_t *p_data); - /** - * Read dword (4byte) register - * - * @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( 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 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( uint8_t index, uint8_t and_data, uint8_t or_data); - - /** - * Reads the requested number of bytes from the device - * - * @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( uint8_t index, uint8_t *p_data, uint32_t count); /** * @brief execute delay in all polling API call @@ -1924,38 +1840,104 @@ InterruptIn *_gpio1Int; VL53L0X_DevData_t Data; - VL53L0X_DeviceInfo_t _device_info; + VL53L0X_DeviceInfo_t Device_Info; + VL53L0X_DeviceParameters_t CurrentParameters; /*!< Current Device Parameter */ -private: +public: /* IO Device */ I2C *_dev_i2c; 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 */ - /** - * @brief Writes a buffer towards the I2C peripheral device. + + /* Write and read functions from I2C */ + /** Write single byte register + * + * @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( uint8_t index, uint8_t data); + /** Write word register + * + * @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( uint8_t index, uint16_t data); + /** Write double word (4 byte) register + * + * @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( uint8_t index, uint32_t data); + /** Read single byte register + * + * @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( uint8_t index, uint8_t *p_data); + /** Read word (2byte) register + * + * @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( uint8_t index, uint16_t *p_data); + /** Read dword (4byte) register + * + * @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( uint8_t index, uint32_t *p_data); + + /** Thread safe Update (read/modify/write) single byte register + * + * Final_reg = (Initial_reg & and_data) |or_data + * + * @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( uint8_t index, uint8_t and_data, uint8_t or_data); + + /** Reads the requested number of bytes from the device + * + * @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( uint8_t index, uint8_t *p_data, uint32_t count); + + /** @brief Writes a buffer towards the I2C peripheral device. * * @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, * @retval -1 if an I2C error has occured * @note On some devices if NumByteToWrite is greater - * than one, the RegisterAddr must be masked correctly! - */ + * than one, the RegisterAddr must be masked correctly! */ 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. + /** @brief Reads a buffer from the I2C peripheral device. * * @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, * @retval -1 if an I2C error has occured * @note On some devices if NumByteToWrite is greater - * than one, the RegisterAddr must be masked correctly! - */ + * than one, the RegisterAddr must be masked correctly! */ VL53L0X_Error VL53L0X_i2c_read(uint8_t index, uint8_t *p_data, uint16_t number_of_bytes); }; - #endif /* _VL53L0X_CLASS_H_ */