mirror of
https://github.com/0015/ThatProject.git
synced 2026-01-12 17:27:43 +03:00
ESP32 | LVGL8 | Ep 2. Shortcuts for Pull Stack Developer
This commit is contained in:
52
ESP32_LVGL/LVGL8/2_LILYPI_StackOverflow_BLE/MyShortcut.cpp
Normal file
52
ESP32_LVGL/LVGL8/2_LILYPI_StackOverflow_BLE/MyShortcut.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
#include <Arduino.h>
|
||||
#include <BleKeyboard.h>
|
||||
#include "MyShortcut.h"
|
||||
typedef uint8_t MediaKeyReport[2];
|
||||
|
||||
MyShortcut::MyShortcut(BleKeyboard * _bleKeyboard, int caseId)
|
||||
{
|
||||
bleKeyboard = _bleKeyboard;
|
||||
shortcutId = caseId;
|
||||
}
|
||||
|
||||
void MyShortcut::RelaseAllkey(){
|
||||
bleKeyboard->releaseAll();
|
||||
}
|
||||
|
||||
void MyShortcut::Action(){
|
||||
switch(shortcutId){
|
||||
//Execute shortcut
|
||||
case 0:
|
||||
bleKeyboard->press(KEY_LEFT_SHIFT);
|
||||
bleKeyboard->press(KEY_LEFT_ALT);
|
||||
bleKeyboard->press('c');
|
||||
break;
|
||||
|
||||
//Print String with return
|
||||
case 1:
|
||||
bleKeyboard->print("www.stackoverflow.com");
|
||||
delay(500);
|
||||
bleKeyboard->write(KEY_RETURN);
|
||||
break;
|
||||
|
||||
//Select All
|
||||
case 2:
|
||||
bleKeyboard->press(KEY_LEFT_CTRL);
|
||||
bleKeyboard->press('a');
|
||||
break;
|
||||
|
||||
//Copy
|
||||
case 3:
|
||||
bleKeyboard->press(KEY_LEFT_CTRL);
|
||||
bleKeyboard->press('c');
|
||||
break;
|
||||
|
||||
//Paste
|
||||
case 4:
|
||||
bleKeyboard->press(KEY_LEFT_CTRL);
|
||||
bleKeyboard->press('v');
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user