Fork, renaming of VL53L1CB-2

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   X_NUCLEO_53L1CB

Committer:
charlesmn
Date:
Fri Nov 06 10:06:37 2020 +0000
Revision:
0:3ac96e360672
Child:
7:1add29d51e72
Library for ST Vl53L1A1 time of flight sensor.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
charlesmn 0:3ac96e360672 1
charlesmn 0:3ac96e360672 2 /*******************************************************************************
charlesmn 0:3ac96e360672 3 * Copyright (c) 2020, STMicroelectronics - All Rights Reserved
charlesmn 0:3ac96e360672 4
charlesmn 0:3ac96e360672 5 This file is part of VL53L1 Core and is dual licensed,
charlesmn 0:3ac96e360672 6 either 'STMicroelectronics
charlesmn 0:3ac96e360672 7 Proprietary license'
charlesmn 0:3ac96e360672 8 or 'BSD 3-clause "New" or "Revised" License' , at your option.
charlesmn 0:3ac96e360672 9
charlesmn 0:3ac96e360672 10 ********************************************************************************
charlesmn 0:3ac96e360672 11
charlesmn 0:3ac96e360672 12 'STMicroelectronics Proprietary license'
charlesmn 0:3ac96e360672 13
charlesmn 0:3ac96e360672 14 ********************************************************************************
charlesmn 0:3ac96e360672 15
charlesmn 0:3ac96e360672 16 License terms: STMicroelectronics Proprietary in accordance with licensing
charlesmn 0:3ac96e360672 17 terms at www.st.com/sla0081
charlesmn 0:3ac96e360672 18
charlesmn 0:3ac96e360672 19 STMicroelectronics confidential
charlesmn 0:3ac96e360672 20 Reproduction and Communication of this document is strictly prohibited unless
charlesmn 0:3ac96e360672 21 specifically authorized in writing by STMicroelectronics.
charlesmn 0:3ac96e360672 22
charlesmn 0:3ac96e360672 23
charlesmn 0:3ac96e360672 24 ********************************************************************************
charlesmn 0:3ac96e360672 25
charlesmn 0:3ac96e360672 26 Alternatively, VL53L1 Core may be distributed under the terms of
charlesmn 0:3ac96e360672 27 'BSD 3-clause "New" or "Revised" License', in which case the following
charlesmn 0:3ac96e360672 28 provisions apply instead of the ones
charlesmn 0:3ac96e360672 29 mentioned above :
charlesmn 0:3ac96e360672 30
charlesmn 0:3ac96e360672 31 ********************************************************************************
charlesmn 0:3ac96e360672 32
charlesmn 0:3ac96e360672 33 License terms: BSD 3-clause "New" or "Revised" License.
charlesmn 0:3ac96e360672 34
charlesmn 0:3ac96e360672 35 Redistribution and use in source and binary forms, with or without
charlesmn 0:3ac96e360672 36 modification, are permitted provided that the following conditions are met:
charlesmn 0:3ac96e360672 37
charlesmn 0:3ac96e360672 38 1. Redistributions of source code must retain the above copyright notice, this
charlesmn 0:3ac96e360672 39 list of conditions and the following disclaimer.
charlesmn 0:3ac96e360672 40
charlesmn 0:3ac96e360672 41 2. Redistributions in binary form must reproduce the above copyright notice,
charlesmn 0:3ac96e360672 42 this list of conditions and the following disclaimer in the documentation
charlesmn 0:3ac96e360672 43 and/or other materials provided with the distribution.
charlesmn 0:3ac96e360672 44
charlesmn 0:3ac96e360672 45 3. Neither the name of the copyright holder nor the names of its contributors
charlesmn 0:3ac96e360672 46 may be used to endorse or promote products derived from this software
charlesmn 0:3ac96e360672 47 without specific prior written permission.
charlesmn 0:3ac96e360672 48
charlesmn 0:3ac96e360672 49 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
charlesmn 0:3ac96e360672 50 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
charlesmn 0:3ac96e360672 51 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
charlesmn 0:3ac96e360672 52 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
charlesmn 0:3ac96e360672 53 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
charlesmn 0:3ac96e360672 54 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
charlesmn 0:3ac96e360672 55 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
charlesmn 0:3ac96e360672 56 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
charlesmn 0:3ac96e360672 57 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
charlesmn 0:3ac96e360672 58 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
charlesmn 0:3ac96e360672 59
charlesmn 0:3ac96e360672 60
charlesmn 0:3ac96e360672 61 ********************************************************************************
charlesmn 0:3ac96e360672 62
charlesmn 0:3ac96e360672 63 */
charlesmn 0:3ac96e360672 64
charlesmn 0:3ac96e360672 65
charlesmn 0:3ac96e360672 66
charlesmn 0:3ac96e360672 67
charlesmn 0:3ac96e360672 68 #ifndef _VL53L1_REGISTER_SETTINGS_H_
charlesmn 0:3ac96e360672 69 #define _VL53L1_REGISTER_SETTINGS_H_
charlesmn 0:3ac96e360672 70
charlesmn 0:3ac96e360672 71
charlesmn 0:3ac96e360672 72
charlesmn 0:3ac96e360672 73
charlesmn 0:3ac96e360672 74
charlesmn 0:3ac96e360672 75
charlesmn 0:3ac96e360672 76 #define VL53L1_DEVICESCHEDULERMODE_PSEUDO_SOLO 0x00
charlesmn 0:3ac96e360672 77 #define VL53L1_DEVICESCHEDULERMODE_STREAMING 0x01
charlesmn 0:3ac96e360672 78 #define VL53L1_DEVICESCHEDULERMODE_HISTOGRAM 0x02
charlesmn 0:3ac96e360672 79
charlesmn 0:3ac96e360672 80
charlesmn 0:3ac96e360672 81
charlesmn 0:3ac96e360672 82
charlesmn 0:3ac96e360672 83
charlesmn 0:3ac96e360672 84 #define VL53L1_DEVICEREADOUTMODE_SINGLE_SD (0x00 << 2)
charlesmn 0:3ac96e360672 85 #define VL53L1_DEVICEREADOUTMODE_DUAL_SD (0x01 << 2)
charlesmn 0:3ac96e360672 86 #define VL53L1_DEVICEREADOUTMODE_SPLIT_READOUT (0x02 << 2)
charlesmn 0:3ac96e360672 87 #define VL53L1_DEVICEREADOUTMODE_SPLIT_MANUAL (0x03 << 2)
charlesmn 0:3ac96e360672 88
charlesmn 0:3ac96e360672 89
charlesmn 0:3ac96e360672 90
charlesmn 0:3ac96e360672 91
charlesmn 0:3ac96e360672 92
charlesmn 0:3ac96e360672 93
charlesmn 0:3ac96e360672 94 #define VL53L1_DEVICEMEASUREMENTMODE_MODE_MASK 0xF0
charlesmn 0:3ac96e360672 95 #define VL53L1_DEVICEMEASUREMENTMODE_STOP_MASK 0x0F
charlesmn 0:3ac96e360672 96
charlesmn 0:3ac96e360672 97 #define VL53L1_GROUPEDPARAMETERHOLD_ID_MASK 0x02
charlesmn 0:3ac96e360672 98
charlesmn 0:3ac96e360672 99
charlesmn 0:3ac96e360672 100
charlesmn 0:3ac96e360672 101 #define VL53L1_EWOK_I2C_DEV_ADDR_DEFAULT 0x29
charlesmn 0:3ac96e360672 102
charlesmn 0:3ac96e360672 103 #define VL53L1_OSC_FREQUENCY 0x00
charlesmn 0:3ac96e360672 104 #define VL53L1_OSC_TRIM_DEFAULT 0x00
charlesmn 0:3ac96e360672 105 #define VL53L1_OSC_FREQ_SET_DEFAULT 0x00
charlesmn 0:3ac96e360672 106
charlesmn 0:3ac96e360672 107 #define VL53L1_RANGE_HISTOGRAM_REF 0x08
charlesmn 0:3ac96e360672 108 #define VL53L1_RANGE_HISTOGRAM_RET 0x10
charlesmn 0:3ac96e360672 109 #define VL53L1_RANGE_HISTOGRAM_BOTH 0x18
charlesmn 0:3ac96e360672 110 #define VL53L1_RANGE_HISTOGRAM_INIT 0x20
charlesmn 0:3ac96e360672 111 #define VL53L1_RANGE_VHV_INIT 0x40
charlesmn 0:3ac96e360672 112
charlesmn 0:3ac96e360672 113
charlesmn 0:3ac96e360672 114 #define VL53L1_RESULT_RANGE_STATUS 0x1F
charlesmn 0:3ac96e360672 115
charlesmn 0:3ac96e360672 116
charlesmn 0:3ac96e360672 117 #define VL53L1_SYSTEM__SEED_CONFIG__MANUAL 0x00
charlesmn 0:3ac96e360672 118 #define VL53L1_SYSTEM__SEED_CONFIG__STANDARD 0x01
charlesmn 0:3ac96e360672 119 #define VL53L1_SYSTEM__SEED_CONFIG__EVEN_UPDATE_ONLY 0x02
charlesmn 0:3ac96e360672 120
charlesmn 0:3ac96e360672 121
charlesmn 0:3ac96e360672 122 #define VL53L1_INTERRUPT_CONFIG_LEVEL_LOW 0x00
charlesmn 0:3ac96e360672 123 #define VL53L1_INTERRUPT_CONFIG_LEVEL_HIGH 0x01
charlesmn 0:3ac96e360672 124 #define VL53L1_INTERRUPT_CONFIG_OUT_OF_WINDOW 0x02
charlesmn 0:3ac96e360672 125 #define VL53L1_INTERRUPT_CONFIG_IN_WINDOW 0x03
charlesmn 0:3ac96e360672 126 #define VL53L1_INTERRUPT_CONFIG_NEW_SAMPLE_READY 0x20
charlesmn 0:3ac96e360672 127
charlesmn 0:3ac96e360672 128
charlesmn 0:3ac96e360672 129 #define VL53L1_CLEAR_RANGE_INT 0x01
charlesmn 0:3ac96e360672 130 #define VL53L1_CLEAR_ERROR_INT 0x02
charlesmn 0:3ac96e360672 131
charlesmn 0:3ac96e360672 132
charlesmn 0:3ac96e360672 133 #define VL53L1_SEQUENCE_VHV_EN 0x01
charlesmn 0:3ac96e360672 134 #define VL53L1_SEQUENCE_PHASECAL_EN 0x02
charlesmn 0:3ac96e360672 135 #define VL53L1_SEQUENCE_REFERENCE_PHASE_EN 0x04
charlesmn 0:3ac96e360672 136 #define VL53L1_SEQUENCE_DSS1_EN 0x08
charlesmn 0:3ac96e360672 137 #define VL53L1_SEQUENCE_DSS2_EN 0x10
charlesmn 0:3ac96e360672 138 #define VL53L1_SEQUENCE_MM1_EN 0x20
charlesmn 0:3ac96e360672 139 #define VL53L1_SEQUENCE_MM2_EN 0x40
charlesmn 0:3ac96e360672 140 #define VL53L1_SEQUENCE_RANGE_EN 0x80
charlesmn 0:3ac96e360672 141
charlesmn 0:3ac96e360672 142
charlesmn 0:3ac96e360672 143 #define VL53L1_DSS_CONTROL__ROI_SUBTRACT 0x20
charlesmn 0:3ac96e360672 144 #define VL53L1_DSS_CONTROL__ROI_INTERSECT 0x10
charlesmn 0:3ac96e360672 145
charlesmn 0:3ac96e360672 146 #define VL53L1_DSS_CONTROL__MODE_DISABLED 0x00
charlesmn 0:3ac96e360672 147 #define VL53L1_DSS_CONTROL__MODE_TARGET_RATE 0x01
charlesmn 0:3ac96e360672 148 #define VL53L1_DSS_CONTROL__MODE_EFFSPADS 0x02
charlesmn 0:3ac96e360672 149 #define VL53L1_DSS_CONTROL__MODE_BLOCKSELECT 0x03
charlesmn 0:3ac96e360672 150
charlesmn 0:3ac96e360672 151
charlesmn 0:3ac96e360672 152
charlesmn 0:3ac96e360672 153 #define VL53L1_RANGING_CORE__SPAD_READOUT__STANDARD 0x45
charlesmn 0:3ac96e360672 154 #define VL53L1_RANGING_CORE__SPAD_READOUT__RETURN_ARRAY_ONLY 0x05
charlesmn 0:3ac96e360672 155 #define VL53L1_RANGING_CORE__SPAD_READOUT__REFERENCE_ARRAY_ONLY 0x55
charlesmn 0:3ac96e360672 156 #define VL53L1_RANGING_CORE__SPAD_READOUT__RETURN_SPLIT_ARRAY 0x25
charlesmn 0:3ac96e360672 157 #define VL53L1_RANGING_CORE__SPAD_READOUT__CALIB_PULSES 0xF5
charlesmn 0:3ac96e360672 158
charlesmn 0:3ac96e360672 159
charlesmn 0:3ac96e360672 160 #define VL53L1_LASER_SAFETY__KEY_VALUE 0x6C
charlesmn 0:3ac96e360672 161
charlesmn 0:3ac96e360672 162
charlesmn 0:3ac96e360672 163
charlesmn 0:3ac96e360672 164 #define VL53L1_RANGE_STATUS__RANGE_STATUS_MASK 0x1F
charlesmn 0:3ac96e360672 165 #define VL53L1_RANGE_STATUS__MAX_THRESHOLD_HIT_MASK 0x20
charlesmn 0:3ac96e360672 166 #define VL53L1_RANGE_STATUS__MIN_THRESHOLD_HIT_MASK 0x40
charlesmn 0:3ac96e360672 167 #define VL53L1_RANGE_STATUS__GPH_ID_RANGE_STATUS_MASK 0x80
charlesmn 0:3ac96e360672 168
charlesmn 0:3ac96e360672 169
charlesmn 0:3ac96e360672 170
charlesmn 0:3ac96e360672 171 #define VL53L1_INTERRUPT_STATUS__INT_STATUS_MASK 0x07
charlesmn 0:3ac96e360672 172 #define VL53L1_INTERRUPT_STATUS__INT_ERROR_STATUS_MASK 0x18
charlesmn 0:3ac96e360672 173 #define VL53L1_INTERRUPT_STATUS__GPH_ID_INT_STATUS_MASK 0x20
charlesmn 0:3ac96e360672 174
charlesmn 0:3ac96e360672 175
charlesmn 0:3ac96e360672 176
charlesmn 0:3ac96e360672 177
charlesmn 0:3ac96e360672 178 #endif
charlesmn 0:3ac96e360672 179
charlesmn 0:3ac96e360672 180
charlesmn 0:3ac96e360672 181
charlesmn 0:3ac96e360672 182
charlesmn 0:3ac96e360672 183
charlesmn 0:3ac96e360672 184