Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
pmw3901.c File Reference
#include "pmw3901.h"
#include "mcu_periph/sys_time.h"
+ Include dependency graph for pmw3901.c:

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)
 

Macro Definition Documentation

#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().

Function Documentation

static void initializeSensor ( struct pmw3901_t pmw)
static

Definition at line 124 of file pmw3901.c.

References readRegister, sys_time_usleep(), wait_ms, and writeRegister.

Referenced by pmw3901_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

+ Here is the caller graph for this function:

bool pmw3901_get_data ( struct pmw3901_t pmw,
int16_t delta_x,
int16_t delta_y 
)

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().

+ Here is the caller graph for this function:

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().

+ Here is the caller graph for this function:

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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool readRegister_nonblocking ( struct pmw3901_t pmw,
uint8_t  addr,
uint8_t value 
)
static
static void writeRegister_blocking ( struct pmw3901_t pmw,
uint8_t  addr,
uint8_t  data 
)
static