amiro-lld / drivers / VL53L1X / v1 / api / platform / vl53l1_platform.c @ 3ed0cc4d
History | View | Annotate | Download (6.655 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 | */
|
||
63 | |||
64 | |||
65 | #include "vl53l1_platform.h" |
||
66 | // #include "vl53l1_platform_log.h"
|
||
67 | #include "vl53l1_api.h" |
||
68 | |||
69 | // #include "stm32xxx_hal.h"
|
||
70 | #include <string.h> |
||
71 | // #include <time.h>
|
||
72 | // #include <math.h>
|
||
73 | |||
74 | |||
75 | // #define I2C_TIME_OUT_BASE 10
|
||
76 | // #define I2C_TIME_OUT_BYTE 1
|
||
77 | |||
78 | // #ifdef VL53L1_LOG_ENABLE
|
||
79 | // #define trace_print(level, ...) VL53L1_trace_print_module_function(VL53L1_TRACE_MODULE_PLATFORM, level, VL53L1_TRACE_FUNCTION_NONE, ##__VA_ARGS__)
|
||
80 | // #define trace_i2c(...) VL53L1_trace_print_module_function(VL53L1_TRACE_MODULE_NONE, VL53L1_TRACE_LEVEL_NONE, VL53L1_TRACE_FUNCTION_I2C, ##__VA_ARGS__)
|
||
81 | // #endif
|
||
82 | |||
83 | // #ifndef HAL_I2C_MODULE_ENABLED
|
||
84 | // #warning "HAL I2C module must be enable "
|
||
85 | // #endif
|
||
86 | |||
87 | //extern I2C_HandleTypeDef hi2c1;
|
||
88 | //#define VL53L0X_pI2cHandle (&hi2c1)
|
||
89 | |||
90 | /* when not customized by application define dummy one */
|
||
91 | // #ifndef VL53L1_GetI2cBus
|
||
92 | /** This macro can be overloaded by user to enforce i2c sharing in RTOS context
|
||
93 | */
|
||
94 | // # define VL53L1_GetI2cBus(...) (void)0
|
||
95 | // #endif
|
||
96 | |||
97 | // #ifndef VL53L1_PutI2cBus
|
||
98 | /** This macro can be overloaded by user to enforce i2c sharing in RTOS context
|
||
99 | */
|
||
100 | // # define VL53L1_PutI2cBus(...) (void)0
|
||
101 | // #endif
|
||
102 | |||
103 | // uint8_t _I2CBuffer[256];
|
||
104 | |||
105 | // int _I2CWrite(VL53L1_DEV Dev, uint8_t *pdata, uint32_t count) {
|
||
106 | // int status = 0;
|
||
107 | // return status;
|
||
108 | // }
|
||
109 | |||
110 | // int _I2CRead(VL53L1_DEV Dev, uint8_t *pdata, uint32_t count) {
|
||
111 | // int status = 0;
|
||
112 | 3ed0cc4d | Thomas Schöpping | // return Status;
|
113 | 4dba9195 | galberding | // }
|
114 | |||
115 | VL53L1_Error VL53L1_WriteMulti(VL53L1_DEV Dev, uint16_t index, uint8_t *pdata, uint32_t count) { |
||
116 | VL53L1_Error Status = VL53L1_ERROR_NONE; |
||
117 | return Status;
|
||
118 | } |
||
119 | |||
120 | // the ranging_sensor_comms.dll will take care of the page selection
|
||
121 | VL53L1_Error VL53L1_ReadMulti(VL53L1_DEV Dev, uint16_t index, uint8_t *pdata, uint32_t count) { |
||
122 | VL53L1_Error Status = VL53L1_ERROR_NONE; |
||
123 | return Status;
|
||
124 | } |
||
125 | |||
126 | VL53L1_Error VL53L1_WrByte(VL53L1_DEV Dev, uint16_t index, uint8_t data) { |
||
127 | VL53L1_Error Status = VL53L1_ERROR_NONE; |
||
128 | return Status;
|
||
129 | } |
||
130 | |||
131 | VL53L1_Error VL53L1_WrWord(VL53L1_DEV Dev, uint16_t index, uint16_t data) { |
||
132 | VL53L1_Error Status = VL53L1_ERROR_NONE; |
||
133 | return Status;
|
||
134 | } |
||
135 | |||
136 | VL53L1_Error VL53L1_WrDWord(VL53L1_DEV Dev, uint16_t index, uint32_t data) { |
||
137 | VL53L1_Error Status = VL53L1_ERROR_NONE; |
||
138 | return Status;
|
||
139 | } |
||
140 | |||
141 | VL53L1_Error VL53L1_UpdateByte(VL53L1_DEV Dev, uint16_t index, uint8_t AndData, uint8_t OrData) { |
||
142 | VL53L1_Error Status = VL53L1_ERROR_NONE; |
||
143 | return Status;
|
||
144 | } |
||
145 | |||
146 | VL53L1_Error VL53L1_RdByte(VL53L1_DEV Dev, uint16_t index, uint8_t *data) { |
||
147 | VL53L1_Error Status = VL53L1_ERROR_NONE; |
||
148 | return Status;
|
||
149 | } |
||
150 | |||
151 | VL53L1_Error VL53L1_RdWord(VL53L1_DEV Dev, uint16_t index, uint16_t *data) { |
||
152 | VL53L1_Error Status = VL53L1_ERROR_NONE; |
||
153 | return Status;
|
||
154 | } |
||
155 | |||
156 | VL53L1_Error VL53L1_RdDWord(VL53L1_DEV Dev, uint16_t index, uint32_t *data) { |
||
157 | VL53L1_Error Status = VL53L1_ERROR_NONE; |
||
158 | return Status;
|
||
159 | } |
||
160 | |||
161 | VL53L1_Error VL53L1_GetTickCount( |
||
162 | uint32_t *ptick_count_ms) |
||
163 | { |
||
164 | VL53L1_Error status = VL53L1_ERROR_NONE; |
||
165 | return status;
|
||
166 | } |
||
167 | |||
168 | //#define trace_print(level, ...) \
|
||
169 | // _LOG_TRACE_PRINT(VL53L1_TRACE_MODULE_PLATFORM, \
|
||
170 | // level, VL53L1_TRACE_FUNCTION_NONE, ##__VA_ARGS__)
|
||
171 | |||
172 | //#define trace_i2c(...) \
|
||
173 | // _LOG_TRACE_PRINT(VL53L1_TRACE_MODULE_NONE, \
|
||
174 | // VL53L1_TRACE_LEVEL_NONE, VL53L1_TRACE_FUNCTION_I2C, ##__VA_ARGS__)
|
||
175 | |||
176 | VL53L1_Error VL53L1_GetTimerFrequency(int32_t *ptimer_freq_hz) |
||
177 | { |
||
178 | VL53L1_Error status = VL53L1_ERROR_NONE; |
||
179 | return status;
|
||
180 | } |
||
181 | |||
182 | VL53L1_Error VL53L1_WaitMs(VL53L1_Dev_t *pdev, int32_t wait_ms){ |
||
183 | VL53L1_Error status = VL53L1_ERROR_NONE; |
||
184 | return status;
|
||
185 | } |
||
186 | |||
187 | VL53L1_Error VL53L1_WaitUs(VL53L1_Dev_t *pdev, int32_t wait_us){ |
||
188 | VL53L1_Error status = VL53L1_ERROR_NONE; |
||
189 | return status;
|
||
190 | } |
||
191 | |||
192 | VL53L1_Error VL53L1_WaitValueMaskEx( |
||
193 | VL53L1_Dev_t *pdev, |
||
194 | uint32_t timeout_ms, |
||
195 | uint16_t index, |
||
196 | uint8_t value, |
||
197 | uint8_t mask, |
||
198 | uint32_t poll_delay_ms) |
||
199 | { |
||
200 | VL53L1_Error status = VL53L1_ERROR_NONE; |
||
201 | return status;
|
||
202 | } |
||
203 | |||
204 | |||
205 | |||
206 |