![]() |
ACwing Flow bridge firmware
STM32C011: PMW3901 optical flow over SPI, I2C target 0x3B
|
Register file + I2C target protocol (see bridge.h, flow_regs.h). More...
Go to the source code of this file.
Functions | |
| void | bridge_init (void) |
| void | bridge_set_sensor_ok (uint8_t ok) |
| void | bridge_add_sample (int16_t dx, int16_t dy, uint8_t squal, uint16_t shutter, uint8_t valid, uint32_t dt_us) |
| one motion burst: deltas since the previous burst, dt_us = time between the two bursts; valid = 0 for a sample without surface features | |
| static int16_t | sat16 (int32_t v, uint8_t *ovf) |
| static void | put16 (uint8_t *p, uint16_t v) |
| static void | snapshot (uint8_t latch) |
| void | bridge_i2c_addr_write (void) |
| address matched, master writes | |
| void | bridge_i2c_rx (uint8_t b) |
| first byte = register pointer | |
| void | bridge_i2c_addr_read (void) |
| address matched, master reads: snapshot | |
| uint8_t | bridge_i2c_tx (void) |
| next byte to send | |
| void | bridge_i2c_stop (void) |
| uint8_t | bridge_take_ctrl (void) |
| CTRL bits written by the master, cleared. | |
| uint8_t | bridge_reads (void) |
| FRAME reads since boot (LED activity), wraps. | |
Variables | |
| static volatile int32_t | s_dx |
| static volatile int32_t | s_dy |
| static volatile uint32_t | s_dt_us |
| static volatile uint8_t | s_count |
| static volatile uint8_t | s_squal |
| static volatile uint8_t | s_status |
| static volatile uint16_t | s_shutter |
| static uint8_t | s_ptr |
| static uint8_t | s_first |
| static uint8_t | s_wr |
| static uint8_t | s_img [FLOW_REG_SPACE] |
| static uint8_t | s_rd |
| static volatile uint8_t | s_ctrl |
| static volatile uint8_t | s_reads |
Register file + I2C target protocol (see bridge.h, flow_regs.h).
Definition in file bridge.c.
| void bridge_init | ( | void | ) |
| void bridge_set_sensor_ok | ( | uint8_t | ok | ) |
Definition at line 26 of file bridge.c.
References FLOW_S_SENSOR_OK, and s_status.
Referenced by main().
| void bridge_add_sample | ( | int16_t | dx, |
| int16_t | dy, | ||
| uint8_t | squal, | ||
| uint16_t | shutter, | ||
| uint8_t | valid, | ||
| uint32_t | dt_us | ||
| ) |
one motion burst: deltas since the previous burst, dt_us = time between the two bursts; valid = 0 for a sample without surface features
Definition at line 32 of file bridge.c.
References FLOW_S_NEW, FLOW_S_REJECTED, s_count, s_dt_us, s_dx, s_dy, s_shutter, s_squal, and s_status.
Referenced by main().
|
static |
Definition at line 46 of file bridge.c.
Referenced by snapshot().
|
static |
Definition at line 53 of file bridge.c.
Referenced by snapshot().
|
static |
Definition at line 56 of file bridge.c.
References FLOW_FW_VERSION, FLOW_R_COUNT, FLOW_R_DT, FLOW_R_DX, FLOW_R_DY, FLOW_R_SHUTTER, FLOW_R_SQUAL, FLOW_R_STATUS, FLOW_R_VERSION, FLOW_R_WHO_AM_I, FLOW_S_NEW, FLOW_S_OVERFLOW, FLOW_WHO_AM_I_VAL, put16(), s_count, s_dt_us, s_dx, s_dy, s_img, s_reads, s_shutter, s_squal, s_status, and sat16().
Referenced by bridge_i2c_addr_read().
| void bridge_i2c_addr_write | ( | void | ) |
address matched, master writes
Definition at line 82 of file bridge.c.
Referenced by I2C1_IRQHandler().
| void bridge_i2c_rx | ( | uint8_t | b | ) |
first byte = register pointer
Definition at line 84 of file bridge.c.
References FLOW_R_CTRL, s_ctrl, s_first, s_ptr, and s_wr.
Referenced by I2C1_IRQHandler().
| void bridge_i2c_addr_read | ( | void | ) |
address matched, master reads: snapshot
Definition at line 92 of file bridge.c.
References FLOW_R_FRAME, s_ptr, s_rd, and snapshot().
Referenced by I2C1_IRQHandler().
| uint8_t bridge_i2c_tx | ( | void | ) |
next byte to send
Definition at line 98 of file bridge.c.
References FLOW_REG_SPACE, s_img, and s_rd.
Referenced by I2C1_IRQHandler().
| void bridge_i2c_stop | ( | void | ) |
Definition at line 105 of file bridge.c.
References s_first.
Referenced by I2C1_IRQHandler().
| uint8_t bridge_take_ctrl | ( | void | ) |
| uint8_t bridge_reads | ( | void | ) |
|
static |
Definition at line 9 of file bridge.c.
Referenced by bridge_add_sample(), bridge_init(), and snapshot().
|
static |
Definition at line 9 of file bridge.c.
Referenced by bridge_add_sample(), bridge_init(), and snapshot().
|
static |
Definition at line 10 of file bridge.c.
Referenced by bridge_add_sample(), bridge_init(), and snapshot().
|
static |
Definition at line 11 of file bridge.c.
Referenced by bridge_add_sample(), bridge_init(), and snapshot().
|
static |
Definition at line 11 of file bridge.c.
Referenced by bridge_add_sample(), bridge_init(), and snapshot().
|
static |
Definition at line 11 of file bridge.c.
Referenced by bridge_add_sample(), bridge_init(), bridge_set_sensor_ok(), and snapshot().
|
static |
Definition at line 12 of file bridge.c.
Referenced by bridge_add_sample(), bridge_init(), and snapshot().
|
static |
Definition at line 14 of file bridge.c.
Referenced by bridge_i2c_addr_read(), bridge_i2c_rx(), and bridge_init().
|
static |
Definition at line 14 of file bridge.c.
Referenced by bridge_i2c_addr_write(), bridge_i2c_rx(), bridge_i2c_stop(), and bridge_init().
|
static |
Definition at line 14 of file bridge.c.
Referenced by bridge_i2c_addr_write(), bridge_i2c_rx(), and bridge_init().
|
static |
Definition at line 15 of file bridge.c.
Referenced by bridge_i2c_tx(), and snapshot().
|
static |
Definition at line 16 of file bridge.c.
Referenced by bridge_i2c_addr_read(), bridge_i2c_tx(), and bridge_init().
|
static |
Definition at line 17 of file bridge.c.
Referenced by bridge_i2c_rx(), bridge_init(), and bridge_take_ctrl().
|
static |
Definition at line 17 of file bridge.c.
Referenced by bridge_init(), bridge_reads(), and snapshot().