VL53L0X API Specification: vl53l0x_i2c_platform.h Source File

VL53L0X API

vl53l0x_i2c_platform.h
Go to the documentation of this file.
1 /*
2  * COPYRIGHT (C) STMicroelectronics 2014. All rights reserved.
3  *
4  * This software is the confidential and proprietary information of
5  * STMicroelectronics ("Confidential Information"). You shall not
6  * disclose such Confidential Information and shall use it only in
7  * accordance with the terms of the license agreement you entered into
8  * with STMicroelectronics
9  *
10  * Programming Golden Rule: Keep it Simple!
11  *
12  */
13 
21 #ifndef _VL53L0X_I2C_PLATFORM_H_
22 #define _VL53L0X_I2C_PLATFORM_H_
23 
24 #include "vl53l0x_def.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 // Include uint8_t, unit16_t etc definitions
31 
32 #include <stdint.h>
33 #include <stdarg.h>
34 
35 
42 // enum {TRUE = true, FALSE = false};
43 
50 #ifndef bool_t
51 typedef unsigned char bool_t;
52 #endif
53 
54 
55 #define I2C 0x01
56 #define SPI 0x00
57 
58 #define COMMS_BUFFER_SIZE 64 // MUST be the same size as the SV task buffer
59 
60 #define BYTES_PER_WORD 2
61 #define BYTES_PER_DWORD 4
62 
63 #define VL53L0X_MAX_STRING_LENGTH_PLT 256
64 
76  uint16_t comms_speed_khz);
77 
86 
95 
96 
121 int32_t VL53L0X_write_multi(uint8_t address, uint8_t index, uint8_t *pdata, int32_t count);
122 
123 
148 int32_t VL53L0X_read_multi(uint8_t address, uint8_t index, uint8_t *pdata, int32_t count);
149 
150 
174 int32_t VL53L0X_write_byte(uint8_t address, uint8_t index, uint8_t data);
175 
176 
201 int32_t VL53L0X_write_word(uint8_t address, uint8_t index, uint16_t data);
202 
203 
228 int32_t VL53L0X_write_dword(uint8_t address, uint8_t index, uint32_t data);
229 
230 
231 
255 int32_t VL53L0X_read_byte(uint8_t address, uint8_t index, uint8_t *pdata);
256 
257 
282 int32_t VL53L0X_read_word(uint8_t address, uint8_t index, uint16_t *pdata);
283 
284 
309 int32_t VL53L0X_read_dword(uint8_t address, uint8_t index, uint32_t *pdata);
310 
311 
324 
325 
338 
339 
350 
351 
362 
371 
372 
383 
394 
395 
396 
397 
398 
399 #ifdef __cplusplus
400 }
401 #endif
402 
403 #endif //_VL53L0X_I2C_PLATFORM_H_
404 
int int32_t
Typedef defining 32 bit int type.
Definition: vl53l0x_types.h:80
int32_t VL53L0X_read_multi(uint8_t address, uint8_t index, uint8_t *pdata, int32_t count)
Reads the requested number of bytes from the device.
int32_t VL53L0X_write_word(uint8_t address, uint8_t index, uint16_t data)
Writes a single word (16-bit unsigned) to the device.
int32_t VL53L0X_get_timer_frequency(int32_t *ptimer_freq_hz)
Get the frequency of the timer used for ranging results time stamps.
int32_t VL53L0X_wait_ms(int32_t wait_ms)
Implements a programmable wait in ms.
int32_t VL53L0X_write_multi(uint8_t address, uint8_t index, uint8_t *pdata, int32_t count)
Writes the supplied byte buffer to the device.
int32_t VL53L0X_read_byte(uint8_t address, uint8_t index, uint8_t *pdata)
Reads a single byte from the device.
int32_t VL53L0X_read_word(uint8_t address, uint8_t index, uint16_t *pdata)
Reads a single word (16-bit unsigned) from the device.
int32_t VL53L0X_read_dword(uint8_t address, uint8_t index, uint32_t *pdata)
Reads a single dword (32-bit unsigned) from the device.
unsigned char bool_t
Typedef defining .
int32_t VL53L0X_comms_initialise(uint8_t comms_type, uint16_t comms_speed_khz)
Initialise platform comms.
int32_t VL53L0X_release_gpio(void)
Release force on GPIO.
int32_t VL53L0X_get_timer_value(int32_t *ptimer_count)
Get the timer value in units of timer_freq_hz (see VL53L0X_get_timestamp_frequency()) ...
int32_t VL53L0X_cycle_power(void)
Cycle Power to Device.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l0x_types.h:85
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
Definition: vl53l0x_types.h:75
int32_t VL53L0X_write_byte(uint8_t address, uint8_t index, uint8_t data)
Writes a single byte to the device.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l0x_types.h:95
int32_t VL53L0X_comms_close(void)
Close platform comms.
int32_t VL53L0X_write_dword(uint8_t address, uint8_t index, uint32_t data)
Writes a single dword (32-bit unsigned) to the device.
int32_t VL53L0X_platform_wait_us(int32_t wait_us)
Implements a programmable wait in us.
int32_t VL53L0X_get_gpio(uint8_t *plevel)
Get GPIO value.
Type definitions for VL53L0X API.
int32_t VL53L0X_set_gpio(uint8_t level)
Set GPIO value.