1.0
This commit is contained in:
431
App/VL53L1X_API/platform/inc/vl53l1_platform.h
Normal file
431
App/VL53L1X_API/platform/inc/vl53l1_platform.h
Normal file
@@ -0,0 +1,431 @@
|
||||
/*******************************************************************************
|
||||
Copyright (C) 2016, STMicroelectronics International N.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of STMicroelectronics nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef _VL53L1_PLATFORM_H_
|
||||
#define _VL53L1_PLATFORM_H_
|
||||
|
||||
#include "vl53l1_ll_def.h"
|
||||
#include "vl53l1_platform_log.h"
|
||||
|
||||
#define VL53L1_IPP_API
|
||||
#include "vl53l1_platform_ipp_imports.h"
|
||||
#include "vl53l1_platform_user_data.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @file vl53l1_platform.h
|
||||
*
|
||||
* @brief All end user OS/platform/application porting
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Initialise platform comms.
|
||||
*
|
||||
* @param[in] pdev : pointer to device structure (device handle)
|
||||
* @param[in] comms_type : selects between I2C and SPI
|
||||
* @param[in] comms_speed_khz : unsigned short containing the I2C speed in kHz
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_CommsInitialise(
|
||||
VL53L1_Dev_t *pdev,
|
||||
uint8_t comms_type,
|
||||
uint16_t comms_speed_khz);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Close platform comms.
|
||||
*
|
||||
* @param[in] pdev : pointer to device structure (device handle)
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_CommsClose(
|
||||
VL53L1_Dev_t *pdev);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Writes the supplied byte buffer to the device
|
||||
*
|
||||
* @param[in] pdev : pointer to device structure (device handle)
|
||||
* @param[in] index : uint16_t register index value
|
||||
* @param[in] pdata : pointer to uint8_t (byte) buffer containing the data to be written
|
||||
* @param[in] count : number of bytes in the supplied byte buffer
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_WriteMulti(
|
||||
VL53L1_Dev_t *pdev,
|
||||
uint16_t index,
|
||||
uint8_t *pdata,
|
||||
uint32_t count);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Reads the requested number of bytes from the device
|
||||
*
|
||||
* @param[in] pdev : pointer to device structure (device handle)
|
||||
* @param[in] index : uint16_t register index value
|
||||
* @param[out] pdata : pointer to the uint8_t (byte) buffer to store read data
|
||||
* @param[in] count : number of bytes to read
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_ReadMulti(
|
||||
VL53L1_Dev_t *pdev,
|
||||
uint16_t index,
|
||||
uint8_t *pdata,
|
||||
uint32_t count);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Writes a single byte to the device
|
||||
*
|
||||
* @param[in] pdev : pointer to device structure (device handle)
|
||||
* @param[in] index : uint16_t register index value
|
||||
* @param[in] data : uint8_t data value to write
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_WrByte(
|
||||
VL53L1_Dev_t *pdev,
|
||||
uint16_t index,
|
||||
uint8_t data);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Writes a single word (16-bit unsigned) to the device
|
||||
*
|
||||
* Manages the big-endian nature of the device register map
|
||||
* (first byte written is the MS byte).
|
||||
*
|
||||
* @param[in] pdev : pointer to device structure (device handle)
|
||||
* @param[in] index : uint16_t register index value
|
||||
* @param[in] data : uin16_t data value write
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_WrWord(
|
||||
VL53L1_Dev_t *pdev,
|
||||
uint16_t index,
|
||||
uint16_t data);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Writes a single dword (32-bit unsigned) to the device
|
||||
*
|
||||
* Manages the big-endian nature of the device register map
|
||||
* (first byte written is the MS byte).
|
||||
*
|
||||
* @param[in] pdev : pointer to device structure (device handle)
|
||||
* @param[in] index : uint16_t register index value
|
||||
* @param[in] data : uint32_t data value to write
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_WrDWord(
|
||||
VL53L1_Dev_t *pdev,
|
||||
uint16_t index,
|
||||
uint32_t data);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Reads a single byte from the device
|
||||
*
|
||||
* @param[in] pdev : pointer to device structure (device handle)
|
||||
* @param[in] index : uint16_t register index
|
||||
* @param[out] pdata : pointer to uint8_t data value
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_RdByte(
|
||||
VL53L1_Dev_t *pdev,
|
||||
uint16_t index,
|
||||
uint8_t *pdata);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Reads a single word (16-bit unsigned) from the device
|
||||
*
|
||||
* Manages the big-endian nature of the device (first byte read is the MS byte).
|
||||
*
|
||||
* @param[in] pdev : pointer to device structure (device handle)
|
||||
* @param[in] index : uint16_t register index value
|
||||
* @param[out] pdata : pointer to uint16_t data value
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_RdWord(
|
||||
VL53L1_Dev_t *pdev,
|
||||
uint16_t index,
|
||||
uint16_t *pdata);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Reads a single dword (32-bit unsigned) from the device
|
||||
*
|
||||
* Manages the big-endian nature of the device (first byte read is the MS byte).
|
||||
*
|
||||
* @param[in] pdev : pointer to device structure (device handle)
|
||||
* @param[in] index : uint16_t register index value
|
||||
* @param[out] pdata : pointer to uint32_t data value
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_RdDWord(
|
||||
VL53L1_Dev_t *pdev,
|
||||
uint16_t index,
|
||||
uint32_t *pdata);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Implements a programmable wait in us
|
||||
*
|
||||
* @param[in] pdev : pointer to device structure (device handle)
|
||||
* @param[in] wait_us : integer wait in micro seconds
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_WaitUs(
|
||||
VL53L1_Dev_t *pdev,
|
||||
int32_t wait_us);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Implements a programmable wait in ms
|
||||
*
|
||||
* @param[in] pdev : pointer to device structure (device handle)
|
||||
* @param[in] wait_ms : integer wait in milliseconds
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_WaitMs(
|
||||
VL53L1_Dev_t *pdev,
|
||||
int32_t wait_ms);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the frequency of the timer used for ranging results time stamps
|
||||
*
|
||||
* @param[out] ptimer_freq_hz : pointer for timer frequency
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_GetTimerFrequency(int32_t *ptimer_freq_hz);
|
||||
|
||||
/**
|
||||
* @brief Get the timer value in units of timer_freq_hz (see VL53L1_get_timestamp_frequency())
|
||||
*
|
||||
* @param[out] ptimer_count : pointer for timer count value
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_GetTimerValue(int32_t *ptimer_count);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set the mode of a specified GPIO pin
|
||||
*
|
||||
* @param pin - an identifier specifying the pin being modified - defined per platform
|
||||
*
|
||||
* @param mode - an identifier specifying the requested mode - defined per platform
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_GpioSetMode(uint8_t pin, uint8_t mode);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set the value of a specified GPIO pin
|
||||
*
|
||||
* @param pin - an identifier specifying the pin being modified - defined per platform
|
||||
*
|
||||
* @param value - a value to set on the GPIO pin - typically 0 or 1
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_GpioSetValue(uint8_t pin, uint8_t value);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the value of a specified GPIO pin
|
||||
*
|
||||
* @param pin - an identifier specifying the pin being modified - defined per platform
|
||||
*
|
||||
* @param pvalue - a value retrieved from the GPIO pin - typically 0 or 1
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_GpioGetValue(uint8_t pin, uint8_t *pvalue);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Sets and clears the XShutdown pin on the Ewok
|
||||
*
|
||||
* @param value - the value for xshutdown - 0 = in reset, 1 = operational
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_GpioXshutdown(uint8_t value);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Sets and clears the Comms Mode pin (NCS) on the Ewok
|
||||
*
|
||||
* @param value - the value for comms select - 0 = I2C, 1 = SPI
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_GpioCommsSelect(uint8_t value);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Enables and disables the power to the Ewok module
|
||||
*
|
||||
* @param value - the state of the power supply - 0 = power off, 1 = power on
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_GpioPowerEnable(uint8_t value);
|
||||
|
||||
/**
|
||||
* @brief Enables callbacks to the supplied funtion pointer when Ewok interrupts ocurr
|
||||
*
|
||||
* @param function - a function callback supplies by the caller, for interrupt notification
|
||||
* @param edge_type - falling edge or rising edge interrupt detection
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_GpioInterruptEnable(void (*function)(void), uint8_t edge_type);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Disables the callback on Ewok interrupts
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_GpioInterruptDisable(void);
|
||||
|
||||
|
||||
/*
|
||||
* @brief Gets current system tick count in [ms]
|
||||
*
|
||||
* @return time_ms : current time in [ms]
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_GetTickCount(
|
||||
uint32_t *ptime_ms);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Register "wait for value" polling routine
|
||||
*
|
||||
* Port of the V2WReg Script function WaitValueMaskEx()
|
||||
*
|
||||
* @param[in] pdev : pointer to device structure (device handle)
|
||||
* @param[in] timeout_ms : timeout in [ms]
|
||||
* @param[in] index : uint16_t register index value
|
||||
* @param[in] value : value to wait for
|
||||
* @param[in] mask : mask to be applied before comparison with value
|
||||
* @param[in] poll_delay_ms : polling delay been each read transaction in [ms]
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_WaitValueMaskEx(
|
||||
VL53L1_Dev_t *pdev,
|
||||
uint32_t timeout_ms,
|
||||
uint16_t index,
|
||||
uint8_t value,
|
||||
uint8_t mask,
|
||||
uint32_t poll_delay_ms);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
90
App/VL53L1X_API/platform/inc/vl53l1_platform_init.h
Normal file
90
App/VL53L1X_API/platform/inc/vl53l1_platform_init.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/*******************************************************************************
|
||||
Copyright (C) 2016, STMicroelectronics International N.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of STMicroelectronics nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef _VL53L1_PLATFORM_INIT_H_
|
||||
#define _VL53L1_PLATFORM_INIT_H_
|
||||
|
||||
#include "vl53l1_platform.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @file vl53l1_platform_init.h
|
||||
*
|
||||
* @brief EwokPlus25 comms and GPIO init
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Initialise platform comms, GPIO and reset device
|
||||
*
|
||||
* Initialises comms, sets the states of GPIO (xshutdown, ncs,
|
||||
* EVK device power regulator enable) and resets the device
|
||||
*
|
||||
* @param[in] pdev : pointer to device structure (device handle)
|
||||
* @param[in] i2c_slave_address : I2C slave address
|
||||
* @param[in] comms_type : Comms type: VL53L1_I2C or VL53L1_SPI
|
||||
* @param[in] comms_speed_khz : 400kHz recommended for I2C
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_platform_init(
|
||||
VL53L1_Dev_t *pdev,
|
||||
uint8_t i2c_slave_address,
|
||||
uint8_t comms_type,
|
||||
uint16_t comms_speed_khz);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Close platform comms and GPIO
|
||||
*
|
||||
* Puts the device into reset, disables the EVK device power regulator
|
||||
* and closes comms
|
||||
*
|
||||
* @param[in] pdev : pointer to device structure (device handle)
|
||||
*
|
||||
* @return VL53L1_ERROR_NONE Success
|
||||
* @return "Other error code" See ::VL53L1_Error
|
||||
*/
|
||||
|
||||
VL53L1_Error VL53L1_platform_terminate(
|
||||
VL53L1_Dev_t *pdev);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
#ifdef VL53L1_NEEDS_IPP
|
||||
# undef VL53L1_IPP_API
|
||||
# define VL53L1_IPP_API __declspec(dllimport)
|
||||
# pragma comment (lib, "EwokPlus25API_IPP")
|
||||
#endif
|
||||
223
App/VL53L1X_API/platform/inc/vl53l1_platform_log.h
Normal file
223
App/VL53L1X_API/platform/inc/vl53l1_platform_log.h
Normal file
@@ -0,0 +1,223 @@
|
||||
/*******************************************************************************
|
||||
Copyright (C) 2015, STMicroelectronics International N.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of STMicroelectronics nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* @file vl53l1_platform_log.h
|
||||
*
|
||||
* @brief EwokPlus25 platform logging function definition
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _VL53L1_PLATFORM_LOG_H_
|
||||
#define _VL53L1_PLATFORM_LOG_H_
|
||||
|
||||
|
||||
#ifdef VL53L1_LOG_ENABLE
|
||||
#include "vl53l1_platform_user_config.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define EWOKPLUS_EXPORTS __declspec(dllexport)
|
||||
#else
|
||||
# define EWOKPLUS_EXPORTS
|
||||
#endif
|
||||
|
||||
#include "vl53l1_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
|
||||
/**
|
||||
* @brief Set the level, output and specific functions for module logging.
|
||||
*
|
||||
*
|
||||
* @param filename - full path of output log file, NULL for print to stdout
|
||||
*
|
||||
* @param modules - Module or None or All to trace
|
||||
* VL53L1_TRACE_MODULE_NONE
|
||||
* VL53L1_TRACE_MODULE_API
|
||||
* VL53L1_TRACE_MODULE_CORE
|
||||
* VL53L1_TRACE_MODULE_TUNING
|
||||
* VL53L1_TRACE_MODULE_CHARACTERISATION
|
||||
* VL53L1_TRACE_MODULE_PLATFORM
|
||||
* VL53L1_TRACE_MODULE_ALL
|
||||
*
|
||||
* @param level - trace level
|
||||
* VL53L1_TRACE_LEVEL_NONE
|
||||
* VL53L1_TRACE_LEVEL_ERRORS
|
||||
* VL53L1_TRACE_LEVEL_WARNING
|
||||
* VL53L1_TRACE_LEVEL_INFO
|
||||
* VL53L1_TRACE_LEVEL_DEBUG
|
||||
* VL53L1_TRACE_LEVEL_ALL
|
||||
* VL53L1_TRACE_LEVEL_IGNORE
|
||||
*
|
||||
* @param functions - function level to trace;
|
||||
* VL53L1_TRACE_FUNCTION_NONE
|
||||
* VL53L1_TRACE_FUNCTION_I2C
|
||||
* VL53L1_TRACE_FUNCTION_ALL
|
||||
*
|
||||
* @return status - always VL53L1_ERROR_NONE
|
||||
*
|
||||
*/
|
||||
|
||||
#define VL53L1_TRACE_LEVEL_NONE 0x00000000
|
||||
#define VL53L1_TRACE_LEVEL_ERRORS 0x00000001
|
||||
#define VL53L1_TRACE_LEVEL_WARNING 0x00000002
|
||||
#define VL53L1_TRACE_LEVEL_INFO 0x00000004
|
||||
#define VL53L1_TRACE_LEVEL_DEBUG 0x00000008
|
||||
#define VL53L1_TRACE_LEVEL_ALL 0x00000010
|
||||
#define VL53L1_TRACE_LEVEL_IGNORE 0x00000020
|
||||
|
||||
#define VL53L1_TRACE_FUNCTION_NONE 0x00000000
|
||||
#define VL53L1_TRACE_FUNCTION_I2C 0x00000001
|
||||
#define VL53L1_TRACE_FUNCTION_ALL 0x7fffffff
|
||||
|
||||
#define VL53L1_TRACE_MODULE_NONE 0x00000000
|
||||
#define VL53L1_TRACE_MODULE_API 0x00000001
|
||||
#define VL53L1_TRACE_MODULE_CORE 0x00000002
|
||||
#define VL53L1_TRACE_MODULE_PROTECTED 0x00000004
|
||||
#define VL53L1_TRACE_MODULE_HISTOGRAM 0x00000008
|
||||
#define VL53L1_TRACE_MODULE_REGISTERS 0x00000010
|
||||
#define VL53L1_TRACE_MODULE_PLATFORM 0x00000020
|
||||
#define VL53L1_TRACE_MODULE_NVM 0x00000040
|
||||
#define VL53L1_TRACE_MODULE_CALIBRATION_DATA 0x00000080
|
||||
#define VL53L1_TRACE_MODULE_NVM_DATA 0x00000100
|
||||
#define VL53L1_TRACE_MODULE_HISTOGRAM_DATA 0x00000200
|
||||
#define VL53L1_TRACE_MODULE_RANGE_RESULTS_DATA 0x00000400
|
||||
#define VL53L1_TRACE_MODULE_XTALK_DATA 0x00000800
|
||||
#define VL53L1_TRACE_MODULE_OFFSET_DATA 0x00001000
|
||||
#define VL53L1_TRACE_MODULE_DATA_INIT 0x00002000
|
||||
#define VL53L1_TRACE_MODULE_REF_SPAD_CHAR 0x00004000
|
||||
#define VL53L1_TRACE_MODULE_SPAD_RATE_MAP 0x00008000
|
||||
#ifdef PAL_EXTENDED
|
||||
#define VL53L1_TRACE_MODULE_SPAD 0x01000000
|
||||
#define VL53L1_TRACE_MODULE_FMT 0x02000000
|
||||
#define VL53L1_TRACE_MODULE_UTILS 0x04000000
|
||||
#define VL53L1_TRACE_MODULE_BENCH_FUNCS 0x08000000
|
||||
#endif
|
||||
#define VL53L1_TRACE_MODULE_CUSTOMER_API 0x40000000
|
||||
#define VL53L1_TRACE_MODULE_ALL 0x7fffffff
|
||||
|
||||
|
||||
extern uint32_t _trace_level;
|
||||
|
||||
/*
|
||||
* NOTE: dynamically exported if we enable logging.
|
||||
* this way, Python interfaces can access this function, but we don't
|
||||
* need to include it in the .def files.
|
||||
*/
|
||||
EWOKPLUS_EXPORTS int8_t VL53L1_trace_config(
|
||||
char *filename,
|
||||
uint32_t modules,
|
||||
uint32_t level,
|
||||
uint32_t functions);
|
||||
|
||||
/**
|
||||
* @brief Print trace module function.
|
||||
*
|
||||
* @param module - ??
|
||||
* @param level - ??
|
||||
* @param function - ??
|
||||
* @param format - ??
|
||||
*
|
||||
*/
|
||||
|
||||
EWOKPLUS_EXPORTS void VL53L1_trace_print_module_function(
|
||||
uint32_t module,
|
||||
uint32_t level,
|
||||
uint32_t function,
|
||||
const char *format, ...);
|
||||
|
||||
/**
|
||||
* @brief Get global _trace_functions parameter
|
||||
*
|
||||
* @return _trace_functions
|
||||
*/
|
||||
|
||||
uint32_t VL53L1_get_trace_functions(void);
|
||||
|
||||
/**
|
||||
* @brief Set global _trace_functions parameter
|
||||
*
|
||||
* @param[in] function : new function code
|
||||
*/
|
||||
|
||||
void VL53L1_set_trace_functions(uint32_t function);
|
||||
|
||||
|
||||
/*
|
||||
* @brief Returns the current system tick count in [ms]
|
||||
*
|
||||
* @return time_ms : current time in [ms]
|
||||
*
|
||||
*/
|
||||
|
||||
uint32_t VL53L1_clock(void);
|
||||
|
||||
#define LOG_GET_TIME() \
|
||||
((int)VL53L1_clock())
|
||||
|
||||
#define _LOG_TRACE_PRINT(module, level, function, ...) \
|
||||
VL53L1_trace_print_module_function(module, level, function, ##__VA_ARGS__);
|
||||
|
||||
#define _LOG_FUNCTION_START(module, fmt, ...) \
|
||||
VL53L1_trace_print_module_function(module, _trace_level, VL53L1_TRACE_FUNCTION_ALL, "%6ld <START> %s "fmt"\n", LOG_GET_TIME(), __FUNCTION__, ##__VA_ARGS__);
|
||||
|
||||
#define _LOG_FUNCTION_END(module, status, ...)\
|
||||
VL53L1_trace_print_module_function(module, _trace_level, VL53L1_TRACE_FUNCTION_ALL, "%6ld <END> %s %d\n", LOG_GET_TIME(), __FUNCTION__, (int)status, ##__VA_ARGS__)
|
||||
|
||||
#define _LOG_FUNCTION_END_FMT(module, status, fmt, ...)\
|
||||
VL53L1_trace_print_module_function(module, _trace_level, VL53L1_TRACE_FUNCTION_ALL, "%6ld <END> %s %d "fmt"\n", LOG_GET_TIME(), __FUNCTION__, (int)status, ##__VA_ARGS__)
|
||||
|
||||
#define _LOG_GET_TRACE_FUNCTIONS()\
|
||||
VL53L1_get_trace_functions()
|
||||
|
||||
#define _LOG_SET_TRACE_FUNCTIONS(functions)\
|
||||
VL53L1_set_trace_functions(functions)
|
||||
|
||||
#define _LOG_STRING_BUFFER(x) char x[VL53L1_MAX_STRING_LENGTH]
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#else /* VL53L1_LOG_ENABLE - no logging */
|
||||
|
||||
#define _LOG_TRACE_PRINT(module, level, function, ...)
|
||||
#define _LOG_FUNCTION_START(module, fmt, ...)
|
||||
#define _LOG_FUNCTION_END(module, status, ...)
|
||||
#define _LOG_FUNCTION_END_FMT(module, status, fmt, ...)
|
||||
#define _LOG_GET_TRACE_FUNCTIONS() 0
|
||||
#define _LOG_SET_TRACE_FUNCTIONS(functions)
|
||||
#define _LOG_STRING_BUFFER(x)
|
||||
|
||||
#endif /* VL53L1_LOG_ENABLE */
|
||||
|
||||
#endif /* _VL53L1_PLATFORM_LOG_H_ */
|
||||
84
App/VL53L1X_API/platform/inc/vl53l1_platform_user_config.h
Normal file
84
App/VL53L1X_API/platform/inc/vl53l1_platform_user_config.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/*******************************************************************************
|
||||
Copyright (C) 2015, STMicroelectronics International N.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of STMicroelectronics nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* @file vl53l1_platform_user_config.h
|
||||
*
|
||||
* @brief EwokPlus compile time user modifiable configuration
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _VL53L1_PLATFORM_USER_CONFIG_H_
|
||||
#define _VL53L1_PLATFORM_USER_CONFIG_H_
|
||||
|
||||
#define VL53L1_BYTES_PER_WORD 2
|
||||
#define VL53L1_BYTES_PER_DWORD 4
|
||||
|
||||
/* Define polling delays */
|
||||
#define VL53L1_BOOT_COMPLETION_POLLING_TIMEOUT_MS 500
|
||||
#define VL53L1_RANGE_COMPLETION_POLLING_TIMEOUT_MS 2000
|
||||
#define VL53L1_TEST_COMPLETION_POLLING_TIMEOUT_MS 60000
|
||||
|
||||
#define VL53L1_POLLING_DELAY_MS 1
|
||||
|
||||
/* Define LLD TuningParms Page Base Address
|
||||
* - Part of Patch_AddedTuningParms_11761
|
||||
*/
|
||||
#define VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS 0x8000
|
||||
#define VL53L1_TUNINGPARM_PRIVATE_PAGE_BASE_ADDRESS 0xC000
|
||||
|
||||
#define VL53L1_GAIN_FACTOR__STANDARD_DEFAULT 0x0800
|
||||
/*!< Default standard ranging gain correction factor
|
||||
1.11 format. 1.0 = 0x0800, 0.980 = 0x07D7 */
|
||||
|
||||
#define VL53L1_OFFSET_CAL_MIN_EFFECTIVE_SPADS 0x0500
|
||||
/*!< Lower Limit for the MM1 effective SPAD count during offset
|
||||
calibration Format 8.8 0x0500 -> 5.0 effective SPADs */
|
||||
|
||||
#define VL53L1_OFFSET_CAL_MAX_PRE_PEAK_RATE_MCPS 0x1900
|
||||
/*!< Max Limit for the pre range peak rate during offset
|
||||
calibration Format 9.7 0x1900 -> 50.0 Mcps.
|
||||
If larger then in pile up */
|
||||
|
||||
#define VL53L1_OFFSET_CAL_MAX_SIGMA_MM 0x0040
|
||||
/*!< Max sigma estimate limit during offset calibration
|
||||
Check applies to pre-range, mm1 and mm2 ranges
|
||||
Format 14.2 0x0040 -> 16.0mm. */
|
||||
|
||||
#define VL53L1_MAX_USER_ZONES 1
|
||||
/*!< Max number of user Zones - maximal limitation from
|
||||
FW stream divide - value of 254 */
|
||||
|
||||
#define VL53L1_MAX_RANGE_RESULTS 2
|
||||
/*!< Allocates storage for return and reference restults */
|
||||
|
||||
|
||||
#define VL53L1_MAX_STRING_LENGTH 512
|
||||
|
||||
#endif /* _VL53L1_PLATFORM_USER_CONFIG_H_ */
|
||||
|
||||
122
App/VL53L1X_API/platform/inc/vl53l1_platform_user_data.h
Normal file
122
App/VL53L1X_API/platform/inc/vl53l1_platform_user_data.h
Normal file
@@ -0,0 +1,122 @@
|
||||
/*******************************************************************************
|
||||
Copyright (C) 2016, STMicroelectronics International N.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of STMicroelectronics nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef _VL53L1_PLATFORM_USER_DATA_H_
|
||||
#define _VL53L1_PLATFORM_USER_DATA_H_
|
||||
|
||||
#ifndef __KERNEL__
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include "vl53l1_def.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @file vl53l1_platform_user_data.h
|
||||
*
|
||||
* @brief All end user OS/platform/application porting
|
||||
*/
|
||||
|
||||
/** @brief Contains the current state and internal values of the API
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
|
||||
VL53L1_DevData_t Data;
|
||||
/*!< Low Level Driver data structure */
|
||||
|
||||
uint8_t i2c_slave_address;
|
||||
/*!< i2c device address user specific field */
|
||||
uint8_t comms_type;
|
||||
/*!< Type of comms : VL53L1_I2C or VL53L1_SPI */
|
||||
uint16_t comms_speed_khz;
|
||||
/*!< Comms speed [kHz] : typically 400kHz for I2C */
|
||||
|
||||
uint32_t new_data_ready_poll_duration_ms;
|
||||
/*!< New data ready poll duration in ms - for debug */
|
||||
} VL53L1_Dev_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Declare the device Handle as a pointer of the structure @a VL53L1_Dev_t.
|
||||
*
|
||||
*/
|
||||
typedef VL53L1_Dev_t *VL53L1_DEV;
|
||||
|
||||
/**
|
||||
* @def PALDevDataGet
|
||||
* @brief Get ST private structure @a VL53L1_DevData_t data access
|
||||
*
|
||||
* @param Dev Device Handle
|
||||
* @param field ST structure field name
|
||||
* It maybe used and as real data "ref" not just as "get" for sub-structure item
|
||||
* like PALDevDataGet(FilterData.field)[i] or
|
||||
* PALDevDataGet(FilterData.MeasurementIndex)++
|
||||
*/
|
||||
#define PALDevDataGet(Dev, field) (Dev->Data.field)
|
||||
|
||||
|
||||
/**
|
||||
* @def PALDevDataSet(Dev, field, data)
|
||||
* @brief Set ST private structure @a VL53L1_DevData_t data field
|
||||
* @param Dev Device Handle
|
||||
* @param field ST structure field name
|
||||
* @param data Data to be set
|
||||
*/
|
||||
#define PALDevDataSet(Dev, field, data) ((Dev->Data.field) = (data))
|
||||
|
||||
|
||||
/**
|
||||
* @def VL53L1DevStructGetLLDriverHandle
|
||||
* @brief Get LL Driver handle @a VL53L0_Dev_t data access
|
||||
*
|
||||
* @param Dev Device Handle
|
||||
*/
|
||||
#define VL53L1DevStructGetLLDriverHandle(Dev) (&Dev->Data.LLData)
|
||||
|
||||
/**
|
||||
* @def VL53L1DevStructGetLLResultsHandle
|
||||
* @brief Get LL Results handle @a VL53L0_Dev_t data access
|
||||
*
|
||||
* @param Dev Device Handle
|
||||
*/
|
||||
#define VL53L1DevStructGetLLResultsHandle(Dev) (&Dev->Data.llresults)
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
95
App/VL53L1X_API/platform/inc/vl53l1_platform_user_defines.h
Normal file
95
App/VL53L1X_API/platform/inc/vl53l1_platform_user_defines.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/*******************************************************************************
|
||||
Copyright (C) 2016, STMicroelectronics International N.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of STMicroelectronics nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef _VL53L1_PLATFORM_USER_DEFINES_H_
|
||||
#define _VL53L1_PLATFORM_USER_DEFINES_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @file vl53l1_platform_user_defines.h
|
||||
*
|
||||
* @brief All end user OS/platform/application definitions
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @def do_division_u
|
||||
* @brief customer supplied division operation - 64-bit unsigned
|
||||
*
|
||||
* @param dividend unsigned 64-bit numerator
|
||||
* @param divisor unsigned 64-bit denominator
|
||||
*/
|
||||
#define do_division_u(dividend, divisor) (dividend / divisor)
|
||||
|
||||
|
||||
/**
|
||||
* @def do_division_s
|
||||
* @brief customer supplied division operation - 64-bit signed
|
||||
*
|
||||
* @param dividend signed 64-bit numerator
|
||||
* @param divisor signed 64-bit denominator
|
||||
*/
|
||||
#define do_division_s(dividend, divisor) (dividend / divisor)
|
||||
|
||||
|
||||
/**
|
||||
* @def WARN_OVERRIDE_STATUS
|
||||
* @brief customer supplied macro to optionally output info when a specific
|
||||
error has been overridden with success within the EwokPlus driver
|
||||
*
|
||||
* @param __X__ the macro which enabled the suppression
|
||||
*/
|
||||
#define WARN_OVERRIDE_STATUS(__X__)\
|
||||
trace_print (VL53L1_TRACE_LEVEL_WARNING, #__X__);
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define DISABLE_WARNINGS() { \
|
||||
__pragma (warning (push)); \
|
||||
__pragma (warning (disable:4127)); \
|
||||
}
|
||||
#define ENABLE_WARNINGS() { \
|
||||
__pragma (warning (pop)); \
|
||||
}
|
||||
#else
|
||||
#define DISABLE_WARNINGS()
|
||||
#define ENABLE_WARNINGS()
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _VL53L1_PLATFORM_USER_DEFINES_H_
|
||||
|
||||
114
App/VL53L1X_API/platform/inc/vl53l1_types.h
Normal file
114
App/VL53L1X_API/platform/inc/vl53l1_types.h
Normal file
@@ -0,0 +1,114 @@
|
||||
/*******************************************************************************
|
||||
Copyright (C) 2015, STMicroelectronics International N.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of STMicroelectronics nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
********************************************************************************/
|
||||
/**
|
||||
* @file vl53l1_types.h
|
||||
* @brief VL53L1 types definition
|
||||
*/
|
||||
|
||||
#ifndef _VL53L1_TYPES_H_
|
||||
#define _VL53L1_TYPES_H_
|
||||
|
||||
/** @defgroup porting_type Basic type definition
|
||||
* @ingroup api_platform
|
||||
*
|
||||
* @brief file vl53l1_types.h files hold basic type definition that may requires porting
|
||||
*
|
||||
* contains type that must be defined for the platform\n
|
||||
* when target platform and compiler provide stdint.h and stddef.h it is enough to include it.\n
|
||||
* If stdint.h is not available review and adapt all signed and unsigned 8/16/32 bits basic types. \n
|
||||
* If stddef.h is not available review and adapt NULL definition .
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef NULL
|
||||
#error "Error NULL definition should be done. Please add required include "
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(STDINT_H) && !defined(_STDINT_H) && !defined(_GCC_STDINT_H) && !defined(__STDINT_DECLS) && !defined(_GCC_WRAP_STDINT_H) && !defined(_STDINT)
|
||||
|
||||
#pragma message("Please review type definition of STDINT define for your platform and add to list above ")
|
||||
|
||||
/*
|
||||
* target platform do not provide stdint or use a different #define than above
|
||||
* to avoid seeing the message below addapt the #define list above or implement
|
||||
* all type and delete these pragma
|
||||
*/
|
||||
|
||||
/** \ingroup VL53L1_portingType_group
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
typedef unsigned long long uint64_t;
|
||||
|
||||
|
||||
/** @brief Typedef defining 32 bit unsigned int type.\n
|
||||
* The developer should modify this to suit the platform being deployed.
|
||||
*/
|
||||
typedef unsigned int uint32_t;
|
||||
|
||||
/** @brief Typedef defining 32 bit int type.\n
|
||||
* The developer should modify this to suit the platform being deployed.
|
||||
*/
|
||||
typedef int int32_t;
|
||||
|
||||
/** @brief Typedef defining 16 bit unsigned short type.\n
|
||||
* The developer should modify this to suit the platform being deployed.
|
||||
*/
|
||||
typedef unsigned short uint16_t;
|
||||
|
||||
/** @brief Typedef defining 16 bit short type.\n
|
||||
* The developer should modify this to suit the platform being deployed.
|
||||
*/
|
||||
typedef short int16_t;
|
||||
|
||||
/** @brief Typedef defining 8 bit unsigned char type.\n
|
||||
* The developer should modify this to suit the platform being deployed.
|
||||
*/
|
||||
typedef unsigned char uint8_t;
|
||||
|
||||
/** @brief Typedef defining 8 bit char type.\n
|
||||
* The developer should modify this to suit the platform being deployed.
|
||||
*/
|
||||
typedef signed char int8_t;
|
||||
|
||||
/** @} */
|
||||
#endif /* _STDINT_H */
|
||||
|
||||
|
||||
/** use where fractional values are expected
|
||||
*
|
||||
* Given a floating point value f it's .16 bit point is (int)(f*(1<<16))*/
|
||||
typedef uint32_t FixPoint1616_t;
|
||||
|
||||
#endif /* VL53L1_TYPES_H_ */
|
||||
Reference in New Issue
Block a user