Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions src/Controllers/UtilityController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ bool UtilityController::handleUsbTyping(std::string sendString) {
display.subMessage("Send to USB", 0);
usbService.sendString(sendString);
ledService.clearLed();

bool submit = confirmationSelector.select("Submit?", "OK: Enter | ESC: Skip");
if (submit) {
usbService.sendKey(0xB0); // KEY_RETURN
}

return true;
}

Expand Down
7 changes: 7 additions & 0 deletions src/Services/UsbService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ void UsbService::sendString(const std::string& text) {
}
}

void UsbService::sendKey(uint8_t key) {
while (millis() - initTime < 1500) {
delay(10);
}
keyboard.write(key);
}

bool UsbService::isReady() const {
return initialized;
}
Expand Down
1 change: 1 addition & 0 deletions src/Services/UsbService.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class UsbService {
void begin();
void end();
void sendString(const std::string& text);
void sendKey(uint8_t key);
void sendChunkedString(const std::string& data, size_t chunkSize=128, unsigned long delayBetweenChunks=50);
bool isReady() const;
void setLayout(const uint8_t* newLayout);
Expand Down