FocusSerial: Implement a `device.reset` command

To make it easier - or in some cases, even possible - to put the keyboard into
programmable mode, we need to be able to initiate a reset from the host side.
For example, ynlike on AVR, where we can send a HUP to the serial port, on GD32,
we need to do it a bit differently: by sending the keyboard a Focus request to
reboot itself.

This implements the command itself.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/1140/head
Gergely Nagy 3 years ago
parent 68bbfd2b9f
commit 8f58179241
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -90,9 +90,13 @@ bool FocusSerial::handleHelp(const char *command,
}
EventHandlerResult FocusSerial::onFocusEvent(const char *command) {
if (handleHelp(command, PSTR("help\nplugins")))
if (handleHelp(command, PSTR("help\ndevice.reset\nplugins")))
return EventHandlerResult::OK;
if (strcmp_P(command, PSTR("device.reset")) == 0) {
Runtime.device().rebootBootloader();
return EventHandlerResult::EVENT_CONSUMED;
}
if (strcmp_P(command, PSTR("plugins")) == 0) {
kaleidoscope::Hooks::onNameQuery();
return EventHandlerResult::EVENT_CONSUMED;

Loading…
Cancel
Save