diff options
| author | Seth <fl3tching101@gmail.com> | 2021-09-11 00:32:29 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-11 00:32:29 -0700 |
| commit | 35bff470f73e5041f4e969f5dae5f60d4c1ea3e0 (patch) | |
| tree | f70195740edde70fe714102fa81398d390ab22a2 | |
| parent | 5f941910755907ea300a526634c1269823477e7b (diff) | |
| download | qmk_firmware-35bff470f73e5041f4e969f5dae5f60d4c1ea3e0.tar.gz qmk_firmware-35bff470f73e5041f4e969f5dae5f60d4c1ea3e0.zip | |
[Keyboard] Update rocketboard_16 with *most* of its final features (#12537)
| -rw-r--r-- | keyboards/rocketboard_16/config.h | 2 | ||||
| -rw-r--r-- | keyboards/rocketboard_16/custom_font.h | 244 | ||||
| -rw-r--r-- | keyboards/rocketboard_16/keycode_lookup.c | 407 | ||||
| -rw-r--r-- | keyboards/rocketboard_16/keycode_lookup.h | 29 | ||||
| -rw-r--r-- | keyboards/rocketboard_16/keymaps/default/keymap.c | 368 | ||||
| -rw-r--r-- | keyboards/rocketboard_16/keymaps/via/keymap.c | 368 | ||||
| -rw-r--r-- | keyboards/rocketboard_16/rules.mk | 17 |
7 files changed, 1363 insertions, 72 deletions
diff --git a/keyboards/rocketboard_16/config.h b/keyboards/rocketboard_16/config.h index a82514e0b..cd99fcc73 100644 --- a/keyboards/rocketboard_16/config.h +++ b/keyboards/rocketboard_16/config.h | |||
| @@ -45,12 +45,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 45 | #define RGBLIGHT_ANIMATIONS | 45 | #define RGBLIGHT_ANIMATIONS |
| 46 | #define RGB_DI_PIN A4 | 46 | #define RGB_DI_PIN A4 |
| 47 | #define RGBLED_NUM 16 | 47 | #define RGBLED_NUM 16 |
| 48 | #define RGBLIGHT_LIMIT_VAL 128 | ||
| 49 | #define RGBLIGHT_VAL_STEP 8 | 48 | #define RGBLIGHT_VAL_STEP 8 |
| 50 | #define RGBLIGHT_SLEEP | 49 | #define RGBLIGHT_SLEEP |
| 51 | 50 | ||
| 52 | // OLED stuff | 51 | // OLED stuff |
| 53 | #define OLED_DISPLAY_128X64 | 52 | #define OLED_DISPLAY_128X64 |
| 53 | #define OLED_FONT_H "custom_font.h" | ||
| 54 | 54 | ||
| 55 | // Allows for rotary encoder volume control | 55 | // Allows for rotary encoder volume control |
| 56 | #define TAP_CODE_DELAY 20 | 56 | #define TAP_CODE_DELAY 20 |
diff --git a/keyboards/rocketboard_16/custom_font.h b/keyboards/rocketboard_16/custom_font.h new file mode 100644 index 000000000..1f41f25b7 --- /dev/null +++ b/keyboards/rocketboard_16/custom_font.h | |||
| @@ -0,0 +1,244 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2021 Seth Bonner <fl3tching101@gmail.com> | ||
| 3 | This program is free software: you can redistribute it and/or modify | ||
| 4 | it under the terms of the GNU General Public License as published by | ||
| 5 | the Free Software Foundation, either version 2 of the License, or | ||
| 6 | (at your option) any later version. | ||
| 7 | This program is distributed in the hope that it will be useful, | ||
| 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 10 | GNU General Public License for more details. | ||
| 11 | You should have received a copy of the GNU General Public License | ||
| 12 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 13 | */ | ||
| 14 | |||
| 15 | #pragma once | ||
| 16 | |||
| 17 | #include "progmem.h" | ||
| 18 | |||
| 19 | static const unsigned char PROGMEM font[] = { | ||
| 20 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 21 | 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, | ||
| 22 | 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, | ||
| 23 | 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00, | ||
| 24 | 0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00, | ||
| 25 | 0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00, | ||
| 26 | 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, | ||
| 27 | 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, | ||
| 28 | 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, | ||
| 29 | 0x00, 0x18, 0x24, 0x18, 0x00, 0x00, | ||
| 30 | 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00, | ||
| 31 | 0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00, | ||
| 32 | 0x26, 0x29, 0x79, 0x29, 0x26, 0x00, | ||
| 33 | 0x40, 0x7F, 0x05, 0x05, 0x07, 0x00, | ||
| 34 | 0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00, | ||
| 35 | 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00, | ||
| 36 | 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00, | ||
| 37 | 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00, | ||
| 38 | 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, | ||
| 39 | 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00, | ||
| 40 | 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00, | ||
| 41 | 0x00, 0x66, 0x89, 0x95, 0x6A, 0x00, | ||
| 42 | 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, | ||
| 43 | 0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00, | ||
| 44 | 0x08, 0x04, 0x7E, 0x04, 0x08, 0x00, | ||
| 45 | 0x10, 0x20, 0x7E, 0x20, 0x10, 0x00, | ||
| 46 | 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00, | ||
| 47 | 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00, | ||
| 48 | 0x1E, 0x10, 0x10, 0x10, 0x10, 0x00, | ||
| 49 | 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00, | ||
| 50 | 0x30, 0x38, 0x3E, 0x38, 0x30, 0x00, | ||
| 51 | 0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00, | ||
| 52 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 53 | 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, | ||
| 54 | 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, | ||
| 55 | 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, | ||
| 56 | 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00, | ||
| 57 | 0x23, 0x13, 0x08, 0x64, 0x62, 0x00, | ||
| 58 | 0x36, 0x49, 0x56, 0x20, 0x50, 0x00, | ||
| 59 | 0x00, 0x08, 0x07, 0x03, 0x00, 0x00, | ||
| 60 | 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, | ||
| 61 | 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, | ||
| 62 | 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00, | ||
| 63 | 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, | ||
| 64 | 0x00, 0x80, 0x70, 0x30, 0x00, 0x00, | ||
| 65 | 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, | ||
| 66 | 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, | ||
| 67 | 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, | ||
| 68 | 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, | ||
| 69 | 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, | ||
| 70 | 0x72, 0x49, 0x49, 0x49, 0x46, 0x00, | ||
| 71 | 0x21, 0x41, 0x49, 0x4D, 0x33, 0x00, | ||
| 72 | 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, | ||
| 73 | 0x27, 0x45, 0x45, 0x45, 0x39, 0x00, | ||
| 74 | 0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00, | ||
| 75 | 0x41, 0x21, 0x11, 0x09, 0x07, 0x00, | ||
| 76 | 0x36, 0x49, 0x49, 0x49, 0x36, 0x00, | ||
| 77 | 0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, | ||
| 78 | 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, | ||
| 79 | 0x00, 0x40, 0x34, 0x00, 0x00, 0x00, | ||
| 80 | 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, | ||
| 81 | 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, | ||
| 82 | 0x00, 0x41, 0x22, 0x14, 0x08, 0x00, | ||
| 83 | 0x02, 0x01, 0x59, 0x09, 0x06, 0x00, | ||
| 84 | 0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00, | ||
| 85 | 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, | ||
| 86 | 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, | ||
| 87 | 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, | ||
| 88 | 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, | ||
| 89 | 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, | ||
| 90 | 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, | ||
| 91 | 0x3E, 0x41, 0x41, 0x51, 0x73, 0x00, | ||
| 92 | 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, | ||
| 93 | 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, | ||
| 94 | 0x20, 0x40, 0x41, 0x3F, 0x01, 0x00, | ||
| 95 | 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, | ||
| 96 | 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, | ||
| 97 | 0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00, | ||
| 98 | 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, | ||
| 99 | 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, | ||
| 100 | 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, | ||
| 101 | 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, | ||
| 102 | 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, | ||
| 103 | 0x26, 0x49, 0x49, 0x49, 0x32, 0x00, | ||
| 104 | 0x03, 0x01, 0x7F, 0x01, 0x03, 0x00, | ||
| 105 | 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, | ||
| 106 | 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, | ||
| 107 | 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00, | ||
| 108 | 0x63, 0x14, 0x08, 0x14, 0x63, 0x00, | ||
| 109 | 0x03, 0x04, 0x78, 0x04, 0x03, 0x00, | ||
| 110 | 0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, | ||
| 111 | 0x00, 0x7F, 0x41, 0x41, 0x41, 0x00, | ||
| 112 | 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, | ||
| 113 | 0x00, 0x41, 0x41, 0x41, 0x7F, 0x00, | ||
| 114 | 0x04, 0x02, 0x01, 0x02, 0x04, 0x00, | ||
| 115 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, | ||
| 116 | 0x00, 0x03, 0x07, 0x08, 0x00, 0x00, | ||
| 117 | 0x20, 0x54, 0x54, 0x78, 0x40, 0x00, | ||
| 118 | 0x7F, 0x28, 0x44, 0x44, 0x38, 0x00, | ||
| 119 | 0x38, 0x44, 0x44, 0x44, 0x28, 0x00, | ||
| 120 | 0x38, 0x44, 0x44, 0x28, 0x7F, 0x00, | ||
| 121 | 0x38, 0x54, 0x54, 0x54, 0x18, 0x00, | ||
| 122 | 0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, | ||
| 123 | 0x18, 0x24, 0x24, 0x1C, 0x78, 0x00, | ||
| 124 | 0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, | ||
| 125 | 0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, | ||
| 126 | 0x20, 0x40, 0x40, 0x3D, 0x00, 0x00, | ||
| 127 | 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, | ||
| 128 | 0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, | ||
| 129 | 0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, | ||
| 130 | 0x7C, 0x08, 0x04, 0x04, 0x78, 0x00, | ||
| 131 | 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, | ||
| 132 | 0xFC, 0x18, 0x24, 0x24, 0x18, 0x00, | ||
| 133 | 0x18, 0x24, 0x24, 0x18, 0xFC, 0x00, | ||
| 134 | 0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, | ||
| 135 | 0x48, 0x54, 0x54, 0x54, 0x24, 0x00, | ||
| 136 | 0x04, 0x04, 0x3F, 0x44, 0x24, 0x00, | ||
| 137 | 0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00, | ||
| 138 | 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, | ||
| 139 | 0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00, | ||
| 140 | 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, | ||
| 141 | 0x4C, 0x10, 0x10, 0x10, 0x7C, 0x00, | ||
| 142 | 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, | ||
| 143 | 0x00, 0x08, 0x36, 0x41, 0x00, 0x00, | ||
| 144 | 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, | ||
| 145 | 0x00, 0x41, 0x36, 0x08, 0x00, 0x00, | ||
| 146 | 0x02, 0x01, 0x02, 0x04, 0x02, 0x00, | ||
| 147 | 0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00, | ||
| 148 | 0x02, 0x1E, 0xF2, 0x86, 0x84, 0x8C, | ||
| 149 | 0x98, 0xD0, 0x70, 0x60, 0x40, 0x60, | ||
| 150 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
| 151 | 0x20, 0x20, 0x60, 0x40, 0x40, 0x40, | ||
| 152 | 0x40, 0x40, 0x80, 0x80, 0x00, 0x00, | ||
| 153 | 0x10, 0x10, 0x10, 0x34, 0x24, 0x24, | ||
| 154 | 0x00, 0x44, 0x44, 0x48, 0x08, 0x08, | ||
| 155 | 0x10, 0x14, 0x14, 0x20, 0x24, 0x24, | ||
| 156 | 0x00, 0x0C, 0x0C, 0x70, 0x70, 0x70, | ||
| 157 | 0x00, 0x1E, 0x1E, 0x1E, 0x1E, 0x00, | ||
| 158 | 0x00, 0x60, 0x60, 0x06, 0x06, 0x00, | ||
| 159 | 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, | ||
| 160 | 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, | ||
| 161 | 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, | ||
| 162 | 0x00, 0x83, 0x83, 0x80, 0x18, 0x18, | ||
| 163 | 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, | ||
| 164 | 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, | ||
| 165 | 0x38, 0x38, 0x38, 0x00, 0x00, 0x00, | ||
| 166 | 0x00, 0x00, 0x0E, 0x0E, 0x0E, 0x00, | ||
| 167 | 0x00, 0x00, 0x00, 0xE0, 0xE0, 0xE0, | ||
| 168 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 169 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 170 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 171 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 172 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 173 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 174 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 175 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 176 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 177 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 178 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 179 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 180 | 0x7E, 0x81, 0x81, 0x81, 0x00, 0x00, | ||
| 181 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 182 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, | ||
| 183 | 0x24, 0x26, 0x42, 0x42, 0x44, 0x24, | ||
| 184 | 0x18, 0x00, 0x00, 0x81, 0x81, 0x42, | ||
| 185 | 0x66, 0x18, 0x00, 0x00, 0x00, 0x00, | ||
| 186 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 187 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 188 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 189 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 190 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 191 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 192 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 193 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 194 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 195 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 196 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 197 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 198 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 199 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 200 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 201 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 202 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 203 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 204 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 205 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 206 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 207 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 208 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 209 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 210 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 211 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 212 | 0x40, 0x78, 0x4F, 0x61, 0x21, 0x31, | ||
| 213 | 0x19, 0x0B, 0x0E, 0x06, 0x02, 0x06, | ||
| 214 | 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, | ||
| 215 | 0x04, 0x04, 0x06, 0x02, 0x02, 0x02, | ||
| 216 | 0x02, 0x02, 0x01, 0x01, 0x00, 0x00, | ||
| 217 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 218 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 219 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 220 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 221 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 222 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 223 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 224 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 225 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 226 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 227 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 228 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 229 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 230 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 231 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 232 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 233 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 234 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 235 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 236 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 237 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 238 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 239 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 240 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 241 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 242 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 243 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 244 | }; | ||
diff --git a/keyboards/rocketboard_16/keycode_lookup.c b/keyboards/rocketboard_16/keycode_lookup.c new file mode 100644 index 000000000..9e1c5f92a --- /dev/null +++ b/keyboards/rocketboard_16/keycode_lookup.c | |||
| @@ -0,0 +1,407 @@ | |||
| 1 | /* Copyright 2021 Seth Bonner <fl3tching101@gmail.com> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "keycode_lookup.h" | ||
| 18 | #include "print.h" | ||
| 19 | #include "via.h" | ||
| 20 | |||
| 21 | #define num_keycodes (sizeof(lookup_table)/sizeof(lookup_table[0])) | ||
| 22 | static char UNKNOWN_KEYCODE[] = "UNKNOWN"; | ||
| 23 | |||
| 24 | int cmp(const void *v1, const void *v2) | ||
| 25 | { | ||
| 26 | const lookup_table_t *c1 = v1; | ||
| 27 | const lookup_table_t *c2 = v2; | ||
| 28 | |||
| 29 | return (c1->keycode - c2->keycode); | ||
| 30 | } | ||
| 31 | |||
| 32 | /* | ||
| 33 | Returns a pointer to a string containing the string describing the keycode, such as those found here: | ||
| 34 | https://beta.docs.qmk.fm/using-qmk/simple-keycodes/keycodes | ||
| 35 | |||
| 36 | Will return a string that says "UNKNOWN" if the keycode cannot be found. | ||
| 37 | */ | ||
| 38 | char* translate_keycode_to_string(uint16_t code) | ||
| 39 | { | ||
| 40 | lookup_table_t * result = NULL; | ||
| 41 | lookup_table_t target = {.key_string = "", .keycode = code}; | ||
| 42 | char * return_p; | ||
| 43 | |||
| 44 | result = bsearch(&target, lookup_table, num_keycodes, sizeof(lookup_table_t), cmp); | ||
| 45 | |||
| 46 | if(result != NULL) | ||
| 47 | { | ||
| 48 | return_p = result->key_string; | ||
| 49 | } | ||
| 50 | else | ||
| 51 | { | ||
| 52 | return_p = UNKNOWN_KEYCODE; | ||
| 53 | } | ||
| 54 | |||
| 55 | return (return_p); | ||
| 56 | } | ||
| 57 | |||
| 58 | lookup_table_t lookup_table[366] = | ||
| 59 | { | ||
| 60 | {"KC_NO", KC_NO}, | ||
| 61 | {"KC_TRNS", KC_TRNS}, | ||
| 62 | {"KC_A", KC_A}, | ||
| 63 | {"KC_B", KC_B}, | ||
| 64 | {"KC_C", KC_C}, | ||
| 65 | {"KC_D", KC_D}, | ||
| 66 | {"KC_E", KC_E}, | ||
| 67 | {"KC_F", KC_F}, | ||
| 68 | {"KC_G", KC_G}, | ||
| 69 | {"KC_H", KC_H}, | ||
| 70 | {"KC_I", KC_I}, | ||
| 71 | {"KC_J", KC_J}, | ||
| 72 | {"KC_K", KC_K}, | ||
| 73 | {"KC_L", KC_L}, | ||
| 74 | {"KC_M", KC_M}, | ||
| 75 | {"KC_N", KC_N}, | ||
| 76 | {"KC_O", KC_O}, | ||
| 77 | {"KC_P", KC_P}, | ||
| 78 | {"KC_Q", KC_Q}, | ||
| 79 | {"KC_R", KC_R}, | ||
| 80 | {"KC_S", KC_S}, | ||
| 81 | {"KC_T", KC_T}, | ||
| 82 | {"KC_U", KC_U}, | ||
| 83 | {"KC_V", KC_V}, | ||
| 84 | {"KC_W", KC_W}, | ||
| 85 | {"KC_X", KC_X}, | ||
| 86 | {"KC_Y", KC_Y}, | ||
| 87 | {"KC_Z", KC_Z}, | ||
| 88 | {"KC_1", KC_1}, | ||
| 89 | {"KC_2", KC_2}, | ||
| 90 | {"KC_3", KC_3}, | ||
| 91 | {"KC_4", KC_4}, | ||
| 92 | {"KC_5", KC_5}, | ||
| 93 | {"KC_6", KC_6}, | ||
| 94 | {"KC_7", KC_7}, | ||
| 95 | {"KC_8", KC_8}, | ||
| 96 | {"KC_9", KC_9}, | ||
| 97 | {"KC_0", KC_0}, | ||
| 98 | {"KC_ENT", KC_ENT}, | ||
| 99 | {"KC_ESC", KC_ESC}, | ||
| 100 | {"KC_BSPC", KC_BSPC}, | ||
| 101 | {"KC_TAB", KC_TAB}, | ||
| 102 | {"KC_SPC", KC_SPC}, | ||
| 103 | {"KC_MINS", KC_MINS}, | ||
| 104 | {"KC_EQL", KC_EQL}, | ||
| 105 | {"KC_LBRC", KC_LBRC}, | ||
| 106 | {"KC_RBRC", KC_RBRC}, | ||
| 107 | {"KC_BSLS", KC_BSLS}, | ||
| 108 | {"KC_NUHS", KC_NUHS}, | ||
| 109 | {"KC_SCLN", KC_SCLN}, | ||
| 110 | {"KC_QUOT", KC_QUOT}, | ||
| 111 | {"KC_GRV", KC_GRV}, | ||
| 112 | {"KC_ZKHK", KC_ZKHK}, | ||
| 113 | {"KC_COMM", KC_COMM}, | ||
| 114 | {"KC_DOT", KC_DOT}, | ||
| 115 | {"KC_SLSH", KC_SLSH}, | ||
| 116 | {"KC_CAPS", KC_CAPS}, | ||
| 117 | {"KC_F1", KC_F1}, | ||
| 118 | {"KC_F2", KC_F2}, | ||
| 119 | {"KC_F3", KC_F3}, | ||
| 120 | {"KC_F4", KC_F4}, | ||
| 121 | {"KC_F5", KC_F5}, | ||
| 122 | {"KC_F6", KC_F6}, | ||
| 123 | {"KC_F7", KC_F7}, | ||
| 124 | {"KC_F8", KC_F8}, | ||
| 125 | {"KC_F9", KC_F9}, | ||
| 126 | {"KC_F10", KC_F10}, | ||
| 127 | {"KC_F11", KC_F11}, | ||
| 128 | {"KC_F12", KC_F12}, | ||
| 129 | {"KC_PSCR", KC_PSCR}, | ||
| 130 | {"KC_SLCK", KC_SLCK}, | ||
| 131 | {"KC_PAUS", KC_PAUS}, | ||
| 132 | {"KC_INS", KC_INS}, | ||
| 133 | {"KC_HOME", KC_HOME}, | ||
| 134 | {"KC_PGUP", KC_PGUP}, | ||
| 135 | {"KC_DEL", KC_DEL}, | ||
| 136 | {"KC_END", KC_END}, | ||
| 137 | {"KC_PGDN", KC_PGDN}, | ||
| 138 | {"KC_RGHT", KC_RGHT}, | ||
| 139 | {"KC_LEFT", KC_LEFT}, | ||
| 140 | {"KC_DOWN", KC_DOWN}, | ||
| 141 | {"KC_UP", KC_UP}, | ||
| 142 | {"KC_NLCK", KC_NLCK}, | ||
| 143 | {"KC_PSLS", KC_PSLS}, | ||
| 144 | {"KC_PAST", KC_PAST}, | ||
| 145 | {"KC_PMNS", KC_PMNS}, | ||
| 146 | {"KC_PPLS", KC_PPLS}, | ||
| 147 | {"KC_PENT", KC_PENT}, | ||
| 148 | {"KC_P1", KC_P1}, | ||
| 149 | {"KC_P2", KC_P2}, | ||
| 150 | {"KC_P3", KC_P3}, | ||
| 151 | {"KC_P4", KC_P4}, | ||
| 152 | {"KC_P5", KC_P5}, | ||
| 153 | {"KC_P6", KC_P6}, | ||
| 154 | {"KC_P7", KC_P7}, | ||
| 155 | {"KC_P8", KC_P8}, | ||
| 156 | {"KC_P9", KC_P9}, | ||
| 157 | {"KC_P0", KC_P0}, | ||
| 158 | {"KC_PDOT", KC_PDOT}, | ||
| 159 | {"KC_NUBS", KC_NUBS}, | ||
| 160 | {"KC_APP", KC_APP}, | ||
| 161 | {"KC_POWER", KC_POWER}, | ||
| 162 | {"KC_PEQL", KC_PEQL}, | ||
| 163 | {"KC_F13", KC_F13}, | ||
| 164 | {"KC_F14", KC_F14}, | ||
| 165 | {"KC_F15", KC_F15}, | ||
| 166 | {"KC_F16", KC_F16}, | ||
| 167 | {"KC_F17", KC_F17}, | ||
| 168 | {"KC_F18", KC_F18}, | ||
| 169 | {"KC_F19", KC_F19}, | ||
| 170 | {"KC_F20", KC_F20}, | ||
| 171 | {"KC_F21", KC_F21}, | ||
| 172 | {"KC_F22", KC_F22}, | ||
| 173 | {"KC_F23", KC_F23}, | ||
| 174 | {"KC_F24", KC_F24}, | ||
| 175 | {"KC_EXECUTE", KC_EXECUTE}, | ||
| 176 | {"KC_HELP", KC_HELP}, | ||
| 177 | {"KC_MENU", KC_MENU}, | ||
| 178 | {"KC_SELECT", KC_SELECT}, | ||
| 179 | {"KC_STOP", KC_STOP}, | ||
| 180 | {"KC_AGAIN", KC_AGAIN}, | ||
| 181 | {"KC_UNDO", KC_UNDO}, | ||
| 182 | {"KC_CUT", KC_CUT}, | ||
| 183 | {"KC_COPY", KC_COPY}, | ||
| 184 | {"KC_PASTE", KC_PASTE}, | ||
| 185 | {"KC_FIND", KC_FIND}, | ||
| 186 | {"KC_LCAP", KC_LCAP}, | ||
| 187 | {"KC_LNUM", KC_LNUM}, | ||
| 188 | {"KC_LSCR", KC_LSCR}, | ||
| 189 | {"KC_PCMM", KC_PCMM}, | ||
| 190 | {"KC_KP_EQUAL_AS400", KC_KP_EQUAL_AS400}, | ||
| 191 | {"KC_RO", KC_RO}, | ||
| 192 | {"KC_KANA", KC_KANA}, | ||
| 193 | {"KC_JYEN", KC_JYEN}, | ||
| 194 | {"KC_HENK", KC_HENK}, | ||
| 195 | {"KC_MHEN", KC_MHEN}, | ||
| 196 | {"KC_INT6", KC_INT6}, | ||
| 197 | {"KC_INT7", KC_INT7}, | ||
| 198 | {"KC_INT8", KC_INT8}, | ||
| 199 | {"KC_INT9", KC_INT9}, | ||
| 200 | {"KC_HAEN", KC_HAEN}, | ||
| 201 | {"KC_HANJ", KC_HANJ}, | ||
| 202 | {"KC_LANG3", KC_LANG3}, | ||
| 203 | {"KC_LANG4", KC_LANG4}, | ||
| 204 | {"KC_LANG5", KC_LANG5}, | ||
| 205 | {"KC_LANG6", KC_LANG6}, | ||
| 206 | {"KC_LANG7", KC_LANG7}, | ||
| 207 | {"KC_LANG8", KC_LANG8}, | ||
| 208 | {"KC_LANG9", KC_LANG9}, | ||
| 209 | {"KC_ERAS", KC_ERAS}, | ||
| 210 | {"KC_SYSREQ", KC_SYSREQ}, | ||
| 211 | {"KC_CANCEL", KC_CANCEL}, | ||
| 212 | {"KC_CLR", KC_CLR}, | ||
| 213 | {"KC_CLEAR", KC_CLEAR}, | ||
| 214 | {"KC_PRIOR", KC_PRIOR}, | ||
| 215 | {"KC_OUT", KC_OUT}, | ||
| 216 | {"KC_OPER", KC_OPER}, | ||
| 217 | {"KC_CLEAR_AGAIN", KC_CLEAR_AGAIN}, | ||
| 218 | {"KC_CRSEL", KC_CRSEL}, | ||
| 219 | {"KC_EXSEL", KC_EXSEL}, | ||
| 220 | {"KC_PWR", KC_PWR}, | ||
| 221 | {"KC_SLEP", KC_SLEP}, | ||
| 222 | {"KC_WAKE", KC_WAKE}, | ||
| 223 | {"KC_MUTE", KC_MUTE}, | ||
| 224 | {"KC_VOLU", KC_VOLU}, | ||
| 225 | {"KC_VOLD", KC_VOLD}, | ||
| 226 | {"KC_MNXT", KC_MNXT}, | ||
| 227 | {"KC_MPRV", KC_MPRV}, | ||
| 228 | {"KC_MSTP", KC_MSTP}, | ||
| 229 | {"KC_MPLY", KC_MPLY}, | ||
| 230 | {"KC_MSEL", KC_MSEL}, | ||
| 231 | {"KC_EJCT", KC_EJCT}, | ||
| 232 | {"KC_MAIL", KC_MAIL}, | ||
| 233 | {"KC_CALC", KC_CALC}, | ||
| 234 | {"KC_MYCM", KC_MYCM}, | ||
| 235 | {"KC_WWW_SEARCH", KC_WWW_SEARCH}, | ||
| 236 | {"KC_WWW_HOME", KC_WWW_HOME}, | ||
| 237 | {"KC_WWW_BACK", KC_WWW_BACK}, | ||
| 238 | {"KC_WWW_FORWARD", KC_WWW_FORWARD}, | ||
| 239 | {"KC_WWW_STOP", KC_WWW_STOP}, | ||
| 240 | {"KC_WWW_REFRESH", KC_WWW_REFRESH}, | ||
| 241 | {"KC_WWW_FAVORITES", KC_WWW_FAVORITES}, | ||
| 242 | {"KC_MFFD", KC_MFFD}, | ||
| 243 | {"KC_MRWD", KC_MRWD}, | ||
| 244 | {"KC_BRIU", KC_BRIU}, | ||
| 245 | {"KC_BRID", KC_BRID}, | ||
| 246 | {"KC_FN0", KC_FN0}, | ||
| 247 | {"KC_FN1", KC_FN1}, | ||
| 248 | {"KC_FN2", KC_FN2}, | ||
| 249 | {"KC_FN3", KC_FN3}, | ||
| 250 | {"KC_FN4", KC_FN4}, | ||
| 251 | {"KC_FN5", KC_FN5}, | ||
| 252 | {"KC_FN6", KC_FN6}, | ||
| 253 | {"KC_FN7", KC_FN7}, | ||
| 254 | {"KC_FN8", KC_FN8}, | ||
| 255 | {"KC_FN9", KC_FN9}, | ||
| 256 | {"KC_FN10", KC_FN10}, | ||
| 257 | {"KC_FN11", KC_FN11}, | ||
| 258 | {"KC_FN12", KC_FN12}, | ||
| 259 | {"KC_FN13", KC_FN13}, | ||
| 260 | {"KC_FN14", KC_FN14}, | ||
| 261 | {"KC_FN15", KC_FN15}, | ||
| 262 | {"KC_FN16", KC_FN16}, | ||
| 263 | {"KC_FN17", KC_FN17}, | ||
| 264 | {"KC_FN18", KC_FN18}, | ||
| 265 | {"KC_FN19", KC_FN19}, | ||
| 266 | {"KC_FN20", KC_FN20}, | ||
| 267 | {"KC_FN21", KC_FN21}, | ||
| 268 | {"KC_FN22", KC_FN22}, | ||
| 269 | {"KC_FN23", KC_FN23}, | ||
| 270 | {"KC_FN24", KC_FN24}, | ||
| 271 | {"KC_FN25", KC_FN25}, | ||
| 272 | {"KC_FN26", KC_FN26}, | ||
| 273 | {"KC_FN27", KC_FN27}, | ||
| 274 | {"KC_FN28", KC_FN28}, | ||
| 275 | {"KC_FN29", KC_FN29}, | ||
| 276 | {"KC_FN30", KC_FN30}, | ||
| 277 | {"KC_FN31", KC_FN31}, | ||
| 278 | {"KC_LCTL", KC_LCTL}, | ||
| 279 | {"KC_LSFT", KC_LSFT}, | ||
| 280 | {"KC_LALT", KC_LALT}, | ||
| 281 | {"KC_LGUI", KC_LGUI}, | ||
| 282 | {"KC_RCTL", KC_RCTL}, | ||
| 283 | {"KC_RSFT", KC_RSFT}, | ||
| 284 | {"KC_RALT", KC_RALT}, | ||
| 285 | {"KC_RGUI", KC_RGUI}, | ||
| 286 | {"KC_MS_UP", KC_MS_UP}, | ||
| 287 | {"KC_MS_DOWN", KC_MS_DOWN}, | ||
| 288 | {"KC_MS_LEFT", KC_MS_LEFT}, | ||
| 289 | {"KC_MS_RIGHT", KC_MS_RIGHT}, | ||
| 290 | {"KC_MS_BTN1", KC_MS_BTN1}, | ||
| 291 | {"KC_MS_BTN2", KC_MS_BTN2}, | ||
| 292 | {"KC_MS_BTN3", KC_MS_BTN3}, | ||
| 293 | {"KC_MS_BTN4", KC_MS_BTN4}, | ||
| 294 | {"KC_MS_BTN5", KC_MS_BTN5}, | ||
| 295 | {"KC_MS_WH_UP", KC_MS_WH_UP}, | ||
| 296 | {"KC_MS_WH_DOWN", KC_MS_WH_DOWN}, | ||
| 297 | {"KC_MS_WH_LEFT", KC_MS_WH_LEFT}, | ||
| 298 | {"KC_MS_WH_RIGHT", KC_MS_WH_RIGHT}, | ||
| 299 | {"KC_MS_ACCEL0", KC_MS_ACCEL0}, | ||
| 300 | {"KC_MS_ACCEL1", KC_MS_ACCEL1}, | ||
| 301 | {"KC_MS_ACCEL2", KC_MS_ACCEL2}, | ||
| 302 | {"KC_EXLM", KC_EXLM}, | ||
| 303 | {"KC_AT", KC_AT}, | ||
| 304 | {"KC_HASH", KC_HASH}, | ||
| 305 | {"KC_DLR", KC_DLR}, | ||
| 306 | {"KC_PERC", KC_PERC}, | ||
| 307 | {"KC_CIRC", KC_CIRC}, | ||
| 308 | {"KC_AMPR", KC_AMPR}, | ||
| 309 | {"KC_ASTR", KC_ASTR}, | ||
| 310 | {"KC_LPRN", KC_LPRN}, | ||
| 311 | {"KC_RPRN", KC_RPRN}, | ||
| 312 | {"KC_UNDS", KC_UNDS}, | ||
| 313 | {"KC_PLUS", KC_PLUS}, | ||
| 314 | {"KC_LCBR", KC_LCBR}, | ||
| 315 | {"KC_RCBR", KC_RCBR}, | ||
| 316 | {"KC_PIPE", KC_PIPE}, | ||
| 317 | {"KC_COLN", KC_COLN}, | ||
| 318 | {"KC_DQUO", KC_DQUO}, | ||
| 319 | {"KC_TILD", KC_TILD}, | ||
| 320 | {"KC_LT", KC_LT}, | ||
| 321 | {"KC_GT", KC_GT}, | ||
| 322 | {"KC_QUES", KC_QUES}, | ||
| 323 | {"RESET", RESET}, | ||
| 324 | {"DEBUG", DEBUG}, | ||
| 325 | {"MAGIC_TOGGLE_NKRO", MAGIC_TOGGLE_NKRO}, | ||
| 326 | {"KC_GESC", KC_GESC}, | ||
| 327 | {"AU_ON", AU_ON}, | ||
| 328 | {"AU_OFF", AU_OFF}, | ||
| 329 | {"AU_TOG", AU_TOG}, | ||
| 330 | {"CLICKY_TOGGLE", CLICKY_TOGGLE}, | ||
| 331 | {"CLICKY_ENABLE", CLICKY_ENABLE}, | ||
| 332 | {"CLICKY_DISABLE", CLICKY_DISABLE}, | ||
| 333 | {"CLICKY_UP", CLICKY_UP}, | ||
| 334 | {"CLICKY_DOWN", CLICKY_DOWN}, | ||
| 335 | {"CLICKY_RESET", CLICKY_RESET}, | ||
| 336 | {"MU_ON", MU_ON}, | ||
| 337 | {"MU_OFF", MU_OFF}, | ||
| 338 | {"MU_TOG", MU_TOG}, | ||
| 339 | {"MU_MOD", MU_MOD}, | ||
| 340 | {"BL_ON", BL_ON}, | ||
| 341 | {"BL_OFF", BL_OFF}, | ||
| 342 | {"BL_DEC", BL_DEC}, | ||
| 343 | {"BL_INC", BL_INC}, | ||
| 344 | {"BL_TOGG", BL_TOGG}, | ||
| 345 | {"BL_STEP", BL_STEP}, | ||
| 346 | {"BL_BRTG", BL_BRTG}, | ||
| 347 | {"RGB_TOG", RGB_TOG}, | ||
| 348 | {"RGB_MOD", RGB_MOD}, | ||
| 349 | {"RGB_RMOD", RGB_RMOD}, | ||
| 350 | {"RGB_HUI", RGB_HUI}, | ||
| 351 | {"RGB_HUD", RGB_HUD}, | ||
| 352 | {"RGB_SAI", RGB_SAI}, | ||
| 353 | {"RGB_SAD", RGB_SAD}, | ||
| 354 | {"RGB_VAI", RGB_VAI}, | ||
| 355 | {"RGB_VAD", RGB_VAD}, | ||
| 356 | {"RGB_SPI", RGB_SPI}, | ||
| 357 | {"RGB_SPD", RGB_SPD}, | ||
| 358 | {"RGB_M_P", RGB_M_P}, | ||
| 359 | {"RGB_M_B", RGB_M_B}, | ||
| 360 | {"RGB_M_R", RGB_M_R}, | ||
| 361 | {"RGB_M_SW", RGB_M_SW}, | ||
| 362 | {"RGB_M_SN", RGB_M_SN}, | ||
| 363 | {"RGB_M_K", RGB_M_K}, | ||
| 364 | {"RGB_M_X", RGB_M_X}, | ||
| 365 | {"RGB_M_G", RGB_M_G}, | ||
| 366 | {"KC_LSPO", KC_LSPO}, | ||
| 367 | {"KC_RSPC", KC_RSPC}, | ||
| 368 | {"KC_SFTENT", KC_SFTENT}, | ||
| 369 | {"KC_LCPO", KC_LCPO}, | ||
| 370 | {"KC_RCPC", KC_RCPC}, | ||
| 371 | {"KC_LAPO", KC_LAPO}, | ||
| 372 | {"KC_RAPC", KC_RAPC}, | ||
| 373 | {"FN_MO13", FN_MO13}, | ||
| 374 | {"FN_MO23", FN_MO23}, | ||
| 375 | {"MACRO00", MACRO00}, | ||
| 376 | {"MACRO01", MACRO01}, | ||
| 377 | {"MACRO02", MACRO02}, | ||
| 378 | {"MACRO03", MACRO03}, | ||
| 379 | {"MACRO04", MACRO04}, | ||
| 380 | {"MACRO05", MACRO05}, | ||
| 381 | {"MACRO06", MACRO06}, | ||
| 382 | {"MACRO07", MACRO07}, | ||
| 383 | {"MACRO08", MACRO08}, | ||
| 384 | {"MACRO09", MACRO09}, | ||
| 385 | {"MACRO10", MACRO10}, | ||
| 386 | {"MACRO11", MACRO11}, | ||
| 387 | {"MACRO12", MACRO12}, | ||
| 388 | {"MACRO13", MACRO13}, | ||
| 389 | {"MACRO14", MACRO14}, | ||
| 390 | {"MACRO15", MACRO15}, | ||
| 391 | {"USER00", USER00}, | ||
| 392 | {"USER01", USER01}, | ||
| 393 | {"USER02", USER02}, | ||
| 394 | {"USER03", USER03}, | ||
| 395 | {"USER04", USER04}, | ||
| 396 | {"USER05", USER05}, | ||
| 397 | {"USER06", USER06}, | ||
| 398 | {"USER07", USER07}, | ||
| 399 | {"USER08", USER08}, | ||
| 400 | {"USER09", USER09}, | ||
| 401 | {"USER10", USER10}, | ||
| 402 | {"USER11", USER11}, | ||
| 403 | {"USER12", USER12}, | ||
| 404 | {"USER13", USER13}, | ||
| 405 | {"USER14", USER14}, | ||
| 406 | {"USER15", USER15} | ||
| 407 | }; | ||
diff --git a/keyboards/rocketboard_16/keycode_lookup.h b/keyboards/rocketboard_16/keycode_lookup.h new file mode 100644 index 000000000..f51dcfd52 --- /dev/null +++ b/keyboards/rocketboard_16/keycode_lookup.h | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | /* Copyright 2021 Seth Bonner <fl3tching101@gmail.com> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #include "quantum.h" | ||
| 20 | |||
| 21 | typedef struct | ||
| 22 | { | ||
| 23 | char key_string[17]; | ||
| 24 | uint16_t keycode; | ||
| 25 | } lookup_table_t; | ||
| 26 | |||
| 27 | char* translate_keycode_to_string(uint16_t code); | ||
| 28 | |||
| 29 | extern lookup_table_t lookup_table[366]; | ||
diff --git a/keyboards/rocketboard_16/keymaps/default/keymap.c b/keyboards/rocketboard_16/keymaps/default/keymap.c index 0c3ee96d4..050ab9f5b 100644 --- a/keyboards/rocketboard_16/keymaps/default/keymap.c +++ b/keyboards/rocketboard_16/keymaps/default/keymap.c | |||
| @@ -12,29 +12,41 @@ You should have received a copy of the GNU General Public License | |||
| 12 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 12 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 13 | */ | 13 | */ |
| 14 | #include QMK_KEYBOARD_H | 14 | #include QMK_KEYBOARD_H |
| 15 | #include "keycode_lookup.h" | ||
| 16 | #include <string.h> | ||
| 15 | 17 | ||
| 18 | #ifdef CONSOLE_ENABLE | ||
| 19 | #include "print.h" | ||
| 20 | #endif | ||
| 16 | 21 | ||
| 17 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | 22 | // Each layer gets a name for readability, which is then used in the keymap matrix below. |
| 18 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | 23 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. |
| 19 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | 24 | // Layer names don't all need to be of the same length, obviously, and you can also skip them |
| 20 | // entirely and just use numbers. | 25 | // entirely and just use numbers. |
| 21 | #define _BASE 0 | 26 | #define _BASE 0 |
| 27 | #define _SPEC 1 // Special layer | ||
| 22 | 28 | ||
| 23 | // Use the following format to create custom key codes to make macros out of and such | 29 | // Use the following format to create custom key codes to make macros out of and such |
| 24 | /* | ||
| 25 | enum custom_keycodes { | 30 | enum custom_keycodes { |
| 26 | FOO = SAFE_RANGE, | 31 | KC_EXAM = SAFE_RANGE // "Examine" key code to show the keycode of a key pressed afterwards on the OLED |
| 27 | }; | 32 | }; |
| 28 | */ | 33 | |
| 29 | 34 | ||
| 30 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 35 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 31 | [_BASE] = LAYOUT_default( | 36 | [_BASE] = LAYOUT_default( |
| 32 | RGB_MODE_FORWARD, KC_NUMLOCK, | 37 | RGB_MODE_FORWARD, KC_NUMLOCK, |
| 33 | KC_KP_7, KC_KP_8, KC_KP_9, KC_DELETE, | 38 | KC_KP_7, KC_KP_8, KC_KP_9, KC_DELETE, |
| 34 | KC_KP_4, KC_KP_5, KC_KP_6, KC_END, | 39 | KC_KP_4, KC_KP_5, KC_KP_6, KC_END, |
| 35 | KC_KP_1, KC_KP_2, KC_KP_3, KC_AUDIO_VOL_UP, | 40 | KC_KP_1, KC_KP_2, KC_KP_3, KC_F13, |
| 36 | KC_KP_0, RGB_TOG, KC_AUDIO_MUTE, KC_AUDIO_VOL_DOWN | 41 | KC_KP_0, MO(1), KC_KP_DOT, KC_KP_ENTER |
| 37 | ) | 42 | ), |
| 43 | [_SPEC] = LAYOUT_default( | ||
| 44 | RGB_MODE_REVERSE, KC_AUDIO_MUTE, | ||
| 45 | KC_NO, KC_NO, KC_NO, KC_EXAM, | ||
| 46 | KC_NO, KC_NO, KC_NO, KC_NO, | ||
| 47 | RESET, RGB_TOG, RGB_SPI, RGB_SPD, | ||
| 48 | KC_NO, _______, KC_NO, KC_NO | ||
| 49 | ) | ||
| 38 | }; | 50 | }; |
| 39 | 51 | ||
| 40 | bool encoder_update_user(uint8_t index, bool clockwise){ | 52 | bool encoder_update_user(uint8_t index, bool clockwise){ |
| @@ -56,35 +68,321 @@ bool encoder_update_user(uint8_t index, bool clockwise){ | |||
| 56 | 68 | ||
| 57 | #ifdef OLED_ENABLE | 69 | #ifdef OLED_ENABLE |
| 58 | 70 | ||
| 59 | static void render_logo(void) { | 71 | #define ANIM_FRAMES 3 |
| 60 | static const char PROGMEM qmk_logo[] = { | 72 | #define ANIM_FRAME_DURATION 110 // Number of milliseconds per frame (no faster than 110ms, last line struggles) |
| 61 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, | 73 | #define BACKGROUND_FRAMES 21 |
| 62 | 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, | 74 | #define ROCKET_CENTER_POS 3 |
| 63 | 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0x00 | 75 | #define SPLASH_DUR 100 // Measured in frames, see above for frame length (note, 231 is used as a key value later on, CTRL+F for uses of this to make sure everything is good) |
| 64 | }; | 76 | |
| 77 | uint32_t anim_timer = 0; | ||
| 78 | uint8_t current_frame = 0; | ||
| 79 | uint8_t rocket_y_position = 3; | ||
| 80 | uint8_t rocket_pos_change = 0; | ||
| 81 | uint8_t background_frame = 0; | ||
| 82 | uint8_t splash_dur_counter = 0; | ||
| 83 | bool examine_engaged = false; | ||
| 84 | uint16_t examined_keycode = KC_NO; | ||
| 85 | char lastKeycodeString[32] = { 0 }; | ||
| 86 | |||
| 87 | const char star_background [8] [21] = | ||
| 88 | { | ||
| 89 | {0x88, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x93}, | ||
| 90 | {0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x8D, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8E, 0x00, 0x00}, | ||
| 91 | {0x00, 0x8F, 0x00, 0x00, 0x8A, 0x00, 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, | ||
| 92 | {0x00, 0x00, 0x00, 0x8B, 0x00, 0x00, 0x00, 0x8D, 0x00, 0x00, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00}, | ||
| 93 | {0x8D, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x00, 0x00, 0x00, 0x00, 0x8F, 0x8B, 0x00, 0x00, 0x00, 0x00}, | ||
| 94 | {0x00, 0x8A, 0x00, 0x00, 0x8E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x8D, 0x00, 0x00, 0x00, 0x8F, 0x00, 0x00}, | ||
| 95 | {0x00, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x8F, 0x00, 0x89, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x8D, 0x00, 0x00, 0x00, 0x8F}, | ||
| 96 | {0x00, 0x8B, 0x00, 0x00, 0x91, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x8E, 0x00, 0x00, 0x90, 0x00, 0x00, 0x8C, 0x00, 0x00}, | ||
| 97 | }; | ||
| 98 | |||
| 99 | static void oled_write_ln_centered(const char * data, bool inverted) | ||
| 100 | { | ||
| 101 | if(strlen(data) >= 21) // If more than 1 line of text is passed in, return without doing anything | ||
| 102 | { | ||
| 103 | return; | ||
| 104 | } | ||
| 105 | |||
| 106 | // Character buffer to build up the string in | ||
| 107 | char line_buf[21]; | ||
| 108 | |||
| 109 | // Amount to offset string from left side | ||
| 110 | uint8_t offset = (21 - strlen(data))/2; | ||
| 111 | |||
| 112 | // Formatted string centering... look, it works, don't ask how... | ||
| 113 | snprintf(line_buf, 21, "%*s%s%*s\0", offset, "", data, offset, ""); // Centers data within 21 character buffer with null termination | ||
| 114 | |||
| 115 | oled_write_ln(line_buf, inverted); | ||
| 116 | } | ||
| 65 | 117 | ||
| 66 | oled_write(qmk_logo, false); | 118 | // Prints the exhaust characters in an order determined by the phase for animation purposes |
| 119 | // startX - The x axis starting point in characters for the exhaust (3 behind the rocket) | ||
| 120 | // startY - The y axis starting point in characters for the exhaust (middle of the rocket) | ||
| 121 | // phase - The "phase" of the animation, no real rhyme or reason to the exact number, but each frame move +1 to make the animation work | ||
| 122 | static void render_exhaust(uint8_t startX, uint8_t startY, uint8_t phase) | ||
| 123 | { | ||
| 124 | oled_set_cursor(startX, startY); | ||
| 125 | oled_write_char(0x85 + (phase % 3), false); | ||
| 126 | phase++; | ||
| 127 | oled_write_char(0x85 + (phase % 3), false); | ||
| 128 | phase++; | ||
| 129 | oled_write_char(0x85 + (phase % 3), false); | ||
| 130 | } | ||
| 131 | |||
| 132 | // Renders the "stars" behind the rocket | ||
| 133 | // startY - The starting Y location (in characters) of the rocket so that stars aren't rendered on top of the rocket | ||
| 134 | static void render_stars(uint8_t startY, uint8_t phase) | ||
| 135 | { | ||
| 136 | // Line 0 | ||
| 137 | oled_set_cursor(0, 0); | ||
| 138 | for(int i = 0; i < 21; i++) | ||
| 139 | { | ||
| 140 | oled_write_char(star_background[0][(i + phase) % 21], false); | ||
| 141 | } | ||
| 142 | // Line 1 | ||
| 143 | oled_set_cursor(0, 1); | ||
| 144 | for(int i = 0; i < 21; i++) | ||
| 145 | { | ||
| 146 | oled_write_char(star_background[1][(i + phase) % 21], false); | ||
| 147 | } | ||
| 148 | // Line 2 | ||
| 149 | oled_set_cursor(0, 2); | ||
| 150 | for(int i = 0; i < 21; i++) | ||
| 151 | { | ||
| 152 | oled_write_char(star_background[2][(i + phase) % 21], false); | ||
| 153 | } | ||
| 154 | // Line 3 | ||
| 155 | oled_set_cursor(0, 3); | ||
| 156 | for(int i = 0; i < 21; i++) | ||
| 157 | { | ||
| 158 | oled_write_char(star_background[3][(i + phase) % 21], false); | ||
| 159 | } | ||
| 160 | // Line 4 | ||
| 161 | oled_set_cursor(0, 4); | ||
| 162 | for(int i = 0; i < 21; i++) | ||
| 163 | { | ||
| 164 | oled_write_char(star_background[4][(i + phase) % 21], false); | ||
| 165 | } | ||
| 166 | // Line 5 | ||
| 167 | oled_set_cursor(0, 5); | ||
| 168 | for(int i = 0; i < 21; i++) | ||
| 169 | { | ||
| 170 | oled_write_char(star_background[5][(i + phase) % 21], false); | ||
| 171 | } | ||
| 172 | // Line 6 | ||
| 173 | oled_set_cursor(0, 6); | ||
| 174 | for(int i = 0; i < 21; i++) | ||
| 175 | { | ||
| 176 | oled_write_char(star_background[6][(i + phase) % 21], false); | ||
| 177 | } | ||
| 178 | // Line 7 | ||
| 179 | oled_set_cursor(0, 7); | ||
| 180 | for(int i = 0; i < 21; i++) | ||
| 181 | { | ||
| 182 | oled_write_char(star_background[7][(i + phase) % 21], false); | ||
| 183 | } | ||
| 184 | |||
| 185 | } | ||
| 186 | |||
| 187 | static void render_logo(uint8_t startX, uint8_t startY) | ||
| 188 | { | ||
| 189 | oled_set_cursor(startX, startY); | ||
| 190 | oled_write_char(0x80, false); | ||
| 191 | oled_write_char(0x81, false); | ||
| 192 | oled_write_char(0x82, false); | ||
| 193 | oled_write_char(0x83, false); | ||
| 194 | oled_write_char(0x84, false); | ||
| 195 | oled_set_cursor(startX, startY + 1); | ||
| 196 | oled_write_char(0xA0, false); | ||
| 197 | oled_write_char(0xA1, false); | ||
| 198 | oled_write_char(0xA2, false); | ||
| 199 | oled_write_char(0xA3, false); | ||
| 200 | oled_write_char(0xA4, false); | ||
| 201 | oled_write_char(0xA5, false); | ||
| 202 | oled_set_cursor(startX, startY + 2); | ||
| 203 | oled_write_char(0xC0, false); | ||
| 204 | oled_write_char(0xC1, false); | ||
| 205 | oled_write_char(0xC2, false); | ||
| 206 | oled_write_char(0xC3, false); | ||
| 207 | oled_write_char(0xC4, false); | ||
| 67 | } | 208 | } |
| 68 | 209 | ||
| 69 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_180; } | 210 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_180; } |
| 70 | 211 | ||
| 71 | void oled_task_user(void) { | 212 | void oled_task_user(void) |
| 72 | uint8_t light_level = rgblight_get_val(); | 213 | { |
| 73 | light_level = (uint8_t)(100.0 * ((float)light_level/(float)RGBLIGHT_LIMIT_VAL)); // Convert to % | 214 | // Playing the animation |
| 74 | char c_light_level[3]; | 215 | if((timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) && (splash_dur_counter < SPLASH_DUR)) |
| 75 | itoa(light_level, c_light_level, 10); | 216 | { |
| 76 | 217 | anim_timer = timer_read32(); // read the current timer value | |
| 77 | render_logo(); // Render the QMK logo | 218 | current_frame = (current_frame + 1) % ANIM_FRAMES; // Frame in the exhaust animation |
| 78 | oled_write_ln(PSTR(""), false); // Add a newline | 219 | background_frame = (background_frame + 1) % BACKGROUND_FRAMES; // Frame in the star animation |
| 79 | // Host Keyboard LED Status | 220 | |
| 80 | led_t led_state = host_keyboard_led_state(); | 221 | // Move the rocket up and down |
| 81 | oled_write(led_state.num_lock ? PSTR(" |NUM|") : PSTR(" | |"), false); | 222 | if((rocket_pos_change / 9) == 0) |
| 82 | oled_write(led_state.caps_lock ? PSTR("|CAP|") : PSTR("| |"), false); | 223 | { |
| 83 | oled_write(led_state.scroll_lock ? PSTR("|SCR| ") : PSTR("| | "), false); | 224 | rocket_y_position = ROCKET_CENTER_POS; |
| 84 | 225 | } | |
| 85 | oled_write_ln(PSTR(""), false); // Add a newline | 226 | else if((rocket_pos_change / 9) == 1) |
| 86 | oled_write(PSTR(" BKLT: "), false); | 227 | { |
| 87 | oled_write(c_light_level, false); | 228 | rocket_y_position = ROCKET_CENTER_POS + 1; |
| 88 | oled_write_ln(PSTR("% "), false); | 229 | } |
| 230 | else if((rocket_pos_change / 9) == 2) | ||
| 231 | { | ||
| 232 | rocket_y_position = ROCKET_CENTER_POS; | ||
| 233 | } | ||
| 234 | if((rocket_pos_change / 9) == 3) | ||
| 235 | { | ||
| 236 | rocket_y_position = ROCKET_CENTER_POS - 1; | ||
| 237 | } | ||
| 238 | |||
| 239 | // Renders the scene piece by piece | ||
| 240 | render_stars(8, background_frame); // Render star background | ||
| 241 | render_exhaust(6, rocket_y_position + 1, current_frame); // Render exhaust | ||
| 242 | render_logo(9, rocket_y_position); // Render the rocket | ||
| 243 | |||
| 244 | // Timing for rocket position change | ||
| 245 | if(rocket_pos_change < 36) | ||
| 246 | { | ||
| 247 | rocket_pos_change++; | ||
| 248 | } | ||
| 249 | else | ||
| 250 | { | ||
| 251 | rocket_pos_change = 0; | ||
| 252 | } | ||
| 253 | |||
| 254 | splash_dur_counter++; | ||
| 255 | } | ||
| 256 | else if((splash_dur_counter >= SPLASH_DUR) && (splash_dur_counter != 231)) // Should only run once at end of splash screen duration | ||
| 257 | { | ||
| 258 | splash_dur_counter = 231; // Nice known value | ||
| 259 | oled_clear(); // Clear the screen | ||
| 260 | } | ||
| 261 | |||
| 262 | |||
| 263 | // After the splash screen | ||
| 264 | if(splash_dur_counter == 231) | ||
| 265 | { | ||
| 266 | uint8_t light_level = rgblight_get_val(); | ||
| 267 | light_level = (uint8_t)(100.0 * ((float)light_level/(float)RGBLIGHT_LIMIT_VAL)); // Convert to % | ||
| 268 | char c_light_level[3]; | ||
| 269 | itoa(light_level, c_light_level, 10); | ||
| 270 | |||
| 271 | // Display lock LED statuses | ||
| 272 | led_t led_state = host_keyboard_led_state(); | ||
| 273 | if(led_state.num_lock) | ||
| 274 | { | ||
| 275 | oled_write(PSTR(" |"), false); | ||
| 276 | oled_write(PSTR("NUM"), true); | ||
| 277 | oled_write(PSTR("|"), false); | ||
| 278 | } | ||
| 279 | else | ||
| 280 | { | ||
| 281 | oled_write(PSTR(" |NUM|"), false); | ||
| 282 | } | ||
| 283 | |||
| 284 | if(led_state.caps_lock) | ||
| 285 | { | ||
| 286 | oled_write(PSTR("|"), false); | ||
| 287 | oled_write(PSTR("CAP"), true); | ||
| 288 | oled_write(PSTR("|"), false); | ||
| 289 | } | ||
| 290 | else | ||
| 291 | { | ||
| 292 | oled_write(PSTR("|CAP|"), false); | ||
| 293 | } | ||
| 294 | |||
| 295 | if(led_state.scroll_lock) | ||
| 296 | { | ||
| 297 | oled_write(PSTR("|"), false); | ||
| 298 | oled_write(PSTR("SCR"), true); | ||
| 299 | oled_write(PSTR("| "), false); | ||
| 300 | } | ||
| 301 | else | ||
| 302 | { | ||
| 303 | oled_write(PSTR("|SCR| "), false); | ||
| 304 | } | ||
| 305 | |||
| 306 | // Print the examine info | ||
| 307 | if(examine_engaged == true) | ||
| 308 | { | ||
| 309 | oled_set_cursor(0, 2); | ||
| 310 | oled_write_ln(PSTR(" Keycode: "), false); | ||
| 311 | oled_write_ln_centered(lastKeycodeString, false); | ||
| 312 | } | ||
| 313 | else | ||
| 314 | { | ||
| 315 | oled_set_cursor(0, 2); | ||
| 316 | oled_write_ln(PSTR(" "), false); | ||
| 317 | oled_write_ln(PSTR(" "), false); | ||
| 318 | } | ||
| 319 | |||
| 320 | // Print the backlight % bottom right | ||
| 321 | oled_set_cursor(11, 7); | ||
| 322 | oled_write(PSTR("BKLT: "), false); | ||
| 323 | oled_write(c_light_level, false); | ||
| 324 | oled_write(PSTR("%"), false); | ||
| 325 | |||
| 326 | // Print the layer number in bottom left | ||
| 327 | oled_set_cursor(0, 7); | ||
| 328 | oled_write(PSTR("L: "), false); | ||
| 329 | switch (get_highest_layer(layer_state)) | ||
| 330 | { | ||
| 331 | case 0: | ||
| 332 | oled_write(PSTR("0"), false); | ||
| 333 | break; | ||
| 334 | case 1: | ||
| 335 | oled_write(PSTR("1"), false); | ||
| 336 | break; | ||
| 337 | case 2: | ||
| 338 | oled_write(PSTR("2"), false); | ||
| 339 | break; | ||
| 340 | case 3: | ||
| 341 | oled_write(PSTR("3"), false); | ||
| 342 | break; | ||
| 343 | default: | ||
| 344 | oled_write(PSTR("Und"), false); | ||
| 345 | break; | ||
| 346 | } | ||
| 347 | |||
| 348 | |||
| 349 | } | ||
| 350 | |||
| 351 | } | ||
| 352 | |||
| 353 | // Process the extra/extended keycode functionality | ||
| 354 | bool process_record_user(uint16_t keycode, keyrecord_t *record) | ||
| 355 | { | ||
| 356 | bool ret = true; // True will allow QMK to process the key as usual after the function runs, false skips QMK processing after this function runs | ||
| 357 | |||
| 358 | switch (keycode) | ||
| 359 | { | ||
| 360 | case KC_EXAM: | ||
| 361 | if(record->event.pressed) // On pressed, flip bool examine_engaged | ||
| 362 | { | ||
| 363 | if(examine_engaged == false) | ||
| 364 | { | ||
| 365 | examine_engaged = true; | ||
| 366 | } | ||
| 367 | else | ||
| 368 | { | ||
| 369 | examine_engaged = false; | ||
| 370 | } | ||
| 371 | ret = false; | ||
| 372 | } | ||
| 373 | else // On release do nothing | ||
| 374 | { | ||
| 375 | ret = false; | ||
| 376 | } | ||
| 377 | break; | ||
| 378 | |||
| 379 | default: // For any key other than EX, simply let QMK process after saving away what it was | ||
| 380 | memset(lastKeycodeString, 0, sizeof(lastKeycodeString)); | ||
| 381 | memcpy(lastKeycodeString, translate_keycode_to_string(keycode), sizeof(((lookup_table_t *)0)->key_string)); | ||
| 382 | ret = true; | ||
| 383 | break; | ||
| 384 | } | ||
| 385 | |||
| 386 | return ret; | ||
| 89 | } | 387 | } |
| 90 | #endif | 388 | #endif |
diff --git a/keyboards/rocketboard_16/keymaps/via/keymap.c b/keyboards/rocketboard_16/keymaps/via/keymap.c index 0c3ee96d4..050ab9f5b 100644 --- a/keyboards/rocketboard_16/keymaps/via/keymap.c +++ b/keyboards/rocketboard_16/keymaps/via/keymap.c | |||
| @@ -12,29 +12,41 @@ You should have received a copy of the GNU General Public License | |||
| 12 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 12 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 13 | */ | 13 | */ |
| 14 | #include QMK_KEYBOARD_H | 14 | #include QMK_KEYBOARD_H |
| 15 | #include "keycode_lookup.h" | ||
| 16 | #include <string.h> | ||
| 15 | 17 | ||
| 18 | #ifdef CONSOLE_ENABLE | ||
| 19 | #include "print.h" | ||
| 20 | #endif | ||
| 16 | 21 | ||
| 17 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | 22 | // Each layer gets a name for readability, which is then used in the keymap matrix below. |
| 18 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | 23 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. |
| 19 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | 24 | // Layer names don't all need to be of the same length, obviously, and you can also skip them |
| 20 | // entirely and just use numbers. | 25 | // entirely and just use numbers. |
| 21 | #define _BASE 0 | 26 | #define _BASE 0 |
| 27 | #define _SPEC 1 // Special layer | ||
| 22 | 28 | ||
| 23 | // Use the following format to create custom key codes to make macros out of and such | 29 | // Use the following format to create custom key codes to make macros out of and such |
| 24 | /* | ||
| 25 | enum custom_keycodes { | 30 | enum custom_keycodes { |
| 26 | FOO = SAFE_RANGE, | 31 | KC_EXAM = SAFE_RANGE // "Examine" key code to show the keycode of a key pressed afterwards on the OLED |
| 27 | }; | 32 | }; |
| 28 | */ | 33 | |
| 29 | 34 | ||
| 30 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 35 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 31 | [_BASE] = LAYOUT_default( | 36 | [_BASE] = LAYOUT_default( |
| 32 | RGB_MODE_FORWARD, KC_NUMLOCK, | 37 | RGB_MODE_FORWARD, KC_NUMLOCK, |
| 33 | KC_KP_7, KC_KP_8, KC_KP_9, KC_DELETE, | 38 | KC_KP_7, KC_KP_8, KC_KP_9, KC_DELETE, |
| 34 | KC_KP_4, KC_KP_5, KC_KP_6, KC_END, | 39 | KC_KP_4, KC_KP_5, KC_KP_6, KC_END, |
| 35 | KC_KP_1, KC_KP_2, KC_KP_3, KC_AUDIO_VOL_UP, | 40 | KC_KP_1, KC_KP_2, KC_KP_3, KC_F13, |
| 36 | KC_KP_0, RGB_TOG, KC_AUDIO_MUTE, KC_AUDIO_VOL_DOWN | 41 | KC_KP_0, MO(1), KC_KP_DOT, KC_KP_ENTER |
| 37 | ) | 42 | ), |
| 43 | [_SPEC] = LAYOUT_default( | ||
| 44 | RGB_MODE_REVERSE, KC_AUDIO_MUTE, | ||
| 45 | KC_NO, KC_NO, KC_NO, KC_EXAM, | ||
| 46 | KC_NO, KC_NO, KC_NO, KC_NO, | ||
| 47 | RESET, RGB_TOG, RGB_SPI, RGB_SPD, | ||
| 48 | KC_NO, _______, KC_NO, KC_NO | ||
| 49 | ) | ||
| 38 | }; | 50 | }; |
| 39 | 51 | ||
| 40 | bool encoder_update_user(uint8_t index, bool clockwise){ | 52 | bool encoder_update_user(uint8_t index, bool clockwise){ |
| @@ -56,35 +68,321 @@ bool encoder_update_user(uint8_t index, bool clockwise){ | |||
| 56 | 68 | ||
| 57 | #ifdef OLED_ENABLE | 69 | #ifdef OLED_ENABLE |
| 58 | 70 | ||
| 59 | static void render_logo(void) { | 71 | #define ANIM_FRAMES 3 |
| 60 | static const char PROGMEM qmk_logo[] = { | 72 | #define ANIM_FRAME_DURATION 110 // Number of milliseconds per frame (no faster than 110ms, last line struggles) |
| 61 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, | 73 | #define BACKGROUND_FRAMES 21 |
| 62 | 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, | 74 | #define ROCKET_CENTER_POS 3 |
| 63 | 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0x00 | 75 | #define SPLASH_DUR 100 // Measured in frames, see above for frame length (note, 231 is used as a key value later on, CTRL+F for uses of this to make sure everything is good) |
| 64 | }; | 76 | |
| 77 | uint32_t anim_timer = 0; | ||
| 78 | uint8_t current_frame = 0; | ||
| 79 | uint8_t rocket_y_position = 3; | ||
| 80 | uint8_t rocket_pos_change = 0; | ||
| 81 | uint8_t background_frame = 0; | ||
| 82 | uint8_t splash_dur_counter = 0; | ||
| 83 | bool examine_engaged = false; | ||
| 84 | uint16_t examined_keycode = KC_NO; | ||
| 85 | char lastKeycodeString[32] = { 0 }; | ||
| 86 | |||
| 87 | const char star_background [8] [21] = | ||
| 88 | { | ||
| 89 | {0x88, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x93}, | ||
| 90 | {0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x8D, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8E, 0x00, 0x00}, | ||
| 91 | {0x00, 0x8F, 0x00, 0x00, 0x8A, 0x00, 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, | ||
| 92 | {0x00, 0x00, 0x00, 0x8B, 0x00, 0x00, 0x00, 0x8D, 0x00, 0x00, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00}, | ||
| 93 | {0x8D, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x00, 0x00, 0x00, 0x00, 0x8F, 0x8B, 0x00, 0x00, 0x00, 0x00}, | ||
| 94 | {0x00, 0x8A, 0x00, 0x00, 0x8E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x8D, 0x00, 0x00, 0x00, 0x8F, 0x00, 0x00}, | ||
| 95 | {0x00, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x8F, 0x00, 0x89, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x8D, 0x00, 0x00, 0x00, 0x8F}, | ||
| 96 | {0x00, 0x8B, 0x00, 0x00, 0x91, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x8E, 0x00, 0x00, 0x90, 0x00, 0x00, 0x8C, 0x00, 0x00}, | ||
| 97 | }; | ||
| 98 | |||
| 99 | static void oled_write_ln_centered(const char * data, bool inverted) | ||
| 100 | { | ||
| 101 | if(strlen(data) >= 21) // If more than 1 line of text is passed in, return without doing anything | ||
| 102 | { | ||
| 103 | return; | ||
| 104 | } | ||
| 105 | |||
| 106 | // Character buffer to build up the string in | ||
| 107 | char line_buf[21]; | ||
| 108 | |||
| 109 | // Amount to offset string from left side | ||
| 110 | uint8_t offset = (21 - strlen(data))/2; | ||
| 111 | |||
| 112 | // Formatted string centering... look, it works, don't ask how... | ||
| 113 | snprintf(line_buf, 21, "%*s%s%*s\0", offset, "", data, offset, ""); // Centers data within 21 character buffer with null termination | ||
| 114 | |||
| 115 | oled_write_ln(line_buf, inverted); | ||
| 116 | } | ||
| 65 | 117 | ||
| 66 | oled_write(qmk_logo, false); | 118 | // Prints the exhaust characters in an order determined by the phase for animation purposes |
| 119 | // startX - The x axis starting point in characters for the exhaust (3 behind the rocket) | ||
| 120 | // startY - The y axis starting point in characters for the exhaust (middle of the rocket) | ||
| 121 | // phase - The "phase" of the animation, no real rhyme or reason to the exact number, but each frame move +1 to make the animation work | ||
| 122 | static void render_exhaust(uint8_t startX, uint8_t startY, uint8_t phase) | ||
| 123 | { | ||
| 124 | oled_set_cursor(startX, startY); | ||
| 125 | oled_write_char(0x85 + (phase % 3), false); | ||
| 126 | phase++; | ||
| 127 | oled_write_char(0x85 + (phase % 3), false); | ||
| 128 | phase++; | ||
| 129 | oled_write_char(0x85 + (phase % 3), false); | ||
| 130 | } | ||
| 131 | |||
| 132 | // Renders the "stars" behind the rocket | ||
| 133 | // startY - The starting Y location (in characters) of the rocket so that stars aren't rendered on top of the rocket | ||
| 134 | static void render_stars(uint8_t startY, uint8_t phase) | ||
| 135 | { | ||
| 136 | // Line 0 | ||
| 137 | oled_set_cursor(0, 0); | ||
| 138 | for(int i = 0; i < 21; i++) | ||
| 139 | { | ||
| 140 | oled_write_char(star_background[0][(i + phase) % 21], false); | ||
| 141 | } | ||
| 142 | // Line 1 | ||
| 143 | oled_set_cursor(0, 1); | ||
| 144 | for(int i = 0; i < 21; i++) | ||
| 145 | { | ||
| 146 | oled_write_char(star_background[1][(i + phase) % 21], false); | ||
| 147 | } | ||
| 148 | // Line 2 | ||
| 149 | oled_set_cursor(0, 2); | ||
| 150 | for(int i = 0; i < 21; i++) | ||
| 151 | { | ||
| 152 | oled_write_char(star_background[2][(i + phase) % 21], false); | ||
| 153 | } | ||
| 154 | // Line 3 | ||
| 155 | oled_set_cursor(0, 3); | ||
| 156 | for(int i = 0; i < 21; i++) | ||
| 157 | { | ||
| 158 | oled_write_char(star_background[3][(i + phase) % 21], false); | ||
| 159 | } | ||
| 160 | // Line 4 | ||
| 161 | oled_set_cursor(0, 4); | ||
| 162 | for(int i = 0; i < 21; i++) | ||
| 163 | { | ||
| 164 | oled_write_char(star_background[4][(i + phase) % 21], false); | ||
| 165 | } | ||
| 166 | // Line 5 | ||
| 167 | oled_set_cursor(0, 5); | ||
| 168 | for(int i = 0; i < 21; i++) | ||
| 169 | { | ||
| 170 | oled_write_char(star_background[5][(i + phase) % 21], false); | ||
| 171 | } | ||
| 172 | // Line 6 | ||
| 173 | oled_set_cursor(0, 6); | ||
| 174 | for(int i = 0; i < 21; i++) | ||
| 175 | { | ||
| 176 | oled_write_char(star_background[6][(i + phase) % 21], false); | ||
| 177 | } | ||
| 178 | // Line 7 | ||
| 179 | oled_set_cursor(0, 7); | ||
| 180 | for(int i = 0; i < 21; i++) | ||
| 181 | { | ||
| 182 | oled_write_char(star_background[7][(i + phase) % 21], false); | ||
| 183 | } | ||
| 184 | |||
| 185 | } | ||
| 186 | |||
| 187 | static void render_logo(uint8_t startX, uint8_t startY) | ||
| 188 | { | ||
| 189 | oled_set_cursor(startX, startY); | ||
| 190 | oled_write_char(0x80, false); | ||
| 191 | oled_write_char(0x81, false); | ||
| 192 | oled_write_char(0x82, false); | ||
| 193 | oled_write_char(0x83, false); | ||
| 194 | oled_write_char(0x84, false); | ||
| 195 | oled_set_cursor(startX, startY + 1); | ||
| 196 | oled_write_char(0xA0, false); | ||
| 197 | oled_write_char(0xA1, false); | ||
| 198 | oled_write_char(0xA2, false); | ||
| 199 | oled_write_char(0xA3, false); | ||
| 200 | oled_write_char(0xA4, false); | ||
| 201 | oled_write_char(0xA5, false); | ||
| 202 | oled_set_cursor(startX, startY + 2); | ||
| 203 | oled_write_char(0xC0, false); | ||
| 204 | oled_write_char(0xC1, false); | ||
| 205 | oled_write_char(0xC2, false); | ||
| 206 | oled_write_char(0xC3, false); | ||
| 207 | oled_write_char(0xC4, false); | ||
| 67 | } | 208 | } |
| 68 | 209 | ||
| 69 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_180; } | 210 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_180; } |
| 70 | 211 | ||
| 71 | void oled_task_user(void) { | 212 | void oled_task_user(void) |
| 72 | uint8_t light_level = rgblight_get_val(); | 213 | { |
| 73 | light_level = (uint8_t)(100.0 * ((float)light_level/(float)RGBLIGHT_LIMIT_VAL)); // Convert to % | 214 | // Playing the animation |
| 74 | char c_light_level[3]; | 215 | if((timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) && (splash_dur_counter < SPLASH_DUR)) |
| 75 | itoa(light_level, c_light_level, 10); | 216 | { |
| 76 | 217 | anim_timer = timer_read32(); // read the current timer value | |
| 77 | render_logo(); // Render the QMK logo | 218 | current_frame = (current_frame + 1) % ANIM_FRAMES; // Frame in the exhaust animation |
| 78 | oled_write_ln(PSTR(""), false); // Add a newline | 219 | background_frame = (background_frame + 1) % BACKGROUND_FRAMES; // Frame in the star animation |
| 79 | // Host Keyboard LED Status | 220 | |
| 80 | led_t led_state = host_keyboard_led_state(); | 221 | // Move the rocket up and down |
| 81 | oled_write(led_state.num_lock ? PSTR(" |NUM|") : PSTR(" | |"), false); | 222 | if((rocket_pos_change / 9) == 0) |
| 82 | oled_write(led_state.caps_lock ? PSTR("|CAP|") : PSTR("| |"), false); | 223 | { |
| 83 | oled_write(led_state.scroll_lock ? PSTR("|SCR| ") : PSTR("| | "), false); | 224 | rocket_y_position = ROCKET_CENTER_POS; |
| 84 | 225 | } | |
| 85 | oled_write_ln(PSTR(""), false); // Add a newline | 226 | else if((rocket_pos_change / 9) == 1) |
| 86 | oled_write(PSTR(" BKLT: "), false); | 227 | { |
| 87 | oled_write(c_light_level, false); | 228 | rocket_y_position = ROCKET_CENTER_POS + 1; |
| 88 | oled_write_ln(PSTR("% "), false); | 229 | } |
| 230 | else if((rocket_pos_change / 9) == 2) | ||
| 231 | { | ||
| 232 | rocket_y_position = ROCKET_CENTER_POS; | ||
| 233 | } | ||
| 234 | if((rocket_pos_change / 9) == 3) | ||
| 235 | { | ||
| 236 | rocket_y_position = ROCKET_CENTER_POS - 1; | ||
| 237 | } | ||
| 238 | |||
| 239 | // Renders the scene piece by piece | ||
| 240 | render_stars(8, background_frame); // Render star background | ||
| 241 | render_exhaust(6, rocket_y_position + 1, current_frame); // Render exhaust | ||
| 242 | render_logo(9, rocket_y_position); // Render the rocket | ||
| 243 | |||
| 244 | // Timing for rocket position change | ||
| 245 | if(rocket_pos_change < 36) | ||
| 246 | { | ||
| 247 | rocket_pos_change++; | ||
| 248 | } | ||
| 249 | else | ||
| 250 | { | ||
| 251 | rocket_pos_change = 0; | ||
| 252 | } | ||
| 253 | |||
| 254 | splash_dur_counter++; | ||
| 255 | } | ||
| 256 | else if((splash_dur_counter >= SPLASH_DUR) && (splash_dur_counter != 231)) // Should only run once at end of splash screen duration | ||
| 257 | { | ||
| 258 | splash_dur_counter = 231; // Nice known value | ||
| 259 | oled_clear(); // Clear the screen | ||
| 260 | } | ||
| 261 | |||
| 262 | |||
| 263 | // After the splash screen | ||
| 264 | if(splash_dur_counter == 231) | ||
| 265 | { | ||
| 266 | uint8_t light_level = rgblight_get_val(); | ||
| 267 | light_level = (uint8_t)(100.0 * ((float)light_level/(float)RGBLIGHT_LIMIT_VAL)); // Convert to % | ||
| 268 | char c_light_level[3]; | ||
| 269 | itoa(light_level, c_light_level, 10); | ||
| 270 | |||
| 271 | // Display lock LED statuses | ||
| 272 | led_t led_state = host_keyboard_led_state(); | ||
| 273 | if(led_state.num_lock) | ||
| 274 | { | ||
| 275 | oled_write(PSTR(" |"), false); | ||
| 276 | oled_write(PSTR("NUM"), true); | ||
| 277 | oled_write(PSTR("|"), false); | ||
| 278 | } | ||
| 279 | else | ||
| 280 | { | ||
| 281 | oled_write(PSTR(" |NUM|"), false); | ||
| 282 | } | ||
| 283 | |||
| 284 | if(led_state.caps_lock) | ||
| 285 | { | ||
| 286 | oled_write(PSTR("|"), false); | ||
| 287 | oled_write(PSTR("CAP"), true); | ||
| 288 | oled_write(PSTR("|"), false); | ||
| 289 | } | ||
| 290 | else | ||
| 291 | { | ||
| 292 | oled_write(PSTR("|CAP|"), false); | ||
| 293 | } | ||
| 294 | |||
| 295 | if(led_state.scroll_lock) | ||
| 296 | { | ||
| 297 | oled_write(PSTR("|"), false); | ||
| 298 | oled_write(PSTR("SCR"), true); | ||
| 299 | oled_write(PSTR("| "), false); | ||
| 300 | } | ||
| 301 | else | ||
| 302 | { | ||
| 303 | oled_write(PSTR("|SCR| "), false); | ||
| 304 | } | ||
| 305 | |||
| 306 | // Print the examine info | ||
| 307 | if(examine_engaged == true) | ||
| 308 | { | ||
| 309 | oled_set_cursor(0, 2); | ||
| 310 | oled_write_ln(PSTR(" Keycode: "), false); | ||
| 311 | oled_write_ln_centered(lastKeycodeString, false); | ||
| 312 | } | ||
| 313 | else | ||
| 314 | { | ||
| 315 | oled_set_cursor(0, 2); | ||
| 316 | oled_write_ln(PSTR(" "), false); | ||
| 317 | oled_write_ln(PSTR(" "), false); | ||
| 318 | } | ||
| 319 | |||
| 320 | // Print the backlight % bottom right | ||
| 321 | oled_set_cursor(11, 7); | ||
| 322 | oled_write(PSTR("BKLT: "), false); | ||
| 323 | oled_write(c_light_level, false); | ||
| 324 | oled_write(PSTR("%"), false); | ||
| 325 | |||
| 326 | // Print the layer number in bottom left | ||
| 327 | oled_set_cursor(0, 7); | ||
| 328 | oled_write(PSTR("L: "), false); | ||
| 329 | switch (get_highest_layer(layer_state)) | ||
| 330 | { | ||
| 331 | case 0: | ||
| 332 | oled_write(PSTR("0"), false); | ||
| 333 | break; | ||
| 334 | case 1: | ||
| 335 | oled_write(PSTR("1"), false); | ||
| 336 | break; | ||
| 337 | case 2: | ||
| 338 | oled_write(PSTR("2"), false); | ||
| 339 | break; | ||
| 340 | case 3: | ||
| 341 | oled_write(PSTR("3"), false); | ||
| 342 | break; | ||
| 343 | default: | ||
| 344 | oled_write(PSTR("Und"), false); | ||
| 345 | break; | ||
| 346 | } | ||
| 347 | |||
| 348 | |||
| 349 | } | ||
| 350 | |||
| 351 | } | ||
| 352 | |||
| 353 | // Process the extra/extended keycode functionality | ||
| 354 | bool process_record_user(uint16_t keycode, keyrecord_t *record) | ||
| 355 | { | ||
| 356 | bool ret = true; // True will allow QMK to process the key as usual after the function runs, false skips QMK processing after this function runs | ||
| 357 | |||
| 358 | switch (keycode) | ||
| 359 | { | ||
| 360 | case KC_EXAM: | ||
| 361 | if(record->event.pressed) // On pressed, flip bool examine_engaged | ||
| 362 | { | ||
| 363 | if(examine_engaged == false) | ||
| 364 | { | ||
| 365 | examine_engaged = true; | ||
| 366 | } | ||
| 367 | else | ||
| 368 | { | ||
| 369 | examine_engaged = false; | ||
| 370 | } | ||
| 371 | ret = false; | ||
| 372 | } | ||
| 373 | else // On release do nothing | ||
| 374 | { | ||
| 375 | ret = false; | ||
| 376 | } | ||
| 377 | break; | ||
| 378 | |||
| 379 | default: // For any key other than EX, simply let QMK process after saving away what it was | ||
| 380 | memset(lastKeycodeString, 0, sizeof(lastKeycodeString)); | ||
| 381 | memcpy(lastKeycodeString, translate_keycode_to_string(keycode), sizeof(((lookup_table_t *)0)->key_string)); | ||
| 382 | ret = true; | ||
| 383 | break; | ||
| 384 | } | ||
| 385 | |||
| 386 | return ret; | ||
| 89 | } | 387 | } |
| 90 | #endif | 388 | #endif |
diff --git a/keyboards/rocketboard_16/rules.mk b/keyboards/rocketboard_16/rules.mk index b1450c779..f8e2b217c 100644 --- a/keyboards/rocketboard_16/rules.mk +++ b/keyboards/rocketboard_16/rules.mk | |||
| @@ -2,7 +2,18 @@ | |||
| 2 | MCU = STM32F103 | 2 | MCU = STM32F103 |
| 3 | 3 | ||
| 4 | # Bootloader selection | 4 | # Bootloader selection |
| 5 | BOOTLOADER = stm32duino | 5 | # BOOTLOADER = stm32duino |
| 6 | |||
| 7 | # Custom loader configuration | ||
| 8 | MCU_LDSCRIPT = STM32F103xB_stm32duino_bootloader | ||
| 9 | OPT_DEFS += -DBOOTLOADER_STM32DUINO | ||
| 10 | BOARD = STM32_F103_STM32DUINO | ||
| 11 | STM32_BOOTLOADER_ADDRESS = 0x80000000 | ||
| 12 | DFU_ARGS = -d 1EAF:0003 -a 2 -R | ||
| 13 | DFU_SUFFIX_ARGS = -v 1EAF -p 0003 | ||
| 14 | |||
| 15 | # Extra include | ||
| 16 | SRC += keycode_lookup.c | ||
| 6 | 17 | ||
| 7 | # Build Options | 18 | # Build Options |
| 8 | # change yes to no to disable | 19 | # change yes to no to disable |
| @@ -24,5 +35,9 @@ OLED_ENABLE = yes | |||
| 24 | OLED_DRIVER = SSD1306 | 35 | OLED_DRIVER = SSD1306 |
| 25 | ENCODER_ENABLE = yes | 36 | ENCODER_ENABLE = yes |
| 26 | 37 | ||
| 38 | RAW_ENABLE = yes # Enables HID RAW communication between the board and the PC | ||
| 39 | |||
| 27 | # Enter lower-power sleep mode when on the ChibiOS idle thread | 40 | # Enter lower-power sleep mode when on the ChibiOS idle thread |
| 28 | OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE | 41 | OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE |
| 42 | |||
| 43 | LTO_ENABLE = yes | ||
