ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
Loading...
Searching...
No Matches
flow_bridge.h
Go to the documentation of this file.
1
33#ifndef FLOW_BRIDGE_H
34#define FLOW_BRIDGE_H
35
36#include <stdint.h>
37#include "sensor_bus.h"
38
39#define FLOW_BRIDGE_ADDR_7BIT 0x3Bu
40#define FLOW_BRIDGE_WHO_AM_I 0xF1u
41#define FLOW_REG_WHO_AM_I 0x00u
42#define FLOW_REG_VERSION 0x01u
43#define FLOW_REG_FRAME 0x02u
44#define FLOW_FRAME_LEN 11u
45#define FLOW_REG_CTRL 0x10u
46
47#define FLOW_ST_SENSOR_OK 0x01u
48#define FLOW_ST_NEW 0x02u
49#define FLOW_ST_OVERFLOW 0x04u
50#define FLOW_ST_REJECTED 0x08u
51
52typedef struct {
54 uint8_t version;
55 uint8_t ok;
56} flow_t;
57
58typedef struct {
59 uint8_t status, count, squal;
60 int16_t dx, dy;
61 uint16_t shutter;
62 float dt_s;
64
65int32_t flow_init(flow_t *f, const sensor_bus_t *bus);
66int32_t flow_read(flow_t *f, flow_frame_t *fr);
68void flow_decode(const uint8_t raw[FLOW_FRAME_LEN], flow_frame_t *fr);
69
70#endif /* FLOW_BRIDGE_H */
int32_t flow_read(flow_t *f, flow_frame_t *fr)
1 = new data, 0 = none, <0 error
Definition flow_bridge.c:31
int32_t flow_init(flow_t *f, const sensor_bus_t *bus)
0 = bridge found
Definition flow_bridge.c:8
#define FLOW_FRAME_LEN
Definition flow_bridge.h:44
void flow_decode(const uint8_t raw[FLOW_FRAME_LEN], flow_frame_t *fr)
pure decoder (host tests)
Definition flow_bridge.c:20
Platform-independent bus interface.
uint8_t count
Definition flow_bridge.h:59
uint16_t shutter
Definition flow_bridge.h:61
sensor_bus_t bus
Definition flow_bridge.h:53
uint8_t ok
Definition flow_bridge.h:55
uint8_t version
Definition flow_bridge.h:54
static int status(w25q_t *d, uint8_t *sr)
Definition w25q.c:26