Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update USBKeyboard.h #684

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 32 additions & 12 deletions libraries/USBHID/src/USBKeyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,6 @@ enum FUNCTION_KEY {
KEY_F10, /* F10 key */
KEY_F11, /* F11 key */
KEY_F12, /* F12 key */
KEY_F13, /* F13 key */
KEY_F14, /* F14 key */
KEY_F15, /* F15 key */
KEY_F16, /* F16 key */
KEY_F17, /* F17 key */
KEY_F18, /* F18 key */
KEY_F19, /* F19 key */
KEY_F20, /* F20 key */
KEY_F21, /* F21 key */
KEY_F22, /* F22 key */
KEY_F23, /* F23 key */
KEY_F24, /* F24 key */

KEY_PRINT_SCREEN, /* Print Screen key */
KEY_SCROLL_LOCK, /* Scroll lock */
Expand Down Expand Up @@ -188,6 +176,37 @@ class USBKeyboard: public USBHID, public ::mbed::Stream {
*/
virtual int _putc(int c);

/**
* Clear the persistent list of keys pressed.
* Currently has a limit of 10 keys.
*/
void emptyButtonBuffer();

/**
* Add a button to the persistent list of keys pressed.
* Currently has a limit of 10 keys.
*
* @param c character to be added to the list.
*/
void press_button(uint8_t c);

/**
* Send a report with all the pressed keys, then release them.
* Currently has a limit of 10 keys.
*
* @returns true if there is no error, false otherwise
*/
bool sendReleaseAll();

/**
* Send a report with the keys in the array, then release them.
* Currently has a limit of 10 keys.
*
* @param keys_array Array containing the keys you want to send.
* @returns true if there is no error, false otherwise
*/
bool sendReleaseKeys(uint8_t* keys_array);

/**
* Control media keys
*
Expand Down Expand Up @@ -231,6 +250,7 @@ class USBKeyboard: public USBHID, public ::mbed::Stream {
//dummy otherwise it doesn't compile (we must define all methods of an abstract class)
virtual int _getc();

uint8_t _keys_pressed[10];
uint8_t _configuration_descriptor[41];
uint8_t _lock_status;
PlatformMutex _mutex;
Expand Down