kekw

Dependencies:   mbed C12832_lcd MMA7660

Committer:
gri
Date:
Sun Jan 19 14:57:41 2020 +0000
Revision:
2:b07d155d316c
KEKw

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gri 2:b07d155d316c 1 /* usbdc.h */
gri 2:b07d155d316c 2 /* USB device controller */
gri 2:b07d155d316c 3 /* Copyright (c) Phil Wright 2008 */
gri 2:b07d155d316c 4
gri 2:b07d155d316c 5 #ifndef USBDC_H
gri 2:b07d155d316c 6 #define USBDC_H
gri 2:b07d155d316c 7
gri 2:b07d155d316c 8 /* Endpoints */
gri 2:b07d155d316c 9 #define EP0OUT (0) /* Control */
gri 2:b07d155d316c 10 #define EP0IN (1) /* Control */
gri 2:b07d155d316c 11 #define EP1OUT (2) /* Interrupt */
gri 2:b07d155d316c 12 #define EP1IN (3) /* Interrupt */
gri 2:b07d155d316c 13 #define EP2OUT (4) /* Bulk */
gri 2:b07d155d316c 14 #define EP2IN (5) /* Bulk */
gri 2:b07d155d316c 15
gri 2:b07d155d316c 16 #include "mbed.h"
gri 2:b07d155d316c 17
gri 2:b07d155d316c 18 class usbdc : public Base
gri 2:b07d155d316c 19 {
gri 2:b07d155d316c 20 public:
gri 2:b07d155d316c 21 usbdc();
gri 2:b07d155d316c 22 void connect(void);
gri 2:b07d155d316c 23 void disconnect(void);
gri 2:b07d155d316c 24 protected:
gri 2:b07d155d316c 25 void setAddress(unsigned char address);
gri 2:b07d155d316c 26 void realiseEndpoint(unsigned char endpoint, unsigned long maxPacket);
gri 2:b07d155d316c 27 void enableEndpointEvent(unsigned char endpoint);
gri 2:b07d155d316c 28 void disableEndpointEvent(unsigned char endpoint);
gri 2:b07d155d316c 29 void stallEndpoint(unsigned char endpoint);
gri 2:b07d155d316c 30 void unstallEndpoint(unsigned char endpoint);
gri 2:b07d155d316c 31 bool getEndpointStallState(unsigned char endpoint);
gri 2:b07d155d316c 32 void configureDevice(void);
gri 2:b07d155d316c 33 void unconfigureDevice(void);
gri 2:b07d155d316c 34 unsigned long endpointRead(unsigned char endpoint, unsigned char *buffer);
gri 2:b07d155d316c 35 void endpointWrite(unsigned char endpoint, unsigned char *buffer, unsigned long size);
gri 2:b07d155d316c 36 void enableEvents(void);
gri 2:b07d155d316c 37 void disableEvents(void);
gri 2:b07d155d316c 38 virtual void deviceEventReset(void);
gri 2:b07d155d316c 39 virtual void deviceEventFrame(void);
gri 2:b07d155d316c 40 virtual void endpointEventEP0Setup(void);
gri 2:b07d155d316c 41 virtual void endpointEventEP0In(void);
gri 2:b07d155d316c 42 virtual void endpointEventEP0Out(void);
gri 2:b07d155d316c 43 virtual void endpointEventEP1In(void);
gri 2:b07d155d316c 44 virtual void endpointEventEP1Out(void);
gri 2:b07d155d316c 45 virtual void endpointEventEP2In(void);
gri 2:b07d155d316c 46 virtual void endpointEventEP2Out(void);
gri 2:b07d155d316c 47 private:
gri 2:b07d155d316c 48 void SIECommand(unsigned long command);
gri 2:b07d155d316c 49 void SIEWriteData(unsigned char data);
gri 2:b07d155d316c 50 unsigned char SIEReadData(unsigned long command);
gri 2:b07d155d316c 51 void setDeviceStatus(unsigned char status);
gri 2:b07d155d316c 52 void setEndpointStatus(unsigned char endpoint, unsigned char status);
gri 2:b07d155d316c 53 unsigned char getDeviceStatus(void);
gri 2:b07d155d316c 54 unsigned char selectEndpoint(unsigned char endpoint);
gri 2:b07d155d316c 55 unsigned char selectEndpointClearInterrupt(unsigned char endpoint);
gri 2:b07d155d316c 56 unsigned char clearBuffer(void);
gri 2:b07d155d316c 57 void validateBuffer(void);
gri 2:b07d155d316c 58 void usbisr(void);
gri 2:b07d155d316c 59 unsigned long endpointStallState;
gri 2:b07d155d316c 60 static void _usbisr(void);
gri 2:b07d155d316c 61 static usbdc *instance;
gri 2:b07d155d316c 62 };
gri 2:b07d155d316c 63
gri 2:b07d155d316c 64
gri 2:b07d155d316c 65 #endif