Statistics
| Branch: | Tag: | Revision:

amiro-lld / drivers / VL53L1X / v1 / api / platform / vl53l1_platform_user_data.h @ 3ed0cc4d

History | View | Annotate | Download (4.541 KB)

1 4dba9195 galberding
2
/*
3
* Copyright (c) 2017, STMicroelectronics - All Rights Reserved
4
*
5
* This file is part of VL53L1 Core and is dual licensed,
6
* either 'STMicroelectronics
7
* Proprietary license'
8
* or 'BSD 3-clause "New" or "Revised" License' , at your option.
9
*
10
********************************************************************************
11
*
12
* 'STMicroelectronics Proprietary license'
13
*
14
********************************************************************************
15
*
16
* License terms: STMicroelectronics Proprietary in accordance with licensing
17
* terms at www.st.com/sla0081
18
*
19
* STMicroelectronics confidential
20
* Reproduction and Communication of this document is strictly prohibited unless
21
* specifically authorized in writing by STMicroelectronics.
22
*
23
*
24
********************************************************************************
25
*
26
* Alternatively, VL53L1 Core may be distributed under the terms of
27
* 'BSD 3-clause "New" or "Revised" License', in which case the following
28
* provisions apply instead of the ones mentioned above :
29
*
30
********************************************************************************
31
*
32
* License terms: BSD 3-clause "New" or "Revised" License.
33
*
34
* Redistribution and use in source and binary forms, with or without
35
* modification, are permitted provided that the following conditions are met:
36
*
37
* 1. Redistributions of source code must retain the above copyright notice, this
38
* list of conditions and the following disclaimer.
39
*
40
* 2. Redistributions in binary form must reproduce the above copyright notice,
41
* this list of conditions and the following disclaimer in the documentation
42
* and/or other materials provided with the distribution.
43
*
44
* 3. Neither the name of the copyright holder nor the names of its contributors
45
* may be used to endorse or promote products derived from this software
46
* without specific prior written permission.
47
*
48
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
49
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
51
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
52
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
54
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
55
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
56
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
57
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58
*
59
*
60
********************************************************************************
61
*
62 3ed0cc4d Thomas Schöpping
* Modified for use within AMiRo-LLD.
63
*
64
* AMiRo-LLD is a compilation of low-level hardware drivers for the Autonomous
65
* Mini Robot (AMiRo) platform.
66
* Copyright (C) 2016..2019  Thomas Schöpping et al.
67
*
68
********************************************************************************
69
*
70 4dba9195 galberding
*/
71
72
#ifndef _VL53L1_PLATFORM_USER_DATA_H_
73
#define _VL53L1_PLATFORM_USER_DATA_H_
74 3ed0cc4d Thomas Schöpping
75 4dba9195 galberding
#include "vl53l1_def.h"
76 3ed0cc4d Thomas Schöpping
#include <periphAL.h>
77
78 4dba9195 galberding
#ifdef __cplusplus
79
extern "C"
80
{
81
#endif
82
83 3ed0cc4d Thomas Schöpping
/**
84
 * @brief VL53L1X interface related data structure.
85
 */
86
typedef struct {
87
  /**
88
   * @brief   Pointer to the associated I2C driver.
89
   */
90
  apalI2CDriver_t* i2cd;
91
92
  /**
93
   * @brief   Currently set I2C device address.
94
   */
95
  apalI2Caddr_t addr;
96 4dba9195 galberding
97 3ed0cc4d Thomas Schöpping
  /**
98
   * @brief   Pointer to the GPIO driver for the GPIO1 signal.
99
   */
100
  const apalControlGpio_t* gpio1;
101 4dba9195 galberding
102 3ed0cc4d Thomas Schöpping
  /**
103
   * @brief   Pointer to the GPIO driver for the XSHUT signal.
104
   */
105
  const apalControlGpio_t* xshut;
106
} VL53L1_IfData_t;
107 4dba9195 galberding
108 3ed0cc4d Thomas Schöpping
/**
109
 * @brief   VL53L1X device driver structure as to be used by the ST API.
110
 */
111
typedef struct {
112
  /**
113
   * @brief   Device data as specified by the ST API.
114
   */
115
  VL53L1_DevData_t   Data;
116 4dba9195 galberding
117 3ed0cc4d Thomas Schöpping
  /**
118
   * @brief   Interface data.
119
   */
120
  VL53L1_IfData_t     Interface;
121 4dba9195 galberding
122
} VL53L1_Dev_t;
123
124 3ed0cc4d Thomas Schöpping
/**
125
 * @brief   Typedef as it is used by the ST API.
126
 */
127 4dba9195 galberding
typedef VL53L1_Dev_t *VL53L1_DEV;
128
129 3ed0cc4d Thomas Schöpping
/**
130
 * @brief   Typedef matching the PeriphAL conventions.
131
 */
132
typedef VL53L1_Dev_t VL53L1XDriver;
133
134 4dba9195 galberding
#define VL53L1DevDataGet(Dev, field) (Dev->Data.field)
135
#define VL53L1DevDataSet(Dev, field, VL53L1_PRM_00005) ((Dev->Data.field) = (VL53L1_PRM_00005))
136
#define VL53L1DevStructGetLLDriverHandle(Dev) (&Dev->Data.LLData)
137
#define VL53L1DevStructGetLLResultsHandle(Dev) (&Dev->Data.llresults)
138 3ed0cc4d Thomas Schöpping
139 4dba9195 galberding
#ifdef __cplusplus
140
}
141
#endif
142 3ed0cc4d Thomas Schöpping
143
#endif /* _VL53L1_PLATFORM_USER_DATA_H_ */