aboutsummaryrefslogtreecommitdiffstats
path: root/Syster.cpp
blob: 35323470016aa2df12cf13728037df220b0dce35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#include <Kaleidoscope-Syster.h>
#include <Kaleidoscope-Unicode.h>

void systerAction(kaleidoscope::Syster::action_t action, const char *symbol) {
  switch (action) {
  case kaleidoscope::Syster::StartAction:
    Unicode.type(0x2328);
    break;

  case kaleidoscope::Syster::EndAction:
    handleKeyswitchEvent(Key_Backspace, UNKNOWN_KEYSWITCH_LOCATION, IS_PRESSED | INJECTED);
    kaleidoscope::hid::sendKeyboardReport();
    handleKeyswitchEvent(Key_Backspace, UNKNOWN_KEYSWITCH_LOCATION, WAS_PRESSED | INJECTED);
    kaleidoscope::hid::sendKeyboardReport();
    break;

  case kaleidoscope::Syster::SymbolAction:
    Serial.print("systerAction = ");
    Serial.println(symbol);
    if (strcmp(symbol, "coffee") == 0) {
      Unicode.type(0x2615);
    } else if (strcmp(symbol, "=/") == 0) { // =/
      Unicode.type(0x1f615);
    } else if (strcmp(symbol, "=9") == 0) { // =(
      Unicode.type(0x1f641);
    } else if (strcmp(symbol, "=:") == 0) { // =)
      Unicode.type(0x1f642);
    } else if (strcmp(symbol, "9=") == 0) { // (=
      Unicode.type(0x1f643);
    } else if (strcmp(symbol, "=p") == 0) { // =P
      Unicode.type(0x1f61b);
    } else if (strcmp(symbol, "=x") == 0) { // =x
      Unicode.type(0x1f636);
    } else if (strcmp(symbol, "b:") == 0) { // B)
      Unicode.type(0x1f60e);
    } else if (strcmp(symbol, ";:") == 0) { // ;)
      Unicode.type(0x1f609);
    } else if (strcmp(symbol, "1::") == 0) { // 100
      Unicode.type(0x1f4af);
    } else if (strcmp(symbol, "eye") == 0) {
      Unicode.type(0x1f440);
    } else if (strcmp(symbol, "heye") == 0) {
      Unicode.type(0x1f60d);
    } else if (strcmp(symbol, "think") == 0) {
      Unicode.type(0x1f914);
    } else if (strcmp(symbol, "party") == 0) {
      Unicode.type(0x1f389);
    } else if (strcmp(symbol, "flex") == 0) {
      Unicode.type(0x1f4aa);
    } else if (strcmp(symbol, "pray") == 0) {
      Unicode.type(0x1f64f);
    } else if (strcmp(symbol, "kiss") == 0) {
      Unicode.type(0x1f618);
    } else if (strcmp(symbol, "rip") == 0) {
      Unicode.type(0x26b0);
    } else if (strcmp(symbol, "dead") == 0) {
      Unicode.type(0x1f480);
    } else if (strcmp(symbol, "ok") == 0) {
      Unicode.type(0x1f58f);
    } else if (strcmp(symbol, "yes") == 0) {
      Unicode.type(0x1f592);
    } else if (strcmp(symbol, "no") == 0) {
      Unicode.type(0x1f593);
    } else if (strcmp(symbol, "fu") == 0) {
      Unicode.type(0x1f595);
    } else if (strcmp(symbol, "spy") == 0) {
      Unicode.type(0x1f575);
    } else if (strcmp(symbol, "ooo") == 0) {
      Unicode.type(0x1f47b);
    }
    break;
  }
}

const char keyToChar(Key key) {
  switch (key.keyCode) {
  case Key_A.keyCode ... Key_Z.keyCode:
    return 'a' + (key.keyCode - Key_A.keyCode);
  case Key_1.keyCode ... Key_0.keyCode:
    return '1' + (key.keyCode - Key_1.keyCode);
  case Key_Minus.keyCode:
    return '-';
  case Key_Equals.keyCode:
    return '=';
  case Key_LeftBracket.keyCode:
    return '[';
  case Key_RightBracket.keyCode:
    return ']';
  case Key_Backslash.keyCode:
    return '\\';
  case Key_Semicolon.keyCode:
    return ';';
  case Key_Quote.keyCode:
    return '\'';
  case Key_Backtick.keyCode:
    return '`';
  case Key_KeypadLeftParen.keyCode:
    return '(';
  case Key_KeypadRightParen.keyCode:
    return ')';
  case Key_Slash.keyCode:
    return '/';
  }

  return 0;
}