![]() |
ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
|
VL53L1X driver (see vl53l1x.h). More...
#include "vl53l1x.h"Go to the source code of this file.
Macros | |
| #define | REG_SOFT_RESET 0x0000u |
| #define | REG_VHV_TIMEOUT_LOOP_BOUND 0x0008u |
| #define | REG_VHV_START 0x000Bu |
| #define | REG_GPIO_HV_MUX_CTRL 0x0030u |
| #define | REG_GPIO_TIO_HV_STATUS 0x0031u |
| #define | REG_PHASECAL_TIMEOUT 0x004Bu |
| #define | REG_RANGE_TIMEOUT_A_HI 0x005Eu |
| #define | REG_RANGE_VCSEL_PERIOD_A 0x0060u |
| #define | REG_RANGE_TIMEOUT_B_HI 0x0061u |
| #define | REG_RANGE_VCSEL_PERIOD_B 0x0063u |
| #define | REG_RANGE_VALID_PHASE_HIGH 0x0069u |
| #define | REG_INTERMEASUREMENT 0x006Cu |
| #define | REG_SD_WOI_SD0 0x0078u |
| #define | REG_SD_INITIAL_PHASE_SD0 0x007Au |
| #define | REG_INTERRUPT_CLEAR 0x0086u |
| #define | REG_MODE_START 0x0087u |
| #define | REG_RESULT_RANGE_STATUS 0x0089u |
| #define | REG_RESULT_DISTANCE 0x0096u |
| #define | REG_OSC_CALIBRATE_VAL 0x00DEu |
| #define | REG_FIRMWARE_SYSTEM_STATUS 0x00E5u |
| #define | REG_MODEL_ID 0x010Fu |
Functions | |
| static int32_t | wr8 (vl53_t *d, uint16_t reg, uint8_t v) |
| static int32_t | wr16 (vl53_t *d, uint16_t reg, uint16_t v) |
| static int32_t | wr32 (vl53_t *d, uint16_t reg, uint32_t v) |
| static int32_t | rd8 (vl53_t *d, uint16_t reg, uint8_t *v) |
| static int32_t | rd16 (vl53_t *d, uint16_t reg, uint16_t *v) |
| static void | dly (vl53_t *d, uint32_t ms) |
| static int32_t | data_ready (vl53_t *d, uint8_t *rdy) |
| static uint8_t | map_status (uint8_t s) |
| int32_t | vl53_init (vl53_t *d, const vl53_bus_t *bus, uint16_t budget_ms) |
| 0 = sensor found and ranging; < 0 = absent or error (the board works without it) | |
| int32_t | vl53_poll (vl53_t *d, vl53_sample_t *s) |
| 1 = new sample in *s, 0 = none yet, < 0 = bus error | |
Variables | |
| static const uint8_t | k_default [0x87 - 0x2D+1] |
VL53L1X driver (see vl53l1x.h).
Derived from ST's VL53L1X ULD: COPYRIGHT(c) 2018 STMicroelectronics. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the BSD-3-Clause conditions are met (copyright notice, this list of conditions and the disclaimer below retained; no endorsement by STMicroelectronics). THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES ARE DISCLAIMED.
Definition in file vl53l1x.c.
|
static |
Definition at line 47 of file vl53l1x.c.
References vl53_t::bus, vl53_bus_t::handle, and vl53_bus_t::write.
Referenced by vl53_init(), and vl53_poll().
|
static |
Definition at line 48 of file vl53l1x.c.
References b, vl53_t::bus, vl53_bus_t::handle, and vl53_bus_t::write.
Referenced by vl53_init().
|
static |
Definition at line 53 of file vl53l1x.c.
References b, vl53_t::bus, vl53_bus_t::handle, and vl53_bus_t::write.
Referenced by vl53_init().
|
static |
Definition at line 58 of file vl53l1x.c.
References vl53_t::bus, vl53_bus_t::handle, and vl53_bus_t::read.
Referenced by data_ready(), and vl53_init().
|
static |
Definition at line 59 of file vl53l1x.c.
References b, vl53_t::bus, vl53_bus_t::handle, and vl53_bus_t::read.
Referenced by vl53_init().
|
static |
Definition at line 66 of file vl53l1x.c.
References vl53_t::bus, vl53_bus_t::delay_ms, and ms.
Referenced by vl53_init().
|
static |
Definition at line 68 of file vl53l1x.c.
References vl53_t::int_pol, rd8(), and REG_GPIO_TIO_HV_STATUS.
Referenced by vl53_init(), and vl53_poll().
|
static |
Definition at line 76 of file vl53l1x.c.
References s.
Referenced by vl53_poll().
| int32_t vl53_init | ( | vl53_t * | d, |
| const vl53_bus_t * | bus, | ||
| uint16_t | budget_ms | ||
| ) |
0 = sensor found and ranging; < 0 = absent or error (the board works without it)
Definition at line 86 of file vl53l1x.c.
References b, vl53_t::bus, data_ready(), dly(), vl53_bus_t::handle, vl53_t::int_pol, k_default, vl53_t::ok, rd16(), rd8(), REG_FIRMWARE_SYSTEM_STATUS, REG_GPIO_HV_MUX_CTRL, REG_INTERMEASUREMENT, REG_INTERRUPT_CLEAR, REG_MODE_START, REG_MODEL_ID, REG_OSC_CALIBRATE_VAL, REG_PHASECAL_TIMEOUT, REG_RANGE_TIMEOUT_A_HI, REG_RANGE_TIMEOUT_B_HI, REG_RANGE_VALID_PHASE_HIGH, REG_RANGE_VCSEL_PERIOD_A, REG_RANGE_VCSEL_PERIOD_B, REG_SD_INITIAL_PHASE_SD0, REG_SD_WOI_SD0, REG_VHV_START, REG_VHV_TIMEOUT_LOOP_BOUND, st(), VL53L1X_MODEL_ID, wr16(), wr32(), wr8(), and vl53_bus_t::write.
Referenced by ext_step().
| int32_t vl53_poll | ( | vl53_t * | d, |
| vl53_sample_t * | s | ||
| ) |
1 = new sample in *s, 0 = none yet, < 0 = bus error
Definition at line 137 of file vl53l1x.c.
References vl53_t::bus, data_ready(), vl53_bus_t::handle, map_status(), vl53_t::ok, vl53_bus_t::read, REG_INTERRUPT_CLEAR, REG_RESULT_RANGE_STATUS, s, and wr8().
Referenced by ext_step().
|
static |
Definition at line 38 of file vl53l1x.c.
Referenced by vl53_init().