A optical beam breaker detector that appears to aPC as a USB keyboard, typing characters when the beam is broken
USBMouse/usbhid.h@1:45de28d7be8e, 2011-05-12 (annotated)
- Committer:
- chris
- Date:
- Thu May 12 16:46:53 2011 +0000
- Revision:
- 1:45de28d7be8e
- Parent:
- 0:9d0f47bc66da
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 0:9d0f47bc66da | 1 | /* usbhid.h */ |
chris | 0:9d0f47bc66da | 2 | /* USB HID class device */ |
chris | 0:9d0f47bc66da | 3 | /* Copyright (c) Phil Wright 2008 */ |
chris | 0:9d0f47bc66da | 4 | |
chris | 0:9d0f47bc66da | 5 | #ifndef USBHID_H |
chris | 0:9d0f47bc66da | 6 | #define USBHID_H |
chris | 0:9d0f47bc66da | 7 | |
chris | 0:9d0f47bc66da | 8 | #include "usbdevice.h" |
chris | 0:9d0f47bc66da | 9 | |
chris | 0:9d0f47bc66da | 10 | /* Mouse buttons */ |
chris | 0:9d0f47bc66da | 11 | #define MOUSE_L (1<<0) |
chris | 0:9d0f47bc66da | 12 | #define MOUSE_M (1<<1) |
chris | 0:9d0f47bc66da | 13 | #define MOUSE_R (1<<2) |
chris | 0:9d0f47bc66da | 14 | |
chris | 0:9d0f47bc66da | 15 | class usbhid : public usbdevice |
chris | 0:9d0f47bc66da | 16 | { |
chris | 0:9d0f47bc66da | 17 | public: |
chris | 0:9d0f47bc66da | 18 | usbhid(); |
chris | 0:9d0f47bc66da | 19 | bool keyboard(char c); |
chris | 0:9d0f47bc66da | 20 | bool keyboard(char *string); |
chris | 0:9d0f47bc66da | 21 | bool mouse(signed char x, signed char y, unsigned char buttons=0, signed char wheel=0); |
chris | 0:9d0f47bc66da | 22 | protected: |
chris | 0:9d0f47bc66da | 23 | virtual bool requestSetConfiguration(); |
chris | 0:9d0f47bc66da | 24 | virtual void endpointEventEP1In(void); |
chris | 0:9d0f47bc66da | 25 | virtual void deviceEventReset(void); |
chris | 0:9d0f47bc66da | 26 | virtual bool requestGetDescriptor(void); |
chris | 0:9d0f47bc66da | 27 | virtual bool requestSetup(void); |
chris | 0:9d0f47bc66da | 28 | private: |
chris | 0:9d0f47bc66da | 29 | bool sendInputReport(unsigned char id, unsigned char *data, unsigned char size); |
chris | 0:9d0f47bc66da | 30 | }; |
chris | 0:9d0f47bc66da | 31 | |
chris | 0:9d0f47bc66da | 32 | #endif |