You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

104 lines
3.4 KiB

#ifndef __OPTIC_FLOW_ADNS_HEADER__
#define __OPTIC_FLOW_ADNS_HEADER__
#include <unistd.h>
#include <iostream>
#include <errno.h>
#include "../../../../components/base/basicSettingsProvider.h"
#include "../../../../components/base/basicLogCollection.h"
#include "../../../../pathfinder/pathfinderDBConnector.h"
#include "../../../../components/object/objectPathfinderBinaryLog.h"
#include "../../../spi/spiPort.h"
#define OF_SROM_PRODUCT_ID 0x00
#define OF_SROM_REVISION_ID 0x01
#define OF_SROM_MOTION 0x02
#define OF_SROM_DELTA_X 0x03
#define OF_SROM_DELTA_Y 0x04
#define OF_SROM_SQUAL 0x05
#define OF_SROM_PIXEL_SUM 0x06
#define OF_SROM_MAXIMUM_PIXEL 0x07
#define OF_SROM_CONFIG_BITS 0x0A
#define OF_SROM_EXTEND_CONFIG 0x0B
#define OF_SROM_DATA_OUT_LB 0x0C
#define OF_SROM_DATA_OUT_HB 0x0D
#define OF_SROM_SHUTTER_LB 0x0E
#define OF_SROM_SHUTTER_HB 0x0F
#define OF_SROM_FRAME_PER_LB 0x10
#define OF_SROM_FRAME_PER_HB 0x11
#define OF_SROM_MOTION_CLR 0x12
#define OF_SROM_FRAME_CAP 0x13
#define OF_SROM_ENABLE 0x14
#define OF_SROM_FR_PER_MAX_LB 0x19
#define OF_SROM_FR_PER_MAX_HB 0x1A
#define OF_SROM_FR_PER_MIN_LB 0x1B
#define OF_SROM_FR_PER_MIN_HB 0x1C
#define OF_SROM_SH_MAX_LB 0x1D
#define OF_SROM_SH_MAX_HB 0x1E
#define OF_SROM_ID 0x1F
#define OF_SROM_OBSERVATION 0x3D
#define OF_SROM_INV_PRODUCT_ID 0x3F
#define OF_SROM_PIXEL_BURST 0x40
#define OF_SROM_MOTION_BURST 0x50
#define OF_SROM_LOAD 0x60
#define OF_RESET_PIN 21
#define OF_NCS_PIN 10
#define OF_SROM_CS 0xBEEF
#define OF_SYSTEM_CS 0x1BBF
#define OF_REG_CB_NLED 0x40
#define OF_REG_CB_STEST 0x20
#define OF_REG_CB_RES 0x10
#define OF_REG_ECB_BUSY 0x80
#define OF_REG_ECB_NPU 0x04
#define OF_REG_ECB_NAGC 0x02
#define OF_REG_ECB_FFR 0x01
#define OF_MO_FLG_MD 0x80
#define OF_MO_FLG_OF 0x10
#define OF_MO_FLG_RS 0x01
#define OF_WM_PICTURES 0x00
#define OF_WM_MOVEMENT 0x01
#define OF_WM_SWITCH2MOV 0x02
#define OF_WM_SWITCH2PIC 0x03
class opticFlow: public basicThread {
private:
basicLogCollection * m_pLog;
spiPort * m_pBus;
uint8_t m_nConfigB;
uint8_t m_nConfigE;
config_setting_t * m_pSettings;
PATHFINDER_DBC * m_pDBC;
objectPathfinderBinaryLog * m_pBLOG;
uint8_t m_bWM;
OPF_MOTION m_sMotion;
OPF_EVTREC m_sEvent;
bool uploadSRAM();
bool downloadFrame();
bool resetChip();
bool resetMotion();
bool readBurstMotion();
bool readBurstPixels( uint32_t idx = 0, bool wm_srom = false );
private:
void m_fThreadProc( void );
public:
explicit opticFlow( config_setting_t *Settings = NULL, PATHFINDER_DBC *DBC = NULL );
virtual ~opticFlow();
bool create();
bool setMode( uint8_t mode );
bool isDead();
};
#endif