Usb read
Dependencies: FATFileSystem
Fork of F401RE-USBHost by
USBHostC270/BaseUvc.h@13:8774c07f12a5, 2014-06-10 (annotated)
- Committer:
- va009039
- Date:
- Tue Jun 10 13:38:41 2014 +0900
- Revision:
- 13:8774c07f12a5
- Child:
- 18:61554f238584
add USBHostC270
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 |
13:8774c07f12a5 | 1 | // BaseUvc.h |
va009039 |
13:8774c07f12a5 | 2 | //#include "USBIsochronous.h" |
va009039 |
13:8774c07f12a5 | 3 | #pragma once |
va009039 |
13:8774c07f12a5 | 4 | |
va009039 |
13:8774c07f12a5 | 5 | // --- UVC -------------------------------------------------- |
va009039 |
13:8774c07f12a5 | 6 | #define _30FPS 333333 |
va009039 |
13:8774c07f12a5 | 7 | #define _25FPS 400000 |
va009039 |
13:8774c07f12a5 | 8 | #define _20FPS 500000 |
va009039 |
13:8774c07f12a5 | 9 | #define _15FPS 666666 |
va009039 |
13:8774c07f12a5 | 10 | #define _10FPS 1000000 |
va009039 |
13:8774c07f12a5 | 11 | #define _5FPS 2000000 |
va009039 |
13:8774c07f12a5 | 12 | #define _1FPS 10000000 |
va009039 |
13:8774c07f12a5 | 13 | |
va009039 |
13:8774c07f12a5 | 14 | #define SET_CUR 0x01 |
va009039 |
13:8774c07f12a5 | 15 | #define GET_CUR 0x81 |
va009039 |
13:8774c07f12a5 | 16 | #define GET_MIN 0x82 |
va009039 |
13:8774c07f12a5 | 17 | #define GET_MAX 0x83 |
va009039 |
13:8774c07f12a5 | 18 | #define GET_RES 0x84 |
va009039 |
13:8774c07f12a5 | 19 | #define GET_LEN 0x85 |
va009039 |
13:8774c07f12a5 | 20 | #define GET_INFO 0x86 |
va009039 |
13:8774c07f12a5 | 21 | #define GET_DEF 0x87 |
va009039 |
13:8774c07f12a5 | 22 | |
va009039 |
13:8774c07f12a5 | 23 | #define VS_PROBE_CONTROL 0x01 |
va009039 |
13:8774c07f12a5 | 24 | #define VS_COMMIT_CONTROL 0x02 |
va009039 |
13:8774c07f12a5 | 25 | |
va009039 |
13:8774c07f12a5 | 26 | class BaseUvc { |
va009039 |
13:8774c07f12a5 | 27 | public: |
va009039 |
13:8774c07f12a5 | 28 | void poll(); |
va009039 |
13:8774c07f12a5 | 29 | USB_TYPE Control(int req, int cs, int index, uint8_t* buf, int size); |
va009039 |
13:8774c07f12a5 | 30 | USB_TYPE setInterfaceAlternate(uint8_t intf, uint8_t alt); |
va009039 |
13:8774c07f12a5 | 31 | //IsochronousEp* m_isoEp; |
va009039 |
13:8774c07f12a5 | 32 | // callback |
va009039 |
13:8774c07f12a5 | 33 | void onResult(uint16_t frame, uint8_t* buf, int len); |
va009039 |
13:8774c07f12a5 | 34 | void setOnResult( void (*pMethod)(uint16_t, uint8_t*, int) ); |
va009039 |
13:8774c07f12a5 | 35 | class CDummy; |
va009039 |
13:8774c07f12a5 | 36 | template<class T> |
va009039 |
13:8774c07f12a5 | 37 | void setOnResult( T* pItem, void (T::*pMethod)(uint16_t, uint8_t*, int) ) |
va009039 |
13:8774c07f12a5 | 38 | { |
va009039 |
13:8774c07f12a5 | 39 | m_pCb = NULL; |
va009039 |
13:8774c07f12a5 | 40 | m_pCbItem = (CDummy*) pItem; |
va009039 |
13:8774c07f12a5 | 41 | m_pCbMeth = (void (CDummy::*)(uint16_t, uint8_t*, int)) pMethod; |
va009039 |
13:8774c07f12a5 | 42 | } |
va009039 |
13:8774c07f12a5 | 43 | void clearOnResult(); |
va009039 |
13:8774c07f12a5 | 44 | CDummy* m_pCbItem; |
va009039 |
13:8774c07f12a5 | 45 | void (CDummy::*m_pCbMeth)(uint16_t, uint8_t*, int); |
va009039 |
13:8774c07f12a5 | 46 | void (*m_pCb)(uint16_t, uint8_t*, int); |
va009039 |
13:8774c07f12a5 | 47 | protected: |
va009039 |
13:8774c07f12a5 | 48 | USBHost * host; |
va009039 |
13:8774c07f12a5 | 49 | USBDeviceConnected * dev; |
va009039 |
13:8774c07f12a5 | 50 | USBEndpoint* ep_iso_in; |
va009039 |
13:8774c07f12a5 | 51 | }; |