BaseUsbHost example program
Dependencies: BaseUsbHost FATFileSystem mbed mbed-rtos
Diff: LogitechC270/LogitechC270.h
- Revision:
- 1:80205a2de336
- Parent:
- 0:2a9734a95d55
- Child:
- 3:6ae9a03a6145
--- a/LogitechC270/LogitechC270.h Tue Dec 04 13:39:57 2012 +0000 +++ b/LogitechC270/LogitechC270.h Wed Dec 05 13:25:18 2012 +0000 @@ -1,6 +1,10 @@ +// LogitechC270.h 2012/12/5 #ifndef LOGITECH_C270_H #define LOGITECH_C270_H +#define C270_VID 0x046d +#define C270_PID 0x0825 + #define C270_160x120 2 #define C270_176x144 3 #define C270_320x176 4 @@ -14,64 +18,16 @@ #define C270_800x448 11 #define C270_800x600 12 -#define _30FPS 333333 -#define _25FPS 400000 -#define _20FPS 500000 -#define _15FPS 666666 -#define _10FPS 1000000 -#define _5FPS 2000000 - #define C270_MJPEG 2 #define C270_YUV2 1 -#define SET_CUR 0x01 -#define GET_CUR 0x81 -#define GET_MIN 0x82 -#define GET_MAX 0x83 -#define GET_RES 0x84 -#define GET_LEN 0x85 -#define GET_INFO 0x86 -#define GET_DEF 0x87 +#define C270_EN 0x81 +#define C270_MPS 192 +#define C270_IF_ALT 1 -#define VS_PROBE_CONTROL 0x01 -#define VS_COMMIT_CONTROL 0x02 - -class LogitechC270 { +class LogitechC270 : public BaseUvc { public: - LogitechC270(int frame = C270_160x120, uint32_t interval = _5FPS, ControlEp* ctlEp = NULL); - void poll(); - int Control(int req, int cs, int index, uint8_t* buf, int size); - uint16_t vid; - uint16_t pid; - ControlEp* m_ctlEp; - IsochronousEp* m_isoEp; - uint32_t report_cc_count[16]; // ConditionCode - uint32_t report_ps_cc_count[16]; // Packt Status ConditionCode - // callback - void onResult(uint16_t frame, uint8_t* buf, int len); - void setOnResult( void (*pMethod)(uint16_t, uint8_t*, int) ) - { - m_pCb = pMethod; - m_pCbItem = NULL; - m_pCbMeth = NULL; - } - - class CDummy; - template<class T> - void setOnResult( T* pItem, void (T::*pMethod)(uint16_t, uint8_t*, int) ) - { - m_pCb = NULL; - m_pCbItem = (CDummy*) pItem; - m_pCbMeth = (void (CDummy::*)(uint16_t, uint8_t*, int)) pMethod; - } - void clearOnResult() - { - m_pCb = NULL; - m_pCbItem = NULL; - m_pCbMeth = NULL; - } - CDummy* m_pCbItem; - void (CDummy::*m_pCbMeth)(uint16_t, uint8_t*, int); - void (*m_pCb)(uint16_t, uint8_t*, int); + LogitechC270(int frameIndex = C270_160x120, uint32_t interval = _5FPS, ControlEp* ctlEp = NULL); + static bool check(ControlEp* ctlEp); }; #endif //LOGITECH_C270_H