Junichi Katsu / Mbed 2 deprecated BLEControl

Dependencies:   FatFileSystem TB6612FNG2 mbed

Committer:
mbed_Cookbook_SE
Date:
Mon Nov 30 09:32:15 2015 +0000
Revision:
0:de03cbbcd0ff
??

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_Cookbook_SE 0:de03cbbcd0ff 1 #ifndef UVC_H
mbed_Cookbook_SE 0:de03cbbcd0ff 2 #define UVC_H
mbed_Cookbook_SE 0:de03cbbcd0ff 3 #include "UsbBaseClass.h"
mbed_Cookbook_SE 0:de03cbbcd0ff 4 #include "usb_mem.h"
mbed_Cookbook_SE 0:de03cbbcd0ff 5 #include "usb_mjpeg.h"
mbed_Cookbook_SE 0:de03cbbcd0ff 6
mbed_Cookbook_SE 0:de03cbbcd0ff 7 #define CLASS_VIDEO 0x0E
mbed_Cookbook_SE 0:de03cbbcd0ff 8
mbed_Cookbook_SE 0:de03cbbcd0ff 9 #define SET_CUR 0x01
mbed_Cookbook_SE 0:de03cbbcd0ff 10 #define GET_CUR 0x81
mbed_Cookbook_SE 0:de03cbbcd0ff 11 #define GET_MIN 0x82
mbed_Cookbook_SE 0:de03cbbcd0ff 12 #define GET_MAX 0x83
mbed_Cookbook_SE 0:de03cbbcd0ff 13 #define GET_RES 0x84
mbed_Cookbook_SE 0:de03cbbcd0ff 14 #define GET_LEN 0x85
mbed_Cookbook_SE 0:de03cbbcd0ff 15 #define GET_INFO 0x86
mbed_Cookbook_SE 0:de03cbbcd0ff 16 #define GET_DEF 0x87
mbed_Cookbook_SE 0:de03cbbcd0ff 17
mbed_Cookbook_SE 0:de03cbbcd0ff 18 #define VS_PROBE_CONTROL 0x01
mbed_Cookbook_SE 0:de03cbbcd0ff 19 #define VS_COMMIT_CONTROL 0x02
mbed_Cookbook_SE 0:de03cbbcd0ff 20
mbed_Cookbook_SE 0:de03cbbcd0ff 21 #define PAYLOAD_UNDEF 0
mbed_Cookbook_SE 0:de03cbbcd0ff 22 #define PAYLOAD_MJPEG 1
mbed_Cookbook_SE 0:de03cbbcd0ff 23 #define PAYLOAD_YUY2 2
mbed_Cookbook_SE 0:de03cbbcd0ff 24
mbed_Cookbook_SE 0:de03cbbcd0ff 25 class uvc : public UsbBaseClass {
mbed_Cookbook_SE 0:de03cbbcd0ff 26 public:
mbed_Cookbook_SE 0:de03cbbcd0ff 27 uvc(int cam = 0);
mbed_Cookbook_SE 0:de03cbbcd0ff 28 ~uvc();
mbed_Cookbook_SE 0:de03cbbcd0ff 29 int setup();
mbed_Cookbook_SE 0:de03cbbcd0ff 30 int get_jpeg(const char* path);
mbed_Cookbook_SE 0:de03cbbcd0ff 31 int get_jpeg(uint8_t* buf, int size);
mbed_Cookbook_SE 0:de03cbbcd0ff 32 bool interrupt();
mbed_Cookbook_SE 0:de03cbbcd0ff 33 int isochronous();
mbed_Cookbook_SE 0:de03cbbcd0ff 34 void attach(usb_stream* stream);
mbed_Cookbook_SE 0:de03cbbcd0ff 35 void detach();
mbed_Cookbook_SE 0:de03cbbcd0ff 36 ///set format index
mbed_Cookbook_SE 0:de03cbbcd0ff 37 void SetFormatIndex(int index = 1);
mbed_Cookbook_SE 0:de03cbbcd0ff 38 ///set frame index
mbed_Cookbook_SE 0:de03cbbcd0ff 39 void SetFrameIndex(int index = 1);
mbed_Cookbook_SE 0:de03cbbcd0ff 40 ///set frame interval
mbed_Cookbook_SE 0:de03cbbcd0ff 41 void SetFrameInterval(int val = 2000000);
mbed_Cookbook_SE 0:de03cbbcd0ff 42 ///set packet size
mbed_Cookbook_SE 0:de03cbbcd0ff 43 void SetPacketSize(int size = 128);
mbed_Cookbook_SE 0:de03cbbcd0ff 44 ///set image size
mbed_Cookbook_SE 0:de03cbbcd0ff 45 void SetImageSize(int width = 160, int height = 120);
mbed_Cookbook_SE 0:de03cbbcd0ff 46 ///set payload MJPEG or YUY2
mbed_Cookbook_SE 0:de03cbbcd0ff 47 void SetPayload(int payload); // MJPEG,YUV422(YUY2)
mbed_Cookbook_SE 0:de03cbbcd0ff 48 UsbErr Control(int req, int cs, int index, uint8_t* buf, int size);
mbed_Cookbook_SE 0:de03cbbcd0ff 49 ///Setups the result callback
mbed_Cookbook_SE 0:de03cbbcd0ff 50 /**
mbed_Cookbook_SE 0:de03cbbcd0ff 51 @param pMethod : callback function
mbed_Cookbook_SE 0:de03cbbcd0ff 52 */
mbed_Cookbook_SE 0:de03cbbcd0ff 53 void setOnResult( void (*pMethod)(uint16_t, uint8_t*, int) );
mbed_Cookbook_SE 0:de03cbbcd0ff 54
mbed_Cookbook_SE 0:de03cbbcd0ff 55 ///Setups the result callback
mbed_Cookbook_SE 0:de03cbbcd0ff 56 /**
mbed_Cookbook_SE 0:de03cbbcd0ff 57 @param pItem : instance of class on which to execute the callback method
mbed_Cookbook_SE 0:de03cbbcd0ff 58 @param pMethod : callback method
mbed_Cookbook_SE 0:de03cbbcd0ff 59 */
mbed_Cookbook_SE 0:de03cbbcd0ff 60 class CDummy;
mbed_Cookbook_SE 0:de03cbbcd0ff 61 template<class T>
mbed_Cookbook_SE 0:de03cbbcd0ff 62 void setOnResult( T* pItem, void (T::*pMethod)(uint16_t, uint8_t*, int) )
mbed_Cookbook_SE 0:de03cbbcd0ff 63 {
mbed_Cookbook_SE 0:de03cbbcd0ff 64 m_pCb = NULL;
mbed_Cookbook_SE 0:de03cbbcd0ff 65 m_pCbItem = (CDummy*) pItem;
mbed_Cookbook_SE 0:de03cbbcd0ff 66 m_pCbMeth = (void (CDummy::*)(uint16_t, uint8_t*, int)) pMethod;
mbed_Cookbook_SE 0:de03cbbcd0ff 67 }
mbed_Cookbook_SE 0:de03cbbcd0ff 68 void clearOnResult();
mbed_Cookbook_SE 0:de03cbbcd0ff 69
mbed_Cookbook_SE 0:de03cbbcd0ff 70 void poll();
mbed_Cookbook_SE 0:de03cbbcd0ff 71 void wait(float s);
mbed_Cookbook_SE 0:de03cbbcd0ff 72 void wait_ms(int ms);
mbed_Cookbook_SE 0:de03cbbcd0ff 73 uint16_t ReportConditionCode[16];
mbed_Cookbook_SE 0:de03cbbcd0ff 74 protected:
mbed_Cookbook_SE 0:de03cbbcd0ff 75 int _init();
mbed_Cookbook_SE 0:de03cbbcd0ff 76 void _config(struct stcamcfg* cfg);
mbed_Cookbook_SE 0:de03cbbcd0ff 77 void onResult(uint16_t frame, uint8_t* buf, int len);
mbed_Cookbook_SE 0:de03cbbcd0ff 78 bool m_connect;
mbed_Cookbook_SE 0:de03cbbcd0ff 79 bool m_init;
mbed_Cookbook_SE 0:de03cbbcd0ff 80 int m_cam;
mbed_Cookbook_SE 0:de03cbbcd0ff 81 UsbDevice* m_pDev;
mbed_Cookbook_SE 0:de03cbbcd0ff 82 UsbEndpoint* m_pEpIntIn;
mbed_Cookbook_SE 0:de03cbbcd0ff 83 UsbEndpoint* m_pEpIsoIn;
mbed_Cookbook_SE 0:de03cbbcd0ff 84 int m_width;
mbed_Cookbook_SE 0:de03cbbcd0ff 85 int m_height;
mbed_Cookbook_SE 0:de03cbbcd0ff 86 int m_payload;
mbed_Cookbook_SE 0:de03cbbcd0ff 87 int m_FormatIndex;
mbed_Cookbook_SE 0:de03cbbcd0ff 88 int m_FrameIndex;
mbed_Cookbook_SE 0:de03cbbcd0ff 89 int m_FrameInterval;
mbed_Cookbook_SE 0:de03cbbcd0ff 90 int m_PacketSize;
mbed_Cookbook_SE 0:de03cbbcd0ff 91 int m_FrameCount; // 1-8
mbed_Cookbook_SE 0:de03cbbcd0ff 92 int m_itdCount;
mbed_Cookbook_SE 0:de03cbbcd0ff 93 uint8_t m_int_buf[16];
mbed_Cookbook_SE 0:de03cbbcd0ff 94 int m_int_seq;
mbed_Cookbook_SE 0:de03cbbcd0ff 95 int m_iso_seq;
mbed_Cookbook_SE 0:de03cbbcd0ff 96 uint16_t m_iso_frame;
mbed_Cookbook_SE 0:de03cbbcd0ff 97 usb_stream* m_stream;
mbed_Cookbook_SE 0:de03cbbcd0ff 98 CDummy* m_pCbItem;
mbed_Cookbook_SE 0:de03cbbcd0ff 99 void (CDummy::*m_pCbMeth)(uint16_t, uint8_t*, int);
mbed_Cookbook_SE 0:de03cbbcd0ff 100 void (*m_pCb)(uint16_t, uint8_t*, int);
mbed_Cookbook_SE 0:de03cbbcd0ff 101 };
mbed_Cookbook_SE 0:de03cbbcd0ff 102 #endif //UVC_H