Simple USBHost WebCam for EA LPC4088 QSB/LPC1768 test program
Dependencies: LPC4088-USBHost mbed
EA LPC4088 QSB/LPC1768をUSBホストにしてWebカメラからJPEG画像を読み取るテストプログラムです。
The usage is the same as KL46Z-USBHostC270_example.
使い方はKL46Z-USBHostC270_exampleと同じです。
動作確認: Logitech C270,Logitech Q200R(Qcam Orbit AF)
LPC4088-USBHostC270/BaseUvc.h@1:1bb68ef9aa77, 2014-04-25 (annotated)
- Committer:
- va009039
- Date:
- Fri Apr 25 05:55:06 2014 +0000
- Revision:
- 1:1bb68ef9aa77
- Parent:
- 0:c972ee42b455
update LPC4088-USBHost library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 0:c972ee42b455 | 1 | // BaseUvc.h |
va009039 | 0:c972ee42b455 | 2 | #include "USBIsochronous.h" |
va009039 | 0:c972ee42b455 | 3 | #pragma once |
va009039 | 0:c972ee42b455 | 4 | |
va009039 | 0:c972ee42b455 | 5 | // --- UVC -------------------------------------------------- |
va009039 | 0:c972ee42b455 | 6 | #define _30FPS 333333 |
va009039 | 0:c972ee42b455 | 7 | #define _25FPS 400000 |
va009039 | 0:c972ee42b455 | 8 | #define _20FPS 500000 |
va009039 | 0:c972ee42b455 | 9 | #define _15FPS 666666 |
va009039 | 0:c972ee42b455 | 10 | #define _10FPS 1000000 |
va009039 | 0:c972ee42b455 | 11 | #define _5FPS 2000000 |
va009039 | 0:c972ee42b455 | 12 | #define _1FPS 10000000 |
va009039 | 0:c972ee42b455 | 13 | |
va009039 | 0:c972ee42b455 | 14 | #define SET_CUR 0x01 |
va009039 | 0:c972ee42b455 | 15 | #define GET_CUR 0x81 |
va009039 | 0:c972ee42b455 | 16 | #define GET_MIN 0x82 |
va009039 | 0:c972ee42b455 | 17 | #define GET_MAX 0x83 |
va009039 | 0:c972ee42b455 | 18 | #define GET_RES 0x84 |
va009039 | 0:c972ee42b455 | 19 | #define GET_LEN 0x85 |
va009039 | 0:c972ee42b455 | 20 | #define GET_INFO 0x86 |
va009039 | 0:c972ee42b455 | 21 | #define GET_DEF 0x87 |
va009039 | 0:c972ee42b455 | 22 | |
va009039 | 0:c972ee42b455 | 23 | #define VS_PROBE_CONTROL 0x01 |
va009039 | 0:c972ee42b455 | 24 | #define VS_COMMIT_CONTROL 0x02 |
va009039 | 0:c972ee42b455 | 25 | |
va009039 | 0:c972ee42b455 | 26 | class BaseUvc { |
va009039 | 0:c972ee42b455 | 27 | public: |
va009039 | 0:c972ee42b455 | 28 | void poll(int millisec = 0); |
va009039 | 0:c972ee42b455 | 29 | USB_TYPE Control(int req, int cs, int index, uint8_t* buf, int size); |
va009039 | 0:c972ee42b455 | 30 | USB_TYPE setInterfaceAlternate(uint8_t intf, uint8_t alt); |
va009039 | 0:c972ee42b455 | 31 | IsochronousEp* m_isoEp; |
va009039 | 0:c972ee42b455 | 32 | uint32_t report_cc_count[16]; // ConditionCode |
va009039 | 0:c972ee42b455 | 33 | uint32_t report_ps_cc_count[16]; // Packt Status ConditionCode |
va009039 | 0:c972ee42b455 | 34 | // callback |
va009039 | 0:c972ee42b455 | 35 | void onResult(uint16_t frame, uint8_t* buf, int len); |
va009039 | 0:c972ee42b455 | 36 | void setOnResult( void (*pMethod)(uint16_t, uint8_t*, int) ); |
va009039 | 0:c972ee42b455 | 37 | class CDummy; |
va009039 | 0:c972ee42b455 | 38 | template<class T> |
va009039 | 0:c972ee42b455 | 39 | void setOnResult( T* pItem, void (T::*pMethod)(uint16_t, uint8_t*, int) ) |
va009039 | 0:c972ee42b455 | 40 | { |
va009039 | 0:c972ee42b455 | 41 | m_pCb = NULL; |
va009039 | 0:c972ee42b455 | 42 | m_pCbItem = (CDummy*) pItem; |
va009039 | 0:c972ee42b455 | 43 | m_pCbMeth = (void (CDummy::*)(uint16_t, uint8_t*, int)) pMethod; |
va009039 | 0:c972ee42b455 | 44 | } |
va009039 | 0:c972ee42b455 | 45 | void clearOnResult(); |
va009039 | 0:c972ee42b455 | 46 | CDummy* m_pCbItem; |
va009039 | 0:c972ee42b455 | 47 | void (CDummy::*m_pCbMeth)(uint16_t, uint8_t*, int); |
va009039 | 0:c972ee42b455 | 48 | void (*m_pCb)(uint16_t, uint8_t*, int); |
va009039 | 0:c972ee42b455 | 49 | protected: |
va009039 | 0:c972ee42b455 | 50 | USBHost * host; |
va009039 | 0:c972ee42b455 | 51 | USBDeviceConnected * dev; |
va009039 | 0:c972ee42b455 | 52 | }; |