Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
USBKeyboard Class Reference
USB device: a keyboard. More...
#include <USBKeyboard.h>
Inherits GenericKeyboard, and USBHID.
Public Member Functions | |
| USBKeyboard () | |
| Constructor for a keyboard. | |
| bool | keyCode (uint8_t modifier, uint8_t key) |
| Send all kinds of characters (ctrl + key, ...). | |
| virtual int | _putc (int c) |
| Send a character. | |
| bool | mediaControl (MEDIA_KEY key) |
| Control media keys. | |
Detailed Description
USB device: a keyboard.
Warning: you can only instantiate one instance of a USB device: USBMouse, USBKeyboard, USBAbsMouse, USBMouseKeyboard, or USBAbsMouseKeyboard.
Example:
#include "mbed.h" #include "USBKeyboard.h" USBKeyboard key; int main(void) { while (1) { key.puts("Hello World\r\n"); wait(1); } }
Definition at line 34 of file USBKeyboard.h.
Constructor & Destructor Documentation
| USBKeyboard | ( | ) |
Constructor for a keyboard.
Definition at line 40 of file USBKeyboard.h.
Member Function Documentation
| int _putc | ( | int | c ) | [virtual, inherited] |
Send a character.
- Parameters:
-
c character to be sent
- Returns:
- true if there is no error, false otherwise
Definition at line 10 of file GenericKeyboard.c.
| bool keyCode | ( | uint8_t | modifier, |
| uint8_t | key | ||
| ) | [inherited] |
Send all kinds of characters (ctrl + key, ...).
//To send CTRL + s (save) keyboard.keyCode(CTRL, 's');
- Parameters:
-
modifier bit 0: CTRL, bit 1: SHIFT, bit 2: ALT key character to send
- Returns:
- true if there is no error, false otherwise
Definition at line 14 of file GenericKeyboard.c.
| bool mediaControl | ( | MEDIA_KEY | key ) | [inherited] |
Control media keys.
- Parameters:
-
key media key pressed (KEY_NEXT_TRACK, KEY_PREVIOUS_TRACK, KEY_STOP, KEY_PLAY_PAUSE, KEY_MUTE, KEY_VOLUME_UP, KEY_VOLUME_DOWN)
- Returns:
- true if there is no error, false otherwise
Definition at line 47 of file GenericKeyboard.c.
Generated on Fri Jul 22 2022 22:32:37 by
1.7.2