17#ifndef VL53L0X_INTERNALS_H
18#define VL53L0X_INTERNALS_H
21#include "../i2c_device_utilities.h"
22#include "vl53l0x_registers.h"
25namespace devices::vl53l0x_internals
27 using Register = devices::vl53l0x::Register;
29 namespace stop_variable
32 static constexpr uint8_t PRE_BUFFER[] PROGMEM =
34 uint8_t(Register::POWER_MANAGEMENT), 0x01,
36 uint8_t(Register::SYSRANGE_START), 0x00,
38 static constexpr uint8_t POST_BUFFER[] PROGMEM =
40 uint8_t(Register::SYSRANGE_START), 0x01,
42 uint8_t(Register::POWER_MANAGEMENT), 0x00,
46 static constexpr uint8_t PRE_BUFFER_SIZE =
sizeof(PRE_BUFFER);
47 static constexpr uint8_t POST_BUFFER_SIZE =
sizeof(POST_BUFFER);
50 namespace stop_continuous_ranging
53 static constexpr uint8_t BUFFER[] PROGMEM =
55 uint8_t(Register::SYSRANGE_START), 0x01,
57 uint8_t(Register::SYSRANGE_START), 0x00,
58 uint8_t(Register::SYSTEM_STOP_VARIABLE), 0x00,
59 uint8_t(Register::SYSRANGE_START), 0x01,
64 static constexpr uint8_t BUFFER_SIZE =
sizeof(BUFFER);
72 static constexpr uint8_t BUFFER1[] PROGMEM =
74 uint8_t(Register::POWER_MANAGEMENT), 0x01,
76 uint8_t(Register::SYSRANGE_START), 0x00,
80 static constexpr uint8_t BUFFER2[] PROGMEM =
84 uint8_t(Register::POWER_MANAGEMENT), 0x01,
88 static constexpr uint8_t BUFFER3[] PROGMEM =
94 static constexpr uint8_t BUFFER4[] PROGMEM =
97 uint8_t(Register::SYSRANGE_START), 0x01,
99 uint8_t(Register::POWER_MANAGEMENT), 0x00,
103 static constexpr uint8_t BUFFER1_SIZE =
sizeof(BUFFER1);
104 static constexpr uint8_t BUFFER2_SIZE =
sizeof(BUFFER2);
105 static constexpr uint8_t BUFFER3_SIZE =
sizeof(BUFFER3);
106 static constexpr uint8_t BUFFER4_SIZE =
sizeof(BUFFER4);
111 namespace load_tuning_settings
114 static constexpr uint8_t BUFFER[] PROGMEM =
118 uint8_t(Register::SYSRANGE_START), 0x00,
190 uint8_t(Register::POWER_MANAGEMENT), 0x01,
194 uint8_t(Register::SYSRANGE_START), 0x01,
196 uint8_t(Register::POWER_MANAGEMENT), 0x00
199 static constexpr uint8_t BUFFER_SIZE =
sizeof(BUFFER);
204 namespace set_reference_spads
207 static constexpr uint8_t BUFFER[] PROGMEM =
210 uint8_t(Register::DYNAMIC_SPAD_REF_EN_START_OFFSET), 0x00,
211 uint8_t(Register::DYNAMIC_SPAD_NUM_REQUESTED_REF_SPAD), 0x2C,
213 uint8_t(Register::GLOBAL_CONFIG_REF_EN_START_SELECT), 0xB4
217 static constexpr uint8_t BUFFER_SIZE =
sizeof(BUFFER);
API to handle Time-of-Flight ranging sensor VL53L0X I2C chip.