|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
34 static const uint8_t status_rtn[24] = { 255, 255, 255, 5, 2, 4, 1, 7, 3, 0,
35 255, 255, 9, 13, 255, 255, 255, 255, 10, 6,
41 switch (
dev->nonblocking.i2c_state) {
44 dev->i2c_trans.buf[0] = (index & 0xFF00) >> 8;
45 dev->i2c_trans.buf[1] = (index & 0x00FF);
46 for (
uint8_t i = 0; i < count; ++i) {
dev->i2c_trans.buf[i + 2] = pdata[i]; }
48 dev->nonblocking.i2c_state++;
52 dev->nonblocking.i2c_state = 0;
57 dev->nonblocking.i2c_state = 0;
59 default:
return false;
66 switch (
dev->nonblocking.i2c_state) {
69 dev->i2c_trans.buf[0] = (index & 0xFF00) >> 8;
70 dev->i2c_trans.buf[1] = (index & 0x00FF);
72 dev->nonblocking.i2c_state++;
76 dev->nonblocking.i2c_state = 0;
81 for (
uint8_t i = 0; i < count; ++i) { pdata[i] =
dev->i2c_trans.buf[i]; }
82 dev->nonblocking.i2c_state = 0;
84 default:
return false;
92 switch (
dev->nonblocking.state) {
97 dev->nonblocking.IntPol = !(Temp >> 4);
98 dev->nonblocking.state++;
103 if ((Temp & 1) ==
dev->nonblocking.IntPol) {
108 dev->nonblocking.state = 0;
110 default:
return false;
132 tmp, 2)) {
return false; }
133 *distance = (tmp[0] << 8) | tmp[1];
146 uint8_t isDataReady, rangeStatus;
148 switch (
dev->read_status) {
164 if (rangeStatus != 0) {
static bool VL53L1_NonBlocking_ReadMulti(VL53L1_DEV dev, uint16_t index, uint8_t *pdata, uint32_t count)
bool VL53L1X_NonBlocking_GetDistance(VL53L1_DEV dev, uint16_t *distance)
This function returns the distance measured by the sensor in mm.
#define VL53L1_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0
Non-blocking runtime functions for the VL53L1X.
@ I2CTransFailed
transaction failed
#define SYSTEM__INTERRUPT_CLEAR
@ I2CTransSuccess
transaction successfully finished by I2C driver
#define GPIO_HV_MUX__CTRL
bool VL53L1X_NonBlocking_CheckForDataReady(VL53L1_DEV dev, uint8_t *isDataReady)
This function checks if the new ranging data is available by polling the dedicated register.
bool i2c_transmit(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len)
Submit a write only transaction.
bool VL53L1X_NonBlocking_ClearInterrupt(VL53L1_DEV dev)
This function clears the interrupt, to be called after a ranging data reading to arm the interrupt fo...
static const struct usb_device_descriptor dev
#define GPIO__TIO_HV_STATUS
#define I2C_BUF_LEN
I2C buffer length.
bool VL53L1X_NonBlocking_RequestData(VL53L1_DEV dev)
Request a new reading.
bool i2c_transceive(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len_w, uint16_t len_r)
Submit a write/read transaction.
#define VL53L1_RESULT__RANGE_STATUS
bool VL53L1X_NonBlocking_ReadDataEvent(VL53L1_DEV dev, uint16_t *distance_mm, bool *new_data)
Implement non-blocking read sequence The data reading actually starts when the read_state is set to V...
static bool VL53L1_NonBlocking_WriteMulti(VL53L1_DEV dev, uint16_t index, uint8_t *pdata, uint32_t count)
bool VL53L1X_NonBlocking_IsIdle(VL53L1_DEV dev)
Test is read status is on idle.
static const uint8_t status_rtn[24]
bool VL53L1X_NonBlocking_GetRangeStatus(VL53L1_DEV dev, uint8_t *rangeStatus)
This function returns the range status to discard wrong measurments.