Port to new hid facade

pull/389/head
Jesse Vincent 7 years ago
parent 6cf2b82dd3
commit 189c2781dc
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -17,6 +17,7 @@
*/ */
#include <Kaleidoscope-Unicode.h> #include <Kaleidoscope-Unicode.h>
#include "kaleidoscope/hid.h"
namespace kaleidoscope { namespace kaleidoscope {
@ -30,27 +31,27 @@ void Unicode::begin(void) {
void Unicode::start(void) { void Unicode::start(void) {
switch (::HostOS.os()) { switch (::HostOS.os()) {
case hostos::LINUX: case hostos::LINUX:
Keyboard.press(Key_LeftControl.keyCode); hid::pressRawKey(Key_LeftControl);
Keyboard.press(Key_LeftShift.keyCode); hid::pressRawKey(Key_LeftShift);
Keyboard.press(Key_U.keyCode); hid::pressRawKey(Key_U);
Keyboard.sendReport(); hid::sendKeyboardReport();
Keyboard.release(Key_LeftControl.keyCode); hid::releaseRawKey(Key_LeftControl);
Keyboard.release(Key_LeftShift.keyCode); hid::releaseRawKey(Key_LeftShift);
Keyboard.release(Key_U.keyCode); hid::releaseRawKey(Key_U);
Keyboard.sendReport(); hid::sendKeyboardReport();
break; break;
case hostos::WINDOWS: case hostos::WINDOWS:
Keyboard.press(Key_RightAlt.keyCode); hid::pressRawKey(Key_RightAlt);
Keyboard.sendReport(); hid::sendKeyboardReport();
Keyboard.release(Key_RightAlt.keyCode); hid::releaseRawKey(Key_RightAlt);
Keyboard.sendReport(); hid::sendKeyboardReport();
Keyboard.press(Key_U.keyCode); hid::pressRawKey(Key_U);
Keyboard.sendReport(); hid::sendKeyboardReport();
Keyboard.release(Key_U.keyCode); hid::releaseRawKey(Key_U);
Keyboard.sendReport(); hid::sendKeyboardReport();
break; break;
case hostos::OSX: case hostos::OSX:
Keyboard.press(Key_LeftAlt.keyCode); hid::pressRawKey(Key_LeftAlt);
break; break;
default: default:
unicodeCustomStart(); unicodeCustomStart();
@ -64,7 +65,7 @@ void Unicode::input(void) {
case hostos::WINDOWS: case hostos::WINDOWS:
break; break;
case hostos::OSX: case hostos::OSX:
Keyboard.press(Key_LeftAlt.keyCode); hid::pressRawKey(Key_LeftAlt);
break; break;
default: default:
unicodeCustomInput(); unicodeCustomInput();
@ -75,16 +76,16 @@ void Unicode::input(void) {
void Unicode::end(void) { void Unicode::end(void) {
switch (::HostOS.os()) { switch (::HostOS.os()) {
case hostos::LINUX: case hostos::LINUX:
Keyboard.press(Key_Spacebar.keyCode); hid::pressRawKey(Key_Spacebar);
Keyboard.sendReport(); hid::sendKeyboardReport();
Keyboard.release(Key_Spacebar.keyCode); hid::releaseRawKey(Key_Spacebar);
Keyboard.sendReport(); hid::sendKeyboardReport();
break; break;
case hostos::WINDOWS: case hostos::WINDOWS:
break; break;
case hostos::OSX: case hostos::OSX:
Keyboard.release(Key_LeftAlt.keyCode); hid::releaseRawKey(Key_LeftAlt);
Keyboard.sendReport(); hid::sendKeyboardReport();
break; break;
default: default:
unicodeCustomEnd(); unicodeCustomEnd();
@ -103,20 +104,20 @@ void Unicode::typeCode(uint32_t unicode) {
if (on_zero_start == false) { if (on_zero_start == false) {
Key key = hexToKey(digit); Key key = hexToKey(digit);
input(); input();
Keyboard.press(key.keyCode); hid::pressRawKey(key);
Keyboard.sendReport(); hid::sendKeyboardReport();
input(); input();
Keyboard.release(key.keyCode); hid::releaseRawKey(key);
Keyboard.sendReport(); hid::sendKeyboardReport();
} }
} else { } else {
Key key = hexToKey(digit); Key key = hexToKey(digit);
input(); input();
Keyboard.press(key.keyCode); hid::pressRawKey(key);
Keyboard.sendReport(); hid::sendKeyboardReport();
input(); input();
Keyboard.release(key.keyCode); hid::releaseRawKey(key);
Keyboard.sendReport(); hid::sendKeyboardReport();
on_zero_start = false; on_zero_start = false;
} }
delay(5); delay(5);

Loading…
Cancel
Save