O7/vl53lx_uld/vl53l1_platform.h

142 lines
3.8 KiB
C

/*
* This file is part of VL53L1 Platform
*
* Copyright (c) 2016, STMicroelectronics - All Rights Reserved
*
* License terms: BSD 3-clause "New" or "Revised" License.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. 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.
*
* 3. Neither the name of the copyright holder 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 AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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 "stm32wlxx_hal.h"
#include "vl53l1_platform_log.h"
#include "vl53l1_types.h"
#include "vl53l1_error_codes.h"
#ifdef __cplusplus
extern "C"
{
#endif
VL53L1_Error VL53L1_CommsInitialise(
uint16_t dev,
uint8_t comms_type,
uint16_t comms_speed_khz);
VL53L1_Error VL53L1_CommsClose(
uint16_t dev);
VL53L1_Error VL53L1_WriteMulti(
uint16_t dev,
uint16_t index,
uint8_t *pdata,
uint32_t count);
VL53L1_Error VL53L1_ReadMulti(
uint16_t dev,
uint16_t index,
uint8_t *pdata,
uint32_t count);
VL53L1_Error VL53L1_WrByte(
uint16_t dev,
uint16_t index,
uint8_t VL53L1_PRM_00005);
VL53L1_Error VL53L1_WrWord(
uint16_t dev,
uint16_t index,
uint16_t VL53L1_PRM_00005);
VL53L1_Error VL53L1_WrDWord(
uint16_t dev,
uint16_t index,
uint32_t VL53L1_PRM_00005);
VL53L1_Error VL53L1_RdByte(
uint16_t dev,
uint16_t index,
uint8_t *pdata);
VL53L1_Error VL53L1_RdWord(
uint16_t dev,
uint16_t index,
uint16_t *pdata);
VL53L1_Error VL53L1_RdDWord(
uint16_t dev,
uint16_t index,
uint32_t *pdata);
VL53L1_Error VL53L1_WaitUs(
uint16_t dev,
int32_t wait_us);
VL53L1_Error VL53L1_WaitMs(
uint16_t dev,
int32_t wait_ms);
VL53L1_Error VL53L1_GetTimerFrequency(int32_t *ptimer_freq_hz);
VL53L1_Error VL53L1_GetTimerValue(int32_t *ptimer_count);
VL53L1_Error VL53L1_GpioSetMode(uint8_t pin, uint8_t mode);
VL53L1_Error VL53L1_GpioSetValue(uint8_t pin, uint8_t value);
VL53L1_Error VL53L1_GpioGetValue(uint8_t pin, uint8_t *pvalue);
VL53L1_Error VL53L1_GpioXshutdown(uint8_t value);
VL53L1_Error VL53L1_GpioCommsSelect(uint8_t value);
VL53L1_Error VL53L1_GpioPowerEnable(uint8_t value);
VL53L1_Error VL53L1_GpioInterruptEnable(void (*function)(void), uint8_t edge_type);
VL53L1_Error VL53L1_GpioInterruptDisable(void);
VL53L1_Error VL53L1_GetTickCount(
uint32_t *ptime_ms);
VL53L1_Error VL53L1_WaitValueMaskEx(
uint16_t dev,
uint32_t timeout_ms,
uint16_t index,
uint8_t value,
uint8_t mask,
uint32_t poll_delay_ms);
#ifdef __cplusplus
}
#endif
#endif