A optical beam breaker detector that appears to aPC as a USB keyboard, typing characters when the beam is broken
USBMouse/USBKeyboard.h@0:9d0f47bc66da, 2011-05-12 (annotated)
- Committer:
- chris
- Date:
- Thu May 12 16:44:09 2011 +0000
- Revision:
- 0:9d0f47bc66da
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 0:9d0f47bc66da | 1 | /* mbed Microcontroller Library - USBKeyboard |
chris | 0:9d0f47bc66da | 2 | * Copyright (c) 2007-2008, sford, pwright |
chris | 0:9d0f47bc66da | 3 | */ |
chris | 0:9d0f47bc66da | 4 | |
chris | 0:9d0f47bc66da | 5 | #include "Stream.h" |
chris | 0:9d0f47bc66da | 6 | #include "usbhid.h" |
chris | 0:9d0f47bc66da | 7 | |
chris | 0:9d0f47bc66da | 8 | #ifndef USBKEYBOARD_H |
chris | 0:9d0f47bc66da | 9 | #define USBKEYBOARD_H |
chris | 0:9d0f47bc66da | 10 | |
chris | 0:9d0f47bc66da | 11 | /* Class: USBKeyboard |
chris | 0:9d0f47bc66da | 12 | * Emulate a USB Keyboard |
chris | 0:9d0f47bc66da | 13 | * |
chris | 0:9d0f47bc66da | 14 | * This class will enumerate as a USB Keyboard to a host computer. |
chris | 0:9d0f47bc66da | 15 | * The host should be connected using the USB Device interface pins (D+, D-, GND) |
chris | 0:9d0f47bc66da | 16 | */ |
chris | 0:9d0f47bc66da | 17 | class USBKeyboard : public Stream { |
chris | 0:9d0f47bc66da | 18 | public: |
chris | 0:9d0f47bc66da | 19 | |
chris | 0:9d0f47bc66da | 20 | #if 0 // Inhereted from Stream, for documentation only |
chris | 0:9d0f47bc66da | 21 | |
chris | 0:9d0f47bc66da | 22 | /* Function: putc |
chris | 0:9d0f47bc66da | 23 | * Send a character keypress |
chris | 0:9d0f47bc66da | 24 | * |
chris | 0:9d0f47bc66da | 25 | * Variables: |
chris | 0:9d0f47bc66da | 26 | * c - The character to send |
chris | 0:9d0f47bc66da | 27 | */ |
chris | 0:9d0f47bc66da | 28 | int putc(int c); |
chris | 0:9d0f47bc66da | 29 | |
chris | 0:9d0f47bc66da | 30 | /* Function: printf |
chris | 0:9d0f47bc66da | 31 | * Send a formated string of character keypresses |
chris | 0:9d0f47bc66da | 32 | * |
chris | 0:9d0f47bc66da | 33 | * Variables: |
chris | 0:9d0f47bc66da | 34 | * format - A printf-style format string, followed by the |
chris | 0:9d0f47bc66da | 35 | * variables to use in formating the string. |
chris | 0:9d0f47bc66da | 36 | */ |
chris | 0:9d0f47bc66da | 37 | int printf(const char* format, ...); |
chris | 0:9d0f47bc66da | 38 | |
chris | 0:9d0f47bc66da | 39 | #endif |
chris | 0:9d0f47bc66da | 40 | |
chris | 0:9d0f47bc66da | 41 | virtual int _putc(int value); |
chris | 0:9d0f47bc66da | 42 | virtual int _getc(); |
chris | 0:9d0f47bc66da | 43 | private: |
chris | 0:9d0f47bc66da | 44 | usbhid _usbhid; |
chris | 0:9d0f47bc66da | 45 | }; |
chris | 0:9d0f47bc66da | 46 | |
chris | 0:9d0f47bc66da | 47 | |
chris | 0:9d0f47bc66da | 48 | #endif |