diff options
| author | QMK Bot <hello@qmk.fm> | 2022-10-15 21:23:33 +0000 |
|---|---|---|
| committer | QMK Bot <hello@qmk.fm> | 2022-10-15 21:23:33 +0000 |
| commit | 3fe9fbf950c8a27462957ed1309ec2eeb15cb7e9 (patch) | |
| tree | 261cb337f9d0877fb4ad390b39b1192811ec1cdb /users | |
| parent | 2b24f16779b642d0a20f19a2767645a6ec0b1952 (diff) | |
| parent | ccdd28930a8f399f3dfd5e39a14e3972e5bc1872 (diff) | |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'users')
| -rw-r--r-- | users/riblee/riblee.c | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/users/riblee/riblee.c b/users/riblee/riblee.c index 02ba246f60..937e603b7a 100644 --- a/users/riblee/riblee.c +++ b/users/riblee/riblee.c | |||
| @@ -15,7 +15,6 @@ | |||
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #include "riblee.h" | 17 | #include "riblee.h" |
| 18 | #include "raw_hid.h" | ||
| 19 | #include <string.h> | 18 | #include <string.h> |
| 20 | 19 | ||
| 21 | // Tap Dance functions | 20 | // Tap Dance functions |
| @@ -166,109 +165,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 166 | return true; | 165 | return true; |
| 167 | }; | 166 | }; |
| 168 | 167 | ||
| 169 | #ifdef OLED_ENABLE | ||
| 170 | |||
| 171 | static char receive_buffer[128] = {}; | ||
| 172 | static uint8_t receive_buffer_length = 0; | ||
| 173 | uint16_t startup_timer; | ||
| 174 | |||
| 175 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { | ||
| 176 | startup_timer = timer_read(); | ||
| 177 | return rotation; | ||
| 178 | } | ||
| 179 | |||
| 180 | static void render_logo(void) { | ||
| 181 | static const char PROGMEM raw_logo[] = { | ||
| 182 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 183 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 184 | 0, 0, 0, 0, 0, 96, 96, 96,240,248,255, 63, 56,255,255,248, 63, 63,248,255,255, 56, 63,255,248,240, 96, 96, 96, 0, 0, 0, 0, 0,252,254, 38, 54, 60, 8,240,152,152,248,240, 24,248,224,248,120,224,240,120, 96,248,248,248,248, 32,248,248, 24, 24,240,248,248,248,240,240,248,152,152,254,254, 0, 0, 0,254,254,152,248,240, 24,248,224,240,120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 185 | 0, 0, 0, 0, 0,219,219,219,255,255,255,240,192,143,159, 63, 0, 0, 63,159,143,192,240,255,255,255,219,219,219, 0, 0, 0, 0, 0,192,225,112, 48, 48, 48,112,225,129, 1,240,240,240,193, 1, 0, 1,193,240,240,241, 1, 1,241,240,193,225,112, 48, 0, 1, 1, 1, 1,240,241, 49, 49, 49, 0,240,240, 0,129,193,129,193,192, 0,196,135,193,192,128,128,192,192,128, 0, 0,192,128, 0,128,192,128, 0, 0,192,192,128,128,192,192,192,128, 0,128,192,128,192,192, 0,128,192,192,192,128, 0, 0, 0, 0, 0, 0, | ||
| 186 | 0, 0, 0, 0, 0, 6, 6, 6, 15, 31,255,255, 31,255,255, 31,252,252, 31,255,255, 31,255,255, 31, 15, 6, 6, 6, 0, 0, 0, 0, 0, 15, 31, 56, 48, 48, 48, 60,127,103, 96, 63, 63, 0, 7, 63, 56, 31, 7, 0, 63, 63, 0, 0, 63, 63, 7, 30, 60, 48, 0, 0, 0, 0, 0, 63, 31, 3, 3, 3, 0, 63, 63, 0, 31, 63, 1, 0, 0, 0, 63, 31, 0, 1, 63, 63, 0, 0, 63, 63, 0, 7, 63, 60, 63, 7, 31, 60, 63, 15, 0, 28, 60, 54, 54, 63, 63, 0, 63, 63, 1, 0, 0, 31, 63, 54, 54, 55, 55, 2, 0, 0, 0, 0, 0, | ||
| 187 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,128,128,128,128,128,128, 0, 0,192,192,192, 0,192,192,192, 0, 0, 0, 0, 0, 0,192,192,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 188 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255, 29,127,255,247,224, 0,254,254,254, 0,255,255,255,198,254,254,254, 0, 0,255,255,255,124,254,254,214,214,222,222, 92,124,254,254,214,214,222,222, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 189 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 190 | }; | ||
| 191 | |||
| 192 | oled_write_raw_P(raw_logo, sizeof(raw_logo)); | ||
| 193 | } | ||
| 194 | |||
| 195 | static void render_info(void) { | ||
| 196 | // Keyboard Layer Status | ||
| 197 | oled_write_P(PSTR("Layer: "), false); | ||
| 198 | |||
| 199 | switch (get_highest_layer(layer_state)) { | ||
| 200 | case _QWERTY: | ||
| 201 | if (layer_state_cmp(default_layer_state, _QWERTY)) { | ||
| 202 | oled_write_P(PSTR("Qwerty\n"), false); | ||
| 203 | } else if (layer_state_cmp(default_layer_state, _COLEMAK)) { | ||
| 204 | oled_write_P(PSTR("Colmak\n"), false); | ||
| 205 | } else if (layer_state_cmp(default_layer_state, _DVORAK)) { | ||
| 206 | oled_write_P(PSTR("Dvorak\n"), false); | ||
| 207 | } else if (layer_state_cmp(default_layer_state, _WORKMAN)) { | ||
| 208 | oled_write_P(PSTR("Workman\n"), false); | ||
| 209 | } else if (layer_state_cmp(default_layer_state, _HUNGARIAN)) { | ||
| 210 | oled_write_P(PSTR("HUN Qwerty\n"), false); | ||
| 211 | } else { | ||
| 212 | oled_write_P(PSTR("Undefined\n"), false); | ||
| 213 | } | ||
| 214 | break; | ||
| 215 | case _LOWER: | ||
| 216 | oled_write_P(PSTR("Lower\n"), false); | ||
| 217 | break; | ||
| 218 | case _RAISE: | ||
| 219 | oled_write_P(PSTR("Raise\n"), false); | ||
| 220 | break; | ||
| 221 | case _ADJUST: | ||
| 222 | oled_write_P(PSTR("Adjust\n"), false); | ||
| 223 | break; | ||
| 224 | default: | ||
| 225 | oled_write_P(PSTR("Undefined\n"), false); | ||
| 226 | } | ||
| 227 | |||
| 228 | // Print string received via HID RAW | ||
| 229 | oled_write_ln(receive_buffer, false);} | ||
| 230 | |||
| 231 | bool oled_task_user(void) { | ||
| 232 | static bool finished_timer = false; | ||
| 233 | if (!finished_timer && (timer_elapsed(startup_timer) < 1000)) { | ||
| 234 | render_logo(); | ||
| 235 | } else { | ||
| 236 | if (!finished_timer) { | ||
| 237 | oled_clear(); | ||
| 238 | finished_timer = true; | ||
| 239 | } | ||
| 240 | render_info(); | ||
| 241 | } | ||
| 242 | return false; | ||
| 243 | |||
| 244 | } | ||
| 245 | |||
| 246 | #ifdef RAW_ENABLE | ||
| 247 | |||
| 248 | void raw_hid_receive(uint8_t *data, uint8_t length) { | ||
| 249 | |||
| 250 | // Append data to receive_buffer, without the first byte | ||
| 251 | memcpy(receive_buffer + receive_buffer_length, data + 1, length - 1); | ||
| 252 | receive_buffer_length += (length - 1); | ||
| 253 | |||
| 254 | // First byte indicate if we will recive more package for the current string | ||
| 255 | // If it's 1 then this was the last package and we can reset the offset | ||
| 256 | if (data[0] == 1) { | ||
| 257 | // Reset the offset for memcpy to the begining of our buffer | ||
| 258 | receive_buffer_length = 0; | ||
| 259 | } | ||
| 260 | |||
| 261 | // Reset the offset to prevent overwriting memory outside of the buffer | ||
| 262 | if (receive_buffer_length + 32 >= 128) { | ||
| 263 | receive_buffer_length = 0; | ||
| 264 | } | ||
| 265 | |||
| 266 | } | ||
| 267 | |||
| 268 | #endif | ||
| 269 | |||
| 270 | #endif | ||
| 271 | |||
| 272 | void keyboard_pre_init_user(void) { | 168 | void keyboard_pre_init_user(void) { |
| 273 | // Set C13 pin as output | 169 | // Set C13 pin as output |
| 274 | setPinOutput(C13); | 170 | setPinOutput(C13); |
