![]() |
ACwing Flow bridge firmware
STM32C011: PMW3901 optical flow over SPI, I2C target 0x3B
|
PMW3901MB driver (see pmw3901.h). More...
#include "pmw3901.h"Go to the source code of this file.
Macros | |
| #define | PMW_PRODUCT_ID 0x49u |
| #define | PMW_INV_PRODUCT_ID 0xB6u |
| #define | PMW_REG_MOTION_BURST 0x16u |
Functions | |
| static void | wr (uint8_t reg, uint8_t v) |
| static uint8_t | rd (uint8_t reg) |
| 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. | |
Variables | |
| static const pmw_bus_t * | s_b |
| static const uint8_t | k_init1 [][2] |
| static const uint8_t | k_init2 [][2] |
PMW3901MB driver (see pmw3901.h).
The power-up check and the "performance optimisation" register sequence are taken from the Bitcraze PMW3901 Arduino driver: Copyright (c) 2017 Bitcraze AB. MIT License: permission is hereby granted, free of charge, to deal in the Software without restriction, subject to including the copyright notice and this permission notice. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
Definition in file pmw3901.c.
|
static |
Definition at line 20 of file pmw3901.c.
References pmw_bus_t::cs, pmw_bus_t::delay_us, s_b, and pmw_bus_t::xfer.
Referenced by pmw_init().
|
static |
Definition at line 31 of file pmw3901.c.
References pmw_bus_t::cs, pmw_bus_t::delay_us, s_b, and pmw_bus_t::xfer.
Referenced by 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().
| 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().
| 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().
|
static |
Definition at line 18 of file pmw3901.c.
Referenced by pmw_burst(), pmw_init(), rd(), and wr().
|
static |
Definition at line 44 of file pmw3901.c.
Referenced by pmw_init().
|
static |
Definition at line 54 of file pmw3901.c.
Referenced by pmw_init().