Paparazzi UAS
v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the source code of this file.
Macros | |
#define | PMW3901_RAD_PER_PX 0.002443389 |
#define | PMW3901_SPI_CDIV SPIDiv256 |
#define | PMW3901_REG_MOTION 0x02 |
#define | PMW3901_REG_DELTA_X_L 0x03 |
#define | PMW3901_REG_DELTA_X_H 0x04 |
#define | PMW3901_REG_DELTA_Y_L 0x05 |
#define | PMW3901_REG_DELTA_Y_H 0x06 |
#define | writeRegister(_addr, _data) writeRegister_blocking(pmw, (_addr), (_data)) |
#define | readRegister(_addr) readRegister_blocking(pmw, (_addr)) |
#define | wait_ms(_ms) sys_time_usleep((_ms) * 1000) |
Functions | |
static bool | readRegister_nonblocking (struct pmw3901_t *pmw, uint8_t addr, uint8_t *value) |
static uint8_t | readRegister_blocking (struct pmw3901_t *pmw, uint8_t addr) |
static void | writeRegister_blocking (struct pmw3901_t *pmw, uint8_t addr, uint8_t data) |
static void | initializeSensor (struct pmw3901_t *pmw) |
void | pmw3901_init (struct pmw3901_t *pmw, struct spi_periph *periph, uint8_t slave_idx) |
void | pmw3901_event (struct pmw3901_t *pmw) |
bool | pmw3901_is_idle (struct pmw3901_t *pmw) |
void | pmw3901_start_read (struct pmw3901_t *pmw) |
bool | pmw3901_data_available (struct pmw3901_t *pmw) |
bool | pmw3901_get_data (struct pmw3901_t *pmw, int16_t *delta_x, int16_t *delta_y) |
#define PMW3901_RAD_PER_PX 0.002443389 |
Definition at line 37 of file pmw3901.c.
Referenced by pmw3901_init().
#define PMW3901_REG_DELTA_X_H 0x04 |
Definition at line 48 of file pmw3901.c.
Referenced by pmw3901_event().
#define PMW3901_REG_DELTA_X_L 0x03 |
Definition at line 47 of file pmw3901.c.
Referenced by pmw3901_event().
#define PMW3901_REG_DELTA_Y_H 0x06 |
Definition at line 50 of file pmw3901.c.
Referenced by pmw3901_event().
#define PMW3901_REG_DELTA_Y_L 0x05 |
Definition at line 49 of file pmw3901.c.
Referenced by pmw3901_event().
#define PMW3901_REG_MOTION 0x02 |
Definition at line 46 of file pmw3901.c.
Referenced by pmw3901_event().
#define PMW3901_SPI_CDIV SPIDiv256 |
Definition at line 43 of file pmw3901.c.
Referenced by pmw3901_init().
#define readRegister | ( | _addr | ) | readRegister_blocking(pmw, (_addr)) |
Definition at line 120 of file pmw3901.c.
Referenced by initializeSensor().
#define wait_ms | ( | _ms | ) | sys_time_usleep((_ms) * 1000) |
Definition at line 121 of file pmw3901.c.
Referenced by initializeSensor().
#define writeRegister | ( | _addr, | |
_data | |||
) | writeRegister_blocking(pmw, (_addr), (_data)) |
Definition at line 119 of file pmw3901.c.
Referenced by initializeSensor().
|
static |
Definition at line 124 of file pmw3901.c.
References readRegister, sys_time_usleep(), wait_ms, and writeRegister.
Referenced by pmw3901_init().
bool pmw3901_data_available | ( | struct pmw3901_t * | pmw | ) |
Definition at line 322 of file pmw3901.c.
References pmw3901_t::data_available.
Referenced by opticflow_pmw3901_event().
void pmw3901_event | ( | struct pmw3901_t * | pmw | ) |
Definition at line 274 of file pmw3901.c.
References pmw3901_t::data_available, pmw3901_t::delta_x, pmw3901_t::delta_y, PMW3901_IDLE, PMW3901_READ_DELTAXHIGH, PMW3901_READ_DELTAXLOW, PMW3901_READ_DELTAYHIGH, PMW3901_READ_DELTAYLOW, PMW3901_READ_MOTION, PMW3901_REG_DELTA_X_H, PMW3901_REG_DELTA_X_L, PMW3901_REG_DELTA_Y_H, PMW3901_REG_DELTA_Y_L, PMW3901_REG_MOTION, readRegister_nonblocking(), and pmw3901_t::state.
Referenced by opticflow_pmw3901_event().
Definition at line 326 of file pmw3901.c.
References pmw3901_t::data_available, pmw3901_t::delta_x, and pmw3901_t::delta_y.
Referenced by opticflow_pmw3901_event().
void pmw3901_init | ( | struct pmw3901_t * | pmw, |
struct spi_periph * | periph, | ||
uint8_t | slave_idx | ||
) |
Definition at line 249 of file pmw3901.c.
References spi_transaction::after_cb, spi_transaction::before_cb, spi_transaction::bitorder, spi_transaction::cdiv, spi_transaction::cpha, spi_transaction::cpol, pmw3901_t::data_available, pmw3901_t::delta_x, pmw3901_t::delta_y, spi_transaction::dss, initializeSensor(), spi_transaction::input_buf, spi_transaction::output_buf, pmw3901_t::periph, PMW3901_IDLE, PMW3901_RAD_PER_PX, PMW3901_SPI_CDIV, pmw3901_t::rad_per_px, spi_transaction::select, spi_transaction::slave_idx, pmw3901_t::spi_input_buf, pmw3901_t::spi_output_buf, SPICphaEdge1, SPICpolIdleLow, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, SPITransDone, pmw3901_t::state, spi_transaction::status, and pmw3901_t::trans.
Referenced by opticflow_pmw3901_init().
bool pmw3901_is_idle | ( | struct pmw3901_t * | pmw | ) |
Definition at line 312 of file pmw3901.c.
References PMW3901_IDLE, and pmw3901_t::state.
Referenced by opticflow_pmw3901_periodic(), and pmw3901_start_read().
void pmw3901_start_read | ( | struct pmw3901_t * | pmw | ) |
Definition at line 316 of file pmw3901.c.
References pmw3901_is_idle(), PMW3901_READ_MOTION, and pmw3901_t::state.
Referenced by opticflow_pmw3901_periodic().
Definition at line 95 of file pmw3901.c.
References spi_transaction::input_buf, spi_transaction::input_length, spi_transaction::output_buf, spi_transaction::output_length, pmw3901_t::periph, spi_transaction::select, spi_blocking_transceive(), SPISelect, SPISelectUnselect, SPIUnselect, sys_time_usleep(), and pmw3901_t::trans.
|
static |
Definition at line 55 of file pmw3901.c.
References get_sys_time_usec(), spi_transaction::input_buf, spi_transaction::input_length, spi_transaction::output_buf, spi_transaction::output_length, pmw3901_t::periph, pmw3901_t::readwrite_state, pmw3901_t::readwrite_timeout, spi_transaction::select, spi_submit(), SPISelect, SPISelectUnselect, SPITransPending, SPITransRunning, SPIUnselect, spi_transaction::status, and pmw3901_t::trans.
Referenced by pmw3901_event().
Definition at line 110 of file pmw3901.c.
References spi_transaction::input_length, spi_transaction::output_buf, spi_transaction::output_length, pmw3901_t::periph, spi_blocking_transceive(), and pmw3901_t::trans.