VL53L0X API Specification: vl53l0x_platform.h Source File

VL53L0X API

vl53l0x_platform.h
Go to the documentation of this file.
1 /*******************************************************************************
2 Copyright � 2015, STMicroelectronics International N.V.
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of STMicroelectronics nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
19 NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
20 IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY
21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 ********************************************************************************/
28 
29 
30 #ifndef _VL53L0X_PLATFORM_H_
31 #define _VL53L0X_PLATFORM_H_
32 
33 #include "vl53l0x_def.h"
34 #include "vl53l0x_platform_log.h"
35 #include "vl53l0x_i2c_platform.h"
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
58 typedef struct {
67 
68 
74 
84 #define PALDevDataGet(Dev, field) (Dev->Data.field)
85 
93 #define PALDevDataSet(Dev, field, data) (Dev->Data.field)=(data)
94 
95 
109 
117 
118 
128 VL53L0X_Error VL53L0X_WriteMulti(VL53L0X_DEV Dev, uint8_t index, uint8_t *pdata, uint32_t count);
129 
139 VL53L0X_Error VL53L0X_ReadMulti(VL53L0X_DEV Dev, uint8_t index, uint8_t *pdata, uint32_t count);
140 
149 VL53L0X_Error VL53L0X_WrByte(VL53L0X_DEV Dev, uint8_t index, uint8_t data);
150 
159 VL53L0X_Error VL53L0X_WrWord(VL53L0X_DEV Dev, uint8_t index, uint16_t data);
160 
169 VL53L0X_Error VL53L0X_WrDWord(VL53L0X_DEV Dev, uint8_t index, uint32_t data);
170 
179 VL53L0X_Error VL53L0X_RdByte(VL53L0X_DEV Dev, uint8_t index, uint8_t *data);
180 
189 VL53L0X_Error VL53L0X_RdWord(VL53L0X_DEV Dev, uint8_t index, uint16_t *data);
190 
199 VL53L0X_Error VL53L0X_RdDWord(VL53L0X_DEV Dev, uint8_t index, uint32_t *data);
200 
213 VL53L0X_Error VL53L0X_UpdateByte(VL53L0X_DEV Dev, uint8_t index, uint8_t AndData, uint8_t OrData);
214 
230 VL53L0X_Error VL53L0X_PollingDelay(VL53L0X_DEV Dev); /* usually best implemented as a real function */
231 
234 #ifdef __cplusplus
235 }
236 #endif
237 
238 #endif /* _VL53L0X_PLATFORM_H_ */
239 
240 
241 
VL53L0X_Error VL53L0X_UnlockSequenceAccess(VL53L0X_DEV Dev)
Unlock comms interface to serialize all commands to a shared I2C interface for a specific device...
VL53L0X_Error VL53L0X_RdByte(VL53L0X_DEV Dev, uint8_t index, uint8_t *data)
Read single byte register.
VL53L0X_Error VL53L0X_PollingDelay(VL53L0X_DEV Dev)
execute delay in all polling API call
VL53L0X_Error VL53L0X_RdWord(VL53L0X_DEV Dev, uint8_t index, uint16_t *data)
Read word (2byte) register.
VL53L0X_Dev_t * VL53L0X_DEV
Declare the device Handle as a pointer of the structure VL53L0X_Dev_t.
VL53L0X_Error VL53L0X_ReadMulti(VL53L0X_DEV Dev, uint8_t index, uint8_t *pdata, uint32_t count)
Reads the requested number of bytes from the device.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l0x_types.h:85
VL53L0X PAL device ST private data structure End user should never access any of these field directl...
Definition: vl53l0x_def.h:433
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
Definition: vl53l0x_types.h:75
VL53L0X_Error VL53L0X_WrDWord(VL53L0X_DEV Dev, uint8_t index, uint32_t data)
Write double word (4 byte) register.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l0x_types.h:95
Generic PAL device type that does link between API and platform abstraction layer.
VL53L0X_Error VL53L0X_WrByte(VL53L0X_DEV Dev, uint8_t index, uint8_t data)
Write single byte register.
VL53L0X_Error VL53L0X_WrWord(VL53L0X_DEV Dev, uint8_t index, uint16_t data)
Write word register.
VL53L0X_DevData_t Data
uint16_t comms_speed_khz
VL53L0X_Error VL53L0X_UpdateByte(VL53L0X_DEV Dev, uint8_t index, uint8_t AndData, uint8_t OrData)
Threat safe Update (read/modify/write) single byte register.
VL53L0X_Error VL53L0X_WriteMulti(VL53L0X_DEV Dev, uint8_t index, uint8_t *pdata, uint32_t count)
Writes the supplied byte buffer to the device.
Type definitions for VL53L0X API.
VL53L0X_Error VL53L0X_LockSequenceAccess(VL53L0X_DEV Dev)
Lock comms interface to serialize all commands to a shared I2C interface for a specific device...
platform log function definition
int8_t VL53L0X_Error
Definition: vl53l0x_def.h:131
VL53L0X_Error VL53L0X_RdDWord(VL53L0X_DEV Dev, uint8_t index, uint32_t *data)
Read dword (4byte) register.