Repository for import to local machine
Dependencies: DMBasicGUI DMSupport
USBHostGC.h@8:26e49e6955bd, 2017-07-31 (annotated)
- Committer:
- jmitc91516
- Date:
- Mon Jul 31 15:37:57 2017 +0000
- Revision:
- 8:26e49e6955bd
- Parent:
- 1:a5258871b33d
Method ramp scrolling improved, and more bitmaps moved to QSPI memory
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jmitc91516 | 0:47c880c1463d | 1 | #ifndef USBHOSTGC_H |
jmitc91516 | 0:47c880c1463d | 2 | #define USBHOSTGC_H |
jmitc91516 | 0:47c880c1463d | 3 | |
jmitc91516 | 0:47c880c1463d | 4 | #include "lpc_swim.h" |
jmitc91516 | 0:47c880c1463d | 5 | #include "lpc_swim_font.h" |
jmitc91516 | 0:47c880c1463d | 6 | |
jmitc91516 | 0:47c880c1463d | 7 | #include "USBHostConf.h" |
jmitc91516 | 0:47c880c1463d | 8 | #include "USBHost.h" |
jmitc91516 | 0:47c880c1463d | 9 | |
jmitc91516 | 0:47c880c1463d | 10 | enum GC_IDS { |
jmitc91516 | 0:47c880c1463d | 11 | GC_VENDOR_ID = 0x0925, |
jmitc91516 | 1:a5258871b33d | 12 | GC_PRODUCT_ID = 0x1234, // Earlier sofware versions |
jmitc91516 | 1:a5258871b33d | 13 | GC_PRODUCT_ID_2 = 0x1235 // Later versions |
jmitc91516 | 0:47c880c1463d | 14 | }; |
jmitc91516 | 0:47c880c1463d | 15 | |
jmitc91516 | 0:47c880c1463d | 16 | enum GC_MESSAGE_DATA { |
jmitc91516 | 0:47c880c1463d | 17 | GC_MESSAGE_LENGTH = 10, |
jmitc91516 | 0:47c880c1463d | 18 | GC_CR = 13 // Make *sure* we use the same value for <CR> as the GC expects |
jmitc91516 | 0:47c880c1463d | 19 | }; |
jmitc91516 | 0:47c880c1463d | 20 | |
jmitc91516 | 0:47c880c1463d | 21 | // USBHost does not define these - GC assembler code does |
jmitc91516 | 0:47c880c1463d | 22 | #define GET_CONFIGURATION 0x08 |
jmitc91516 | 0:47c880c1463d | 23 | #define GC_CONFIGURATION_DESCRIPTOR_LENGTH 0x22 |
jmitc91516 | 0:47c880c1463d | 24 | |
jmitc91516 | 0:47c880c1463d | 25 | /** |
jmitc91516 | 0:47c880c1463d | 26 | * A class to communicate with a USB GC. |
jmitc91516 | 0:47c880c1463d | 27 | * |
jmitc91516 | 0:47c880c1463d | 28 | */ |
jmitc91516 | 0:47c880c1463d | 29 | class USBHostGC : public IUSBEnumerator |
jmitc91516 | 0:47c880c1463d | 30 | { |
jmitc91516 | 0:47c880c1463d | 31 | public: |
jmitc91516 | 0:47c880c1463d | 32 | USBHostGC(); |
jmitc91516 | 0:47c880c1463d | 33 | ~USBHostGC(); |
jmitc91516 | 0:47c880c1463d | 34 | |
jmitc91516 | 0:47c880c1463d | 35 | void SetDebugWindow(SWIM_WINDOW_T* newDebugWindow) { debugWindow = newDebugWindow; } |
jmitc91516 | 0:47c880c1463d | 36 | |
jmitc91516 | 0:47c880c1463d | 37 | bool DeviceIsGC(void) { return deviceIsGC; } |
jmitc91516 | 0:47c880c1463d | 38 | |
jmitc91516 | 0:47c880c1463d | 39 | void NoDeviceConnected(void); |
jmitc91516 | 0:47c880c1463d | 40 | |
jmitc91516 | 0:47c880c1463d | 41 | bool AttachGCDevice(USBDeviceConnected* usbDeviceConnected); |
jmitc91516 | 0:47c880c1463d | 42 | |
jmitc91516 | 0:47c880c1463d | 43 | void RXHandler(void); |
jmitc91516 | 0:47c880c1463d | 44 | |
jmitc91516 | 0:47c880c1463d | 45 | USB_TYPE SetDeviceReport(USBDeviceConnected * dev, const char* report, char* response); |
jmitc91516 | 0:47c880c1463d | 46 | |
jmitc91516 | 0:47c880c1463d | 47 | bool ExecutingSetDeviceReport(void); |
jmitc91516 | 0:47c880c1463d | 48 | |
jmitc91516 | 0:47c880c1463d | 49 | |
jmitc91516 | 0:47c880c1463d | 50 | // From IUSBEnumerator - implement these to make this class non-abstract |
jmitc91516 | 0:47c880c1463d | 51 | virtual void setVidPid(uint16_t vid, uint16_t pid); |
jmitc91516 | 0:47c880c1463d | 52 | virtual bool parseInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol); // Must return true if the interface should be parsed |
jmitc91516 | 0:47c880c1463d | 53 | virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); // Must return true if the endpoint will be used |
jmitc91516 | 0:47c880c1463d | 54 | |
jmitc91516 | 0:47c880c1463d | 55 | private: |
jmitc91516 | 0:47c880c1463d | 56 | void DebugPrint(const char* debugText); |
jmitc91516 | 0:47c880c1463d | 57 | |
jmitc91516 | 0:47c880c1463d | 58 | void AllocateReportBuffer(void); |
jmitc91516 | 0:47c880c1463d | 59 | |
jmitc91516 | 0:47c880c1463d | 60 | SWIM_WINDOW_T* debugWindow; |
jmitc91516 | 0:47c880c1463d | 61 | USBHost* usbHost; |
jmitc91516 | 0:47c880c1463d | 62 | |
jmitc91516 | 0:47c880c1463d | 63 | bool deviceIsGC; |
jmitc91516 | 0:47c880c1463d | 64 | int intfGC; |
jmitc91516 | 0:47c880c1463d | 65 | uint8_t* reportBuffer; |
jmitc91516 | 0:47c880c1463d | 66 | USBEndpoint* intInEndpointGC; |
jmitc91516 | 0:47c880c1463d | 67 | USBDeviceConnected* usbGCDeviceConnected; |
jmitc91516 | 0:47c880c1463d | 68 | |
jmitc91516 | 0:47c880c1463d | 69 | bool volatile responseReceived; |
jmitc91516 | 0:47c880c1463d | 70 | |
jmitc91516 | 0:47c880c1463d | 71 | bool volatile alreadyInSetDeviceReport; |
jmitc91516 | 0:47c880c1463d | 72 | }; |
jmitc91516 | 0:47c880c1463d | 73 | |
jmitc91516 | 0:47c880c1463d | 74 | |
jmitc91516 | 0:47c880c1463d | 75 | #endif |