ACwing Flow bridge firmware
STM32C011: PMW3901 optical flow over SPI, I2C target 0x3B
Loading...
Searching...
No Matches
pmw3901.h File Reference

PixArt PMW3901MB optical flow sensor over SPI (mode 3, <= 2 MHz). More...

#include <stdint.h>
Include dependency graph for pmw3901.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pmw_bus_t
 
struct  pmw_burst_t
 

Functions

int pmw_init (const pmw_bus_t *bus)
 0 = product id ok, configured
 
void pmw_burst (pmw_burst_t *b)
 motion burst (register 0x16)

 
uint8_t pmw_valid (const pmw_burst_t *b)
 PixArt rule: SQUAL < 0x19 with the shutter at its maximum = no usable features.
 

Detailed Description

PixArt PMW3901MB optical flow sensor over SPI (mode 3, <= 2 MHz).

Register sequences from the Bitcraze PMW3901 driver (MIT licence, see pmw3901.c). The bus is given as callbacks: no registers here, host-testable.

Definition in file pmw3901.h.

Function Documentation

◆ pmw_init()

int pmw_init ( const pmw_bus_t *  bus)

0 = product id ok, configured

Definition at line 59 of file pmw3901.c.

References pmw_bus_t::cs, pmw_bus_t::delay_us, k_init1, k_init2, PMW_INV_PRODUCT_ID, PMW_PRODUCT_ID, rd(), pmw_bus_t::reset, s_b, and wr().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pmw_burst()

void pmw_burst ( pmw_burst_t *  b)

motion burst (register 0x16)

Definition at line 85 of file pmw3901.c.

References pmw_bus_t::cs, pmw_bus_t::delay_us, pmw_burst_t::dx, pmw_burst_t::dy, pmw_burst_t::motion, pmw_burst_t::observation, PMW_REG_MOTION_BURST, pmw_burst_t::raw_max, pmw_burst_t::raw_min, pmw_burst_t::raw_sum, s_b, pmw_burst_t::shutter, pmw_burst_t::squal, and pmw_bus_t::xfer.

Referenced by main().

Here is the caller graph for this function:

◆ pmw_valid()

uint8_t pmw_valid ( const pmw_burst_t *  b)

PixArt rule: SQUAL < 0x19 with the shutter at its maximum = no usable features.

Definition at line 106 of file pmw3901.c.

References pmw_burst_t::shutter, and pmw_burst_t::squal.

Referenced by main().

Here is the caller graph for this function: