Simple USBHost library for Nucleo F446RE/F411RE/F401RE FRDM-KL46Z/KL25Z/F64F LPC4088/LPC1768

Dependencies:   FATFileSystem

Dependents:   F401RE-BTstack_example F401RE-USBHostMSD_HelloWorld

Fork of KL46Z-USBHost by Norimasa Okamoto

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BaseUvc.h Source File

BaseUvc.h

00001 // BaseUvc.h
00002 #pragma once
00003 
00004 // --- UVC --------------------------------------------------
00005 #define _30FPS  333333
00006 #define _25FPS  400000
00007 #define _20FPS  500000
00008 #define _15FPS  666666
00009 #define _10FPS 1000000
00010 #define _5FPS  2000000
00011 #define _1FPS 10000000
00012 
00013 #define SET_CUR  0x01
00014 #define GET_CUR  0x81
00015 #define GET_MIN  0x82
00016 #define GET_MAX  0x83
00017 #define GET_RES  0x84
00018 #define GET_LEN  0x85
00019 #define GET_INFO 0x86
00020 #define GET_DEF  0x87
00021 
00022 #define VS_PROBE_CONTROL  0x01
00023 #define VS_COMMIT_CONTROL 0x02
00024 
00025 class BaseUvc {
00026 public:
00027     void poll();
00028     USB_TYPE Control(int req, int cs, int index, uint8_t* buf, int size);
00029     USB_TYPE setInterfaceAlternate(uint8_t intf, uint8_t alt);
00030     //IsochronousEp* m_isoEp;
00031     // callback
00032     void onResult(uint16_t frame, uint8_t* buf, int len);
00033     void setOnResult( void (*pMethod)(uint16_t, uint8_t*, int) );
00034     class CDummy;
00035     template<class T> 
00036     void setOnResult( T* pItem, void (T::*pMethod)(uint16_t, uint8_t*, int) )
00037     {
00038         m_pCb = NULL;
00039         m_pCbItem = (CDummy*) pItem;
00040         m_pCbMeth = (void (CDummy::*)(uint16_t, uint8_t*, int)) pMethod;
00041     }
00042     void clearOnResult();
00043     CDummy* m_pCbItem;
00044     void (CDummy::*m_pCbMeth)(uint16_t, uint8_t*, int);
00045     void (*m_pCb)(uint16_t, uint8_t*, int);
00046 protected:
00047     USBHost * host;
00048     USBDeviceConnected * dev;
00049     USBEndpoint* ep_iso_in;
00050 };