USB Keyboard and mouse Example. Based on USBMouse

Dependencies:   mbed

Fork of USBKeyboardMouse by Zack Clobes

Committer:
zackc
Date:
Tue Jan 18 02:16:00 2011 +0000
Revision:
0:86603687efec

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
zackc 0:86603687efec 1 #include "usbhid.h"
zackc 0:86603687efec 2
zackc 0:86603687efec 3 #ifndef MBED_USBMOUSE_H
zackc 0:86603687efec 4 #define MBED_USBMOUSE_H
zackc 0:86603687efec 5
zackc 0:86603687efec 6 /* Class: USBMouse
zackc 0:86603687efec 7 * Emulate a USB Mouse HID device
zackc 0:86603687efec 8 *
zackc 0:86603687efec 9 * Example:
zackc 0:86603687efec 10 * > #include "mbed.h"
zackc 0:86603687efec 11 * > #include "USBMouse.h"
zackc 0:86603687efec 12 * >
zackc 0:86603687efec 13 * > USBMouse mouse;
zackc 0:86603687efec 14 * >
zackc 0:86603687efec 15 * > int main() {
zackc 0:86603687efec 16 * > while(1) {
zackc 0:86603687efec 17 * > mouse.move(10, 0);
zackc 0:86603687efec 18 * > wait(2);
zackc 0:86603687efec 19 * > }
zackc 0:86603687efec 20 * > }
zackc 0:86603687efec 21 */
zackc 0:86603687efec 22 class USBMouse : private usbhid {
zackc 0:86603687efec 23 public:
zackc 0:86603687efec 24 /* Constructor: USBMouse
zackc 0:86603687efec 25 * Create a USB Mouse using the mbed USB Device interface
zackc 0:86603687efec 26 */
zackc 0:86603687efec 27 USBMouse();
zackc 0:86603687efec 28
zackc 0:86603687efec 29 /* Function: move
zackc 0:86603687efec 30 * Move the mouse
zackc 0:86603687efec 31 *
zackc 0:86603687efec 32 * Variables:
zackc 0:86603687efec 33 * x - Distance to move in x-axis
zackc 0:86603687efec 34 * y - Distance to move in y-axis
zackc 0:86603687efec 35 */
zackc 0:86603687efec 36 void move(int x, int y);
zackc 0:86603687efec 37
zackc 0:86603687efec 38 /* Function: scroll
zackc 0:86603687efec 39 * Scroll the scroll wheel
zackc 0:86603687efec 40 *
zackc 0:86603687efec 41 * Variables:
zackc 0:86603687efec 42 * z - Distance to scroll scroll wheel
zackc 0:86603687efec 43 */
zackc 0:86603687efec 44 void scroll(int z);
zackc 0:86603687efec 45
zackc 0:86603687efec 46 /* Function: buttons
zackc 0:86603687efec 47 * Set the state of the buttons
zackc 0:86603687efec 48 *
zackc 0:86603687efec 49 * Variables:
zackc 0:86603687efec 50 * left - set the left button as down (1) or up (0)
zackc 0:86603687efec 51 * middle - set the middle button as down (1) or up (0)
zackc 0:86603687efec 52 * right - set the right button as down (1) or up (0)
zackc 0:86603687efec 53 */
zackc 0:86603687efec 54 void buttons(int left, int middle, int right);
zackc 0:86603687efec 55
zackc 0:86603687efec 56 private:
zackc 0:86603687efec 57 int _buttons;
zackc 0:86603687efec 58 };
zackc 0:86603687efec 59
zackc 0:86603687efec 60 #endif