Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
vl53l1_platform.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Tom van Dijk <tomvand@users.noreply.github.com>
3  * Adapted from STSW-IMG009 vl53l1_platform.h
4  *
5  * This file is part of paparazzi.
6  *
7  * paparazzi is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * paparazzi is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with paparazzi; see the file COPYING. If not, write to
19  * the Free Software Foundation, 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  *
22  */
28 #ifndef _VL53L1_PLATFORM_H_
29 #define _VL53L1_PLATFORM_H_
30 
31 #include "vl53l1_types.h"
32 
33 #include "mcu_periph/i2c.h"
34 
35 #ifdef __cplusplus
36 extern "C"
37 {
38 #endif
39 
40 #define VL53L1_DEFAULT_ADDRESS 0x52
41 
48 };
49 
50 typedef struct {
51  struct i2c_periph *i2c_p;
52  struct i2c_transaction i2c_trans;
53  struct NonBlocking {
54  /* I2C Read/write state machine */
56  /* State machine for nonblocking functions */
59  } nonblocking;
60  enum VL53L1_ReadStatus read_status;
61 } VL53L1_Dev_t;
62 
64 
70  uint16_t index,
71  uint8_t *pdata,
72  uint32_t count);
78  uint16_t index,
79  uint8_t *pdata,
80  uint32_t count);
86  uint16_t index,
87  uint8_t data);
93  uint16_t index,
94  uint16_t data);
100  uint16_t index,
101  uint32_t data);
106  VL53L1_DEV dev,
107  uint16_t index,
108  uint8_t *pdata);
113  VL53L1_DEV dev,
114  uint16_t index,
115  uint16_t *pdata);
120  VL53L1_DEV dev,
121  uint16_t index,
122  uint32_t *pdata);
123 
124 
125 #ifdef __cplusplus
126 }
127 #endif
128 
129 #endif
uint16_t
unsigned short uint16_t
Definition: types.h:16
vl53l1_types.h
VL53L1 types definition.
VL53L1_RdDWord
int8_t VL53L1_RdDWord(VL53L1_DEV dev, uint16_t index, uint32_t *pdata)
VL53L1_RdDWord() definition.
Definition: vl53l1_platform.c:102
VL53L1_WrWord
int8_t VL53L1_WrWord(VL53L1_DEV dev, uint16_t index, uint16_t data)
VL53L1_WrWord() definition.
Definition: vl53l1_platform.c:69
VL53L1_RdWord
int8_t VL53L1_RdWord(VL53L1_DEV dev, uint16_t index, uint16_t *pdata)
VL53L1_RdWord() definition.
Definition: vl53l1_platform.c:94
uint32_t
unsigned long uint32_t
Definition: types.h:18
VL53L1_WrByte
int8_t VL53L1_WrByte(VL53L1_DEV dev, uint16_t index, uint8_t data)
VL53L1_WrByte() definition.
Definition: vl53l1_platform.c:64
VL53L1_WrDWord
int8_t VL53L1_WrDWord(VL53L1_DEV dev, uint16_t index, uint32_t data)
VL53L1_WrDWord() definition.
Definition: vl53l1_platform.c:78
VL53L1_Dev_t::NonBlocking::state
uint8_t state
Definition: vl53l1_platform.h:57
VL53L1_READ_DISTANCE
@ VL53L1_READ_DISTANCE
Definition: vl53l1_platform.h:46
VL53L1_READ_IDLE
@ VL53L1_READ_IDLE
Definition: vl53l1_platform.h:43
VL53L1_Dev_t::NonBlocking::i2c_state
uint8_t i2c_state
Definition: vl53l1_platform.h:55
dev
static const struct usb_device_descriptor dev
Definition: usb_ser_hw.c:74
uint8_t
unsigned char uint8_t
Definition: types.h:14
VL53L1_DEV
VL53L1_Dev_t * VL53L1_DEV
Definition: vl53l1_platform.h:63
VL53L1_READ_DATA_READY
@ VL53L1_READ_DATA_READY
Definition: vl53l1_platform.h:44
VL53L1_RdByte
int8_t VL53L1_RdByte(VL53L1_DEV dev, uint16_t index, uint8_t *pdata)
VL53L1_RdByte() definition.
Definition: vl53l1_platform.c:89
i2c_transaction
I2C transaction structure.
Definition: i2c.h:93
VL53L1_WriteMulti
int8_t VL53L1_WriteMulti(VL53L1_DEV dev, uint16_t index, uint8_t *pdata, uint32_t count)
VL53L1_WriteMulti() definition.
Definition: vl53l1_platform.c:43
VL53L1_ReadStatus
VL53L1_ReadStatus
Definition: vl53l1_platform.h:42
int8_t
signed char int8_t
Definition: types.h:15
VL53L1_Dev_t::NonBlocking
Definition: vl53l1_platform.h:53
VL53L1_ReadMulti
int8_t VL53L1_ReadMulti(VL53L1_DEV dev, uint16_t index, uint8_t *pdata, uint32_t count)
VL53L1_ReadMulti() definition.
Definition: vl53l1_platform.c:53
VL53L1_Dev_t::NonBlocking::IntPol
uint8_t IntPol
Definition: vl53l1_platform.h:58
VL53L1_Dev_t::i2c_p
struct i2c_periph * i2c_p
Definition: vl53l1_platform.h:51
i2c_periph
Definition: i2c.h:144
VL53L1_CLEAR_INT
@ VL53L1_CLEAR_INT
Definition: vl53l1_platform.h:47
i2c.h
VL53L1_Dev_t
Definition: vl53l1_platform.h:50
VL53L1_READ_STATUS
@ VL53L1_READ_STATUS
Definition: vl53l1_platform.h:45