ryosuke yumoto
/
ADNS3080_HelloWorld
I don't finish configuring this program.
Revision 1:46abb3b9347d, committed 2014-08-08
- Comitter:
- ryosuke
- Date:
- Fri Aug 08 06:36:15 2014 +0000
- Parent:
- 0:9beaad87014d
- Commit message:
- this program is a test program of ADNS 3080 optical flow sensor. this optical flow sensor board is developed by 3DRobotics.
Changed in this revision
diff -r 9beaad87014d -r 46abb3b9347d ADNS3080.cpp --- a/ADNS3080.cpp Thu May 08 12:59:25 2014 +0000 +++ b/ADNS3080.cpp Fri Aug 08 06:36:15 2014 +0000 @@ -1,3 +1,6 @@ +/* + *author Ryosuke Yumoto + */ #include "ADNS3080.h" ADNS3080::ADNS3080(PinName mosi, @@ -13,7 +16,7 @@ wait_us(500); } - +// int ADNS3080::getProdID(void) { return ReadRegister(ADNS3080_PRODUCT_ID); @@ -44,6 +47,59 @@ } +unsigned int ADNS3080::getSQUAL(void) { + + return ReadRegister(ADNS3080_SQUAL); + +} + +unsigned short ADNS3080::getPixel_sum(void) { + + return ReadRegister(ADNS3080_PIXEL_SUM); + +} + +char ADNS3080::getMax_Pixel(void) { + + return ReadRegister(ADNS3080_MAXIMUM_PIXEL); + +} + +int ADNS3080::getConfiguration_bits(void){ + + return ReadRegister(ADNS3080_CONFIGURATION_BITS); + +} + +void ADNS3080::setConfiguration_bits(char configuration){ + + WriteRegister(ADNS3080_CONFIGURATION_BITS, configuration); + +} + +int ADNS3080::getExtended_config(void){ + + return ReadRegister(ADNS3080_EXTENDED_CONFIG); + +} +void ADNS3080::setExtended_config(char extended_config){ + + WriteRegister(ADNS3080_EXTENDED_CONFIG, extended_config); + +} + +/* +short getData_Out(void){ + + ReadRegister(ADNS3080_DATA_OUT_UPPER); + ReadRegister(ADNS3080_DATA_OUT_LOWER); + +} +unsigned int getShutter(void); +unsigned int getFrame_Period(void); +void Motion_Clear(void); +*/ + int ADNS3080::getInverProdID(void) { return ReadRegister(ADNS3080_INVERSE_PRODUCT_ID);
diff -r 9beaad87014d -r 46abb3b9347d ADNS3080.h --- a/ADNS3080.h Thu May 08 12:59:25 2014 +0000 +++ b/ADNS3080.h Fri Aug 08 06:36:15 2014 +0000 @@ -1,3 +1,6 @@ +/* + *author Ryosuke Yumoto + */ #ifndef ADNS3080_H #define ADNS3080_H @@ -51,6 +54,20 @@ int getMotion(void); signed char getDelta_X(void); signed char getDelta_Y(void); + unsigned int getSQUAL(void); + unsigned short getPixel_sum(void); + char getMax_Pixel(void); + int getConfiguration_bits(void); + void setConfiguration_bits(char configuration); + int getExtended_config(void); + void setExtended_config(char extended_config); +/* + short getData_Out(void); + unsigned int getShutter(void); + unsigned int getFrame_Period(void); + void Motion_Clear(void); +*/ + int getInverProdID(void); private:
diff -r 9beaad87014d -r 46abb3b9347d main.cpp --- a/main.cpp Thu May 08 12:59:25 2014 +0000 +++ b/main.cpp Fri Aug 08 06:36:15 2014 +0000 @@ -6,16 +6,15 @@ Serial pc(USBTX, USBRX); int main() { - int delta_x = 0; - int delta_y = 0; + pc.printf("Hello World! test ADNS3080\n\r"); + pc.printf("prodID is %x\n\r", OptFlow.getProdID()); + pc.printf("configuration is %x\n\r", OptFlow.getConfiguration_bits()); + while(1){ - - delta_x= OptFlow.getDelta_X(); - - delta_y = OptFlow.getDelta_Y(); - pc.printf("%4d, %4d\n\r", delta_x ,delta_y ); - wait(0.1); + OptFlow.getMotion(); + pc.printf("%4d, %4d\n\r", OptFlow.getDelta_X(),OptFlow.getDelta_Y()); + wait(0.01); } }