Skip to content

Repository files navigation

Dashboard Keyboard

ESP32 implementation for HID over GATT Keyboard and Mouse (Bluetooth Low Energy). Including serial API for external modules (similar to Adafruit EZKey HID).

Credits

This project is hardly ispired by ESP32 Mouse/Keyboard for BLE HID.

Thank you Asterics and Kolban, I owe you a beer!

Control via stdin (make monitor)

For basic mouse and keyboard testing, some Bluettooh HID reports can be triggered via the keyboard when the make monitor console is running (see Espressiv IDF: https://github.com/espressif/esp-idf).

KeyFunctionDescription
aMouse leftMove mouse left by 30px
sMouse downMove mouse down by 30px
dMouse rightMove mouse right by 30px
wMouse upMove mouse up by 30px
lClick leftMouse click right
rClick rightMouse click left
qType 'y'just for testing keyboard reports

Control via 2nd UART

This interface is primarily used to control mouse / keyboard activities via an external microcontroller. Each command is started with a '$' character, followed by a command name (uppercase letters) and a variable number of parameters. A command must be terminated by a '\n' character (LF, ASCII value 10)!

CommandFunctionParametersDescription
IDGet ID--Prints out the ID of this module (firmware version number)
GPGet BLE pairings--Prints out all paired devices' MAC adress. The order is used for DP as well, starting with 0
DPDelete one pairingnumber of pairing, given as ASCII-characer '0'-'9'Deletes one pairing. The pairing number is determined by the command GP
PMSet pairing mode'0' / '1'Enables (1) or disables (0) discovery/advertising and terminates an exisiting connection if enabled
NAMESet BLE device namename as ASCII stringSet the device name to the given name. Restart required.
MMouse control4 ASCII-integer values (seperated by space or comma)Issue a mouse HID report, parameter description is below
KAKeyboard, release all--Releases all keys & modifiers and sends a HID report
KHKeyboard, key holdkeycode as ASCII integer valueAdds this keycode to the 6 available key slots and sends a HID report.
KRKeyboard, key releasekeycode as ASCII integer valueRemoves this keycode from the 6 available key slots and sends a HID report.
KLKeyboard, set layout/localelocale code as ASCII integer valueSet the keyboard layout to the given locale number (see below), stored permanently. Restarting required.
KWKeyboard write textn BytesWrite a text via the keyboard. Supported are ASCII as well as UTF8 character streams.
KCKeyboard get keycode for character2 BytesGet a corresponding keycode for the given character. 2 Bytes are parsed for UTF8, if there is only a ASCII character, use the first sent byte only.

Mouse command

Command byteParam1Param2Param3Param4
'M'uint8 buttonsint8 Xint8 Yint8 scroll wheel

Mouse buttons are encoded as bit values in the parameter 'buttons' as follows: (1<<0): Left mouse button (1<<1): Right mouse button (1<<2): Middle mouse button

Example: "M 3 10 -10 0"

Due to this encoding in a bitmask, more than one button might be sent in one command. Releasing the mouse buttons is done via setting the corresponding bit postition to zero and sending the mouse command again.

Keyboard layouts/locales

NumberLayout
0x00/0US English (no Unicode)
0x01/1US International
0x02/2German
0x03/3German Mac
0x04/4Canadian (French)
0x05/5Canadian (Multilingual)
0x06/6United Kingdom
0x07/7Finnish
0x08/8French
0x09/9Danish
0x0A/10Norwegian
0x0B/11Swedish
0x0C/12Spanish
0x0D/13Portuguese
0x0E/14Italian
0x0F/15Portuguese (Brazilian)
0x10/16Belgian (French)
0x11/17German (Switzerland)
0x12/18French (Switzerland)
0x13/19Spanish (Latin America)
0x14/20Irish
0x15/21Icelandic
0x16/22Turkish
0x17/23Czech
0x18/24Serbian (Latin only)

Setting a keyboard locale is done with the "KL" command. Changes taking effect after a restart of the ESP32. This is necessary for initializing the HID country code accordingly.

Team

Edimar Calebe Castanho
Edimar Calebe Castanho (Calebe94)

License

All software is covered under MIT License.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

ESP32 implementation for HID over GATT Keyboard (Bluetooth Low Energy).

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages