Update whitespace per new astyle rules

pull/389/head
Jesse Vincent 8 years ago
parent a02fc71a3b
commit 88fc70f90a
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -47,7 +47,6 @@ const Key keymaps[][ROWS][COLS] PROGMEM = {
void setup() { void setup() {
Kaleidoscope.setup(KEYMAP_SIZE); Kaleidoscope.setup(KEYMAP_SIZE);
Kaleidoscope.use(&HostOS, &Unicode, NULL); Kaleidoscope.use(&HostOS, &Unicode, NULL);
Unicode.type(0x2328); Unicode.type(0x2328);
} }

@ -23,13 +23,11 @@ namespace KaleidoscopePlugins {
Unicode::Unicode(void) { Unicode::Unicode(void) {
} }
void void Unicode::begin(void) {
Unicode::begin (void) {
::HostOS.begin(); ::HostOS.begin();
} }
void void Unicode::start(void) {
Unicode::start (void) {
switch (::HostOS.os()) { switch (::HostOS.os()) {
case HostOS::LINUX: case HostOS::LINUX:
Keyboard.press(Key_LeftControl.keyCode); Keyboard.press(Key_LeftControl.keyCode);
@ -60,8 +58,7 @@ Unicode::start (void) {
} }
} }
void void Unicode::input(void) {
Unicode::input (void) {
switch (::HostOS.os()) { switch (::HostOS.os()) {
case HostOS::LINUX: case HostOS::LINUX:
case HostOS::WINDOWS: case HostOS::WINDOWS:
@ -75,8 +72,7 @@ Unicode::input (void) {
} }
} }
void void Unicode::end(void) {
Unicode::end (void) {
switch (::HostOS.os()) { switch (::HostOS.os()) {
case HostOS::LINUX: case HostOS::LINUX:
Keyboard.press(Key_Spacebar.keyCode); Keyboard.press(Key_Spacebar.keyCode);
@ -96,20 +92,16 @@ Unicode::end (void) {
} }
} }
void void Unicode::typeCode(uint32_t unicode) {
Unicode::typeCode (uint32_t unicode) {
bool onZeroStart = true; bool onZeroStart = true;
for (int8_t i = 7; i >= 0; i--) { for (int8_t i = 7; i >= 0; i--) {
if (i <= 3) { if (i <= 3) {
onZeroStart = false; onZeroStart = false;
} }
uint8_t digit = ((unicode >> (i * 4)) & 0xF); uint8_t digit = ((unicode >> (i * 4)) & 0xF);
if (digit == 0) { if (digit == 0) {
if (onZeroStart == false) { if (onZeroStart == false) {
Key key = hexToKey(digit); Key key = hexToKey(digit);
input(); input();
Keyboard.press(key.keyCode); Keyboard.press(key.keyCode);
Keyboard.sendReport(); Keyboard.sendReport();
@ -119,60 +111,45 @@ Unicode::typeCode (uint32_t unicode) {
} }
} else { } else {
Key key = hexToKey(digit); Key key = hexToKey(digit);
input(); input();
Keyboard.press(key.keyCode); Keyboard.press(key.keyCode);
Keyboard.sendReport(); Keyboard.sendReport();
input(); input();
Keyboard.release(key.keyCode); Keyboard.release(key.keyCode);
Keyboard.sendReport(); Keyboard.sendReport();
onZeroStart = false; onZeroStart = false;
} }
delay(5); delay(5);
} }
} }
void void Unicode::type(uint32_t unicode) {
Unicode::type (uint32_t unicode) {
start(); start();
typeCode(unicode); typeCode(unicode);
end(); end();
} }
} // namespace KaleidoscopePlugins } // namespace KaleidoscopePlugins
__attribute__((weak)) __attribute__((weak)) Key hexToKey(uint8_t hex) {
Key
hexToKey (uint8_t hex) {
uint8_t m; uint8_t m;
if (hex == 0x0) { if (hex == 0x0) {
return Key_0; return Key_0;
} }
if (hex < 0xA) { if (hex < 0xA) {
m = Key_1.keyCode + (hex - 0x1); m = Key_1.keyCode + (hex - 0x1);
} else { } else {
m = Key_A.keyCode + (hex - 0xA); m = Key_A.keyCode + (hex - 0xA);
} }
return { m, KEY_FLAGS }; return { m, KEY_FLAGS };
} }
__attribute__((weak)) __attribute__((weak)) void unicodeCustomStart(void) {
void
unicodeCustomStart (void) {
} }
__attribute__((weak)) __attribute__((weak)) void unicodeCustomEnd(void) {
void
unicodeCustomEnd (void) {
} }
__attribute__((weak)) __attribute__((weak)) void unicodeCustomInput(void) {
void
unicodeCustomInput (void) {
} }
KaleidoscopePlugins::Unicode Unicode; KaleidoscopePlugins::Unicode Unicode;

Loading…
Cancel
Save