USB Keyboard and mouse Example. Based on USBMouse

Dependencies:   mbed

Fork of USBKeyboardMouse by Zack Clobes

Committer:
Wabouz
Date:
Wed May 08 09:33:27 2013 +0000
Revision:
1:9c83250ce43b
Parent:
0:86603687efec
Un petit programme.

Who changed what in which revision?

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