APM:Libraries
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
AP_OpticalFlow_Pixart Class Reference

#include <AP_OpticalFlow_Pixart.h>

Inheritance diagram for AP_OpticalFlow_Pixart:
[legend]
Collaboration diagram for AP_OpticalFlow_Pixart:
[legend]

Classes

struct  MotionBurst
 
struct  RegData
 

Public Member Functions

 AP_OpticalFlow_Pixart (const char *devname, OpticalFlow &_frontend)
 constructor More...
 
void init () override
 
void update (void) override
 
- Public Member Functions inherited from OpticalFlow_backend
 OpticalFlow_backend (OpticalFlow &_frontend)
 
virtual ~OpticalFlow_backend (void)
 

Static Public Member Functions

static AP_OpticalFlow_Pixartdetect (const char *devname, OpticalFlow &_frontend)
 

Private Types

enum  { PIXART_3900 =0, PIXART_3901 =1 }
 

Private Member Functions

bool setup_sensor (void)
 
void reg_write (uint8_t reg, uint8_t value)
 
uint8_t reg_read (uint8_t reg)
 
int16_t reg_read16s (uint8_t reg)
 
uint16_t reg_read16u (uint8_t reg)
 
void srom_download (void)
 
void load_configuration (const RegData *init_data, uint16_t n)
 
void timer (void)
 
void motion_burst (void)
 

Private Attributes

AP_HAL::OwnPtr< AP_HAL::SPIDevice_dev
 
enum AP_OpticalFlow_Pixart:: { ... }  model
 
struct PACKED AP_OpticalFlow_Pixart::MotionBurst burst
 
struct {
   Vector2l   sum
 
   uint32_t   last_frame_us
 
   uint32_t   sum_us
 
   Vector2f   gyro
 
integral
 
const float flow_pixel_scaling = 1.26e-3
 
uint32_t last_burst_us
 
uint32_t last_update_ms
 

Static Private Attributes

static const uint8_t srom_data []
 
static const uint8_t srom_id = 0xED
 
static const RegData init_data_3900 []
 
static const RegData init_data_3901_1 []
 
static const RegData init_data_3901_2 []
 

Additional Inherited Members

- Protected Member Functions inherited from OpticalFlow_backend
void _update_frontend (const struct OpticalFlow::OpticalFlow_state &state)
 
Vector2f _flowScaler (void) const
 
float _yawAngleRad (void) const
 
void _applyYaw (Vector2f &v)
 
AP_AHRS_NavEKFget_ahrs (void)
 
uint8_t get_address (void) const
 
- Protected Attributes inherited from OpticalFlow_backend
OpticalFlowfrontend
 
AP_HAL::Semaphore_sem
 

Detailed Description

Definition at line 6 of file AP_OpticalFlow_Pixart.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
PIXART_3900 
PIXART_3901 

Definition at line 24 of file AP_OpticalFlow_Pixart.h.

Constructor & Destructor Documentation

◆ AP_OpticalFlow_Pixart()

AP_OpticalFlow_Pixart::AP_OpticalFlow_Pixart ( const char *  devname,
OpticalFlow _frontend 
)

constructor

Definition at line 83 of file AP_OpticalFlow_Pixart.cpp.

Referenced by detect().

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

Member Function Documentation

◆ detect()

AP_OpticalFlow_Pixart * AP_OpticalFlow_Pixart::detect ( const char *  devname,
OpticalFlow _frontend 
)
static

Definition at line 91 of file AP_OpticalFlow_Pixart.cpp.

Referenced by init(), and OpticalFlow::init().

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

◆ init()

void AP_OpticalFlow_Pixart::init ( void  )
inlineoverridevirtual

Implements OpticalFlow_backend.

Definition at line 13 of file AP_OpticalFlow_Pixart.h.

Here is the call graph for this function:

◆ load_configuration()

void AP_OpticalFlow_Pixart::load_configuration ( const RegData init_data,
uint16_t  n 
)
private

Definition at line 250 of file AP_OpticalFlow_Pixart.cpp.

Referenced by setup_sensor().

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

◆ motion_burst()

void AP_OpticalFlow_Pixart::motion_burst ( void  )
private

Definition at line 266 of file AP_OpticalFlow_Pixart.cpp.

Referenced by timer().

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

◆ reg_read()

uint8_t AP_OpticalFlow_Pixart::reg_read ( uint8_t  reg)
private

Definition at line 196 of file AP_OpticalFlow_Pixart.cpp.

Referenced by load_configuration(), reg_read16u(), and setup_sensor().

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

◆ reg_read16s()

int16_t AP_OpticalFlow_Pixart::reg_read16s ( uint8_t  reg)
private

Definition at line 217 of file AP_OpticalFlow_Pixart.cpp.

Here is the call graph for this function:

◆ reg_read16u()

uint16_t AP_OpticalFlow_Pixart::reg_read16u ( uint8_t  reg)
private

Definition at line 209 of file AP_OpticalFlow_Pixart.cpp.

Referenced by reg_read16s(), and setup_sensor().

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

◆ reg_write()

void AP_OpticalFlow_Pixart::reg_write ( uint8_t  reg,
uint8_t  value 
)
private

Definition at line 184 of file AP_OpticalFlow_Pixart.cpp.

Referenced by load_configuration(), setup_sensor(), and srom_download().

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

◆ setup_sensor()

bool AP_OpticalFlow_Pixart::setup_sensor ( void  )
private

Definition at line 105 of file AP_OpticalFlow_Pixart.cpp.

Referenced by detect().

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

◆ srom_download()

void AP_OpticalFlow_Pixart::srom_download ( void  )
private

Definition at line 223 of file AP_OpticalFlow_Pixart.cpp.

Referenced by setup_sensor().

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

◆ timer()

void AP_OpticalFlow_Pixart::timer ( void  )
private

Definition at line 290 of file AP_OpticalFlow_Pixart.cpp.

Referenced by setup_sensor().

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

◆ update()

void AP_OpticalFlow_Pixart::update ( void  )
overridevirtual

Implements OpticalFlow_backend.

Definition at line 335 of file AP_OpticalFlow_Pixart.cpp.

Referenced by init().

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

Member Data Documentation

◆ _dev

AP_HAL::OwnPtr<AP_HAL::SPIDevice> AP_OpticalFlow_Pixart::_dev
private

◆ burst

struct PACKED AP_OpticalFlow_Pixart::MotionBurst AP_OpticalFlow_Pixart::burst
private

Referenced by motion_burst(), timer(), and update().

◆ flow_pixel_scaling

const float AP_OpticalFlow_Pixart::flow_pixel_scaling = 1.26e-3
private

Definition at line 59 of file AP_OpticalFlow_Pixart.h.

Referenced by update().

◆ gyro

Vector2f AP_OpticalFlow_Pixart::gyro

Definition at line 51 of file AP_OpticalFlow_Pixart.h.

Referenced by timer().

◆ init_data_3900

const AP_OpticalFlow_Pixart::RegData AP_OpticalFlow_Pixart::init_data_3900
staticprivate

Definition at line 56 of file AP_OpticalFlow_Pixart.h.

Referenced by setup_sensor().

◆ init_data_3901_1

const AP_OpticalFlow_Pixart::RegData AP_OpticalFlow_Pixart::init_data_3901_1
staticprivate

Definition at line 57 of file AP_OpticalFlow_Pixart.h.

Referenced by setup_sensor().

◆ init_data_3901_2

const AP_OpticalFlow_Pixart::RegData AP_OpticalFlow_Pixart::init_data_3901_2
staticprivate
Initial value:
=
{
{ 0x32, 0x44 },
{ 0x7F, 0x07 },
{ 0x40, 0x40 },
{ 0x7F, 0x06 },
{ 0x62, 0xF0 },
{ 0x63, 0x00 },
{ 0x7F, 0x0D },
{ 0x48, 0xC0 },
{ 0x6F, 0xD5 },
{ 0x7F, 0x00 },
{ 0x5B, 0xA0 },
{ 0x4E, 0xA8 },
{ 0x5A, 0x50 },
{ 0x40, 0x80 },
}

Definition at line 58 of file AP_OpticalFlow_Pixart.h.

Referenced by setup_sensor().

◆ integral

struct { ... } AP_OpticalFlow_Pixart::integral

Referenced by setup_sensor(), timer(), and update().

◆ last_burst_us

uint32_t AP_OpticalFlow_Pixart::last_burst_us
private

Definition at line 75 of file AP_OpticalFlow_Pixart.h.

Referenced by timer().

◆ last_frame_us

uint32_t AP_OpticalFlow_Pixart::last_frame_us

Definition at line 49 of file AP_OpticalFlow_Pixart.h.

◆ last_update_ms

uint32_t AP_OpticalFlow_Pixart::last_update_ms
private

Definition at line 76 of file AP_OpticalFlow_Pixart.h.

Referenced by update().

◆ model

enum { ... } AP_OpticalFlow_Pixart::model

Referenced by motion_burst(), and setup_sensor().

◆ srom_data

const uint8_t AP_OpticalFlow_Pixart::srom_data
staticprivate

Definition at line 54 of file AP_OpticalFlow_Pixart.h.

Referenced by srom_download().

◆ srom_id

const uint8_t AP_OpticalFlow_Pixart::srom_id = 0xED
staticprivate

Definition at line 55 of file AP_OpticalFlow_Pixart.h.

Referenced by setup_sensor().

◆ sum

Vector2l AP_OpticalFlow_Pixart::sum

Definition at line 48 of file AP_OpticalFlow_Pixart.h.

◆ sum_us

uint32_t AP_OpticalFlow_Pixart::sum_us

Definition at line 50 of file AP_OpticalFlow_Pixart.h.


The documentation for this class was generated from the following files: