10#define EXT_TOF_BUDGET_MS 33u
73 .dx = r > 0 ? f.
dx : 0, .dy = r > 0 ? f.
dy : 0,
74 .squal = f.
squal, .dt_s = r > 0 ? f.
dt_s : 0.0f, .t_ms = now };
106 static const osThreadAttr_t a = { .name =
"ext", .priority = osPriorityBelowNormal,
108 (void)osThreadNew(
ExtTask, NULL, &a);
static appl_cmd_t s_q[APPL_QUEUE_LEN]
void ext_i2c_flow_bus(sensor_bus_t *b, uint8_t addr7)
8-bit registers
void ext_i2c_tof_bus(vl53_bus_t *b, uint8_t addr7)
16-bit registers
HAL binding of the expansion (Qwiic) devices on I2C1.
void ext_step(uint32_t now)
one 10 ms cycle
static void publish(void)
int ext_take(ext_sample_t *s)
flight context: 1 if a sample was taken
static volatile uint32_t s_err
static uint32_t s_flow_err
static uint32_t s_next_probe
uint32_t ext_errors(void)
static uint32_t s_tof_err
uint16_t ext_sensors(void)
PV2_S_TOF | PV2_S_FLOW currently detected.
void ext_init(const ext_buses_t *b)
static void ExtTask(void *arg)
#define EXT_TOF_BUDGET_MS
static volatile uint16_t s_sens
void ext_sens_start(void)
creates the task (after imu_i2c_bus_init)
Expansion sensors on the Qwiic bus (ACwing Flow rev A): VL53L1X ToF and the optical-flow bridge.
#define EXT_ERR_LIMIT
consecutive errors: device lost, probe again
int32_t flow_read(flow_t *f, flow_frame_t *fr)
1 = new data, 0 = none, <0 error
int32_t flow_init(flow_t *f, const sensor_bus_t *bus)
0 = bridge found
ACwing Flow rev A optical-flow bridge (STM32C011 at 0x3B, PMW3901 behind it).
#define FLOW_BRIDGE_ADDR_7BIT
ACwing Pilot app protocol v2: identifiers and frame layouts.
Lock-free single-producer single-consumer queue of fixed-size items.
#define SPSC_DEFINE(name, type, n)
static int spsc_push(spsc_t *q, const void *it)
static void spsc_reset(spsc_t *q)
static int spsc_pop(spsc_t *q, void *it)
Range status after the ULD mapping: 0 valid, 1 sigma fail, 2 signal fail, 4 out of bounds,...
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
#define VL53L1X_ADDR_7BIT