Statistics
| Branch: | Tag: | Revision:

amiro-lld / drivers / VL53L1X / v1 / api / platform / vl53l1_platform.c @ 4dba9195

History | View | Annotate | Download (6.832 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
//    apalExitStatus_t status = apalI2CMasterTransmit(Dev.vl53l1x->i2cd, (apalI2Caddr_t)VL53L1X_LLD_I2C_ADDR_FIXED, txbuf, 1, rxbuf, 2, timeout);
108
//     return status;
109
// }
110
111
// int _I2CRead(VL53L1_DEV Dev, uint8_t *pdata, uint32_t count) {
112
//    int status = 0;
113
//    return status;
114
// }
115
116
// TODO: Needs to be defined
117
118
VL53L1_Error VL53L1_WriteMulti(VL53L1_DEV Dev, uint16_t index, uint8_t *pdata, uint32_t count) {
119
    VL53L1_Error Status = VL53L1_ERROR_NONE;
120
121
    return Status;
122
}
123
124
// the ranging_sensor_comms.dll will take care of the page selection
125
VL53L1_Error VL53L1_ReadMulti(VL53L1_DEV Dev, uint16_t index, uint8_t *pdata, uint32_t count) {
126
    VL53L1_Error Status = VL53L1_ERROR_NONE;
127
    return Status;
128
}
129
130
VL53L1_Error VL53L1_WrByte(VL53L1_DEV Dev, uint16_t index, uint8_t data) {
131
    VL53L1_Error Status = VL53L1_ERROR_NONE;
132
    return Status;
133
}
134
135
VL53L1_Error VL53L1_WrWord(VL53L1_DEV Dev, uint16_t index, uint16_t data) {
136
    VL53L1_Error Status = VL53L1_ERROR_NONE;
137
    return Status;
138
}
139
140
VL53L1_Error VL53L1_WrDWord(VL53L1_DEV Dev, uint16_t index, uint32_t data) {
141
    VL53L1_Error Status = VL53L1_ERROR_NONE;
142
    return Status;
143
}
144
145
VL53L1_Error VL53L1_UpdateByte(VL53L1_DEV Dev, uint16_t index, uint8_t AndData, uint8_t OrData) {
146
    VL53L1_Error Status = VL53L1_ERROR_NONE;
147
    return Status;
148
}
149
150
VL53L1_Error VL53L1_RdByte(VL53L1_DEV Dev, uint16_t index, uint8_t *data) {
151
    VL53L1_Error Status = VL53L1_ERROR_NONE;
152
    return Status;
153
}
154
155
VL53L1_Error VL53L1_RdWord(VL53L1_DEV Dev, uint16_t index, uint16_t *data) {
156
    VL53L1_Error Status = VL53L1_ERROR_NONE;
157
    return Status;
158
}
159
160
VL53L1_Error VL53L1_RdDWord(VL53L1_DEV Dev, uint16_t index, uint32_t *data) {
161
    VL53L1_Error Status = VL53L1_ERROR_NONE;
162
    return Status;
163
}
164
165
VL53L1_Error VL53L1_GetTickCount(
166
        uint32_t *ptick_count_ms)
167
{
168
        VL53L1_Error status  = VL53L1_ERROR_NONE;
169
        return status;
170
}
171
172
//#define trace_print(level, ...) \
173
//        _LOG_TRACE_PRINT(VL53L1_TRACE_MODULE_PLATFORM, \
174
//        level, VL53L1_TRACE_FUNCTION_NONE, ##__VA_ARGS__)
175
176
//#define trace_i2c(...) \
177
//        _LOG_TRACE_PRINT(VL53L1_TRACE_MODULE_NONE, \
178
//        VL53L1_TRACE_LEVEL_NONE, VL53L1_TRACE_FUNCTION_I2C, ##__VA_ARGS__)
179
180
VL53L1_Error VL53L1_GetTimerFrequency(int32_t *ptimer_freq_hz)
181
{
182
        VL53L1_Error status  = VL53L1_ERROR_NONE;
183
        return status;
184
}
185
186
VL53L1_Error VL53L1_WaitMs(VL53L1_Dev_t *pdev, int32_t wait_ms){
187
        VL53L1_Error status  = VL53L1_ERROR_NONE;
188
        return status;
189
}
190
191
VL53L1_Error VL53L1_WaitUs(VL53L1_Dev_t *pdev, int32_t wait_us){
192
        VL53L1_Error status  = VL53L1_ERROR_NONE;
193
        return status;
194
}
195
196
VL53L1_Error VL53L1_WaitValueMaskEx(
197
        VL53L1_Dev_t *pdev,
198
        uint32_t      timeout_ms,
199
        uint16_t      index,
200
        uint8_t       value,
201
        uint8_t       mask,
202
        uint32_t      poll_delay_ms)
203
{
204
        VL53L1_Error status  = VL53L1_ERROR_NONE;
205
        return status;
206
}
207
208
209
210