![]() |
ACwing Flow bridge firmware
STM32C011: PMW3901 optical flow over SPI, I2C target 0x3B
|
Register file of the flow bridge and the I2C target protocol. More...
#include <stdint.h>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 | |
| 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. | |
Register file of the flow bridge and the I2C target protocol.
Pure C (no registers): the main loop adds PMW3901 samples, the I2C interrupt calls the bridge_i2c_* functions. The two sides share the accumulators: bridge_add_sample() must run with the I2C interrupt masked (the main loop wraps it in a short critical section).
Definition in file bridge.h.
| 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().
| 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 | ) |