3 #include "outputselect.h"
7 #define TAPPING_TERM 200
10 static void do_code16 (uint16_t code, void (*f) (uint8_t)) {
12 case QK_MODS ... QK_MODS_MAX:
27 if (code < QK_RMODS_MIN) return;
39 static inline void qk_register_weak_mods(uint8_t kc) {
40 add_weak_mods(MOD_BIT(kc));
41 send_keyboard_report();
44 static inline void qk_unregister_weak_mods(uint8_t kc) {
45 del_weak_mods(MOD_BIT(kc));
46 send_keyboard_report();
49 static inline void qk_register_mods(uint8_t kc) {
50 add_weak_mods(MOD_BIT(kc));
51 send_keyboard_report();
54 static inline void qk_unregister_mods(uint8_t kc) {
55 del_weak_mods(MOD_BIT(kc));
56 send_keyboard_report();
59 void register_code16 (uint16_t code) {
60 if (IS_MOD(code) || code == KC_NO) {
61 do_code16 (code, qk_register_mods);
63 do_code16 (code, qk_register_weak_mods);
68 void unregister_code16 (uint16_t code) {
69 unregister_code (code);
70 if (IS_MOD(code) || code == KC_NO) {
71 do_code16 (code, qk_unregister_mods);
73 do_code16 (code, qk_unregister_weak_mods);
77 __attribute__ ((weak))
78 bool process_action_kb(keyrecord_t *record) {
82 __attribute__ ((weak))
83 bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
84 return process_record_user(keycode, record);
87 __attribute__ ((weak))
88 bool process_record_user(uint16_t keycode, keyrecord_t *record) {
92 void reset_keyboard(void) {
99 #ifdef CATERINA_BOOTLOADER
100 *(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific
105 // Shift / paren setup
108 #define LSPO_KEY KC_9
111 #define RSPC_KEY KC_0
114 static bool shift_interrupted[2] = {0, 0};
115 static uint16_t scs_timer = 0;
117 bool process_record_quantum(keyrecord_t *record) {
119 /* This gets the keycode from the key pressed */
120 keypos_t key = record->event.key;
123 #if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
124 /* TODO: Use store_or_get_action() or a similar function. */
125 if (!disable_action_cache) {
128 if (record->event.pressed) {
129 layer = layer_switch_get_layer(key);
130 update_source_layers_cache(key, layer);
132 layer = read_source_layers_cache(key);
134 keycode = keymap_key_to_keycode(layer, key);
137 keycode = keymap_key_to_keycode(layer_switch_get_layer(key), key);
139 // This is how you use actions here
140 // if (keycode == KC_LEAD) {
142 // action.code = ACTION_DEFAULT_LAYER_SET(0);
143 // process_action(record, action);
148 process_record_kb(keycode, record) &&
150 process_midi(keycode, record) &&
153 process_music(keycode, record) &&
155 #ifdef TAP_DANCE_ENABLE
156 process_tap_dance(keycode, record) &&
158 #ifndef DISABLE_LEADER
159 process_leader(keycode, record) &&
161 #ifndef DISABLE_CHORDING
162 process_chording(keycode, record) &&
165 process_combo(keycode, record) &&
167 #ifdef UNICODE_ENABLE
168 process_unicode(keycode, record) &&
171 process_ucis(keycode, record) &&
173 #ifdef PRINTING_ENABLE
174 process_printer(keycode, record) &&
176 #ifdef UNICODEMAP_ENABLE
177 process_unicode_map(keycode, record) &&
183 // Shift / paren setup
187 if (record->event.pressed) {
193 if (record->event.pressed) {
194 print("\nDEBUG: enabled.\n");
199 #ifdef RGBLIGHT_ENABLE
201 if (record->event.pressed) {
207 if (record->event.pressed) {
213 if (record->event.pressed) {
214 rgblight_increase_hue();
219 if (record->event.pressed) {
220 rgblight_decrease_hue();
225 if (record->event.pressed) {
226 rgblight_increase_sat();
231 if (record->event.pressed) {
232 rgblight_decrease_sat();
237 if (record->event.pressed) {
238 rgblight_increase_val();
243 if (record->event.pressed) {
244 rgblight_decrease_val();
251 if (record->event.pressed) {
252 set_output(OUTPUT_AUTO);
257 if (record->event.pressed) {
258 set_output(OUTPUT_USB);
262 #ifdef BLUETOOTH_ENABLE
264 if (record->event.pressed) {
265 set_output(OUTPUT_BLUETOOTH);
270 #ifdef ADAFRUIT_BLE_ENABLE
272 if (record->event.pressed) {
273 set_output(OUTPUT_ADAFRUIT_BLE);
279 case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_NKRO:
280 if (record->event.pressed) {
281 // MAGIC actions (BOOTMAGIC without the boot)
282 if (!eeconfig_is_enabled()) {
286 keymap_config.raw = eeconfig_read_keymap();
289 case MAGIC_SWAP_CONTROL_CAPSLOCK:
290 keymap_config.swap_control_capslock = true;
292 case MAGIC_CAPSLOCK_TO_CONTROL:
293 keymap_config.capslock_to_control = true;
295 case MAGIC_SWAP_LALT_LGUI:
296 keymap_config.swap_lalt_lgui = true;
298 case MAGIC_SWAP_RALT_RGUI:
299 keymap_config.swap_ralt_rgui = true;
302 keymap_config.no_gui = true;
304 case MAGIC_SWAP_GRAVE_ESC:
305 keymap_config.swap_grave_esc = true;
307 case MAGIC_SWAP_BACKSLASH_BACKSPACE:
308 keymap_config.swap_backslash_backspace = true;
310 case MAGIC_HOST_NKRO:
311 keymap_config.nkro = true;
313 case MAGIC_SWAP_ALT_GUI:
314 keymap_config.swap_lalt_lgui = true;
315 keymap_config.swap_ralt_rgui = true;
317 case MAGIC_UNSWAP_CONTROL_CAPSLOCK:
318 keymap_config.swap_control_capslock = false;
320 case MAGIC_UNCAPSLOCK_TO_CONTROL:
321 keymap_config.capslock_to_control = false;
323 case MAGIC_UNSWAP_LALT_LGUI:
324 keymap_config.swap_lalt_lgui = false;
326 case MAGIC_UNSWAP_RALT_RGUI:
327 keymap_config.swap_ralt_rgui = false;
330 keymap_config.no_gui = false;
332 case MAGIC_UNSWAP_GRAVE_ESC:
333 keymap_config.swap_grave_esc = false;
335 case MAGIC_UNSWAP_BACKSLASH_BACKSPACE:
336 keymap_config.swap_backslash_backspace = false;
338 case MAGIC_UNHOST_NKRO:
339 keymap_config.nkro = false;
341 case MAGIC_UNSWAP_ALT_GUI:
342 keymap_config.swap_lalt_lgui = false;
343 keymap_config.swap_ralt_rgui = false;
345 case MAGIC_TOGGLE_NKRO:
346 keymap_config.nkro = !keymap_config.nkro;
351 eeconfig_update_keymap(keymap_config.raw);
352 clear_keyboard(); // clear to prevent stuck keys
358 if (record->event.pressed) {
359 shift_interrupted[0] = false;
360 scs_timer = timer_read ();
361 register_mods(MOD_BIT(KC_LSFT));
364 #ifdef DISABLE_SPACE_CADET_ROLLOVER
365 if (get_mods() & MOD_BIT(KC_RSFT)) {
366 shift_interrupted[0] = true;
367 shift_interrupted[1] = true;
370 if (!shift_interrupted[0] && timer_elapsed(scs_timer) < TAPPING_TERM) {
371 register_code(LSPO_KEY);
372 unregister_code(LSPO_KEY);
374 unregister_mods(MOD_BIT(KC_LSFT));
381 if (record->event.pressed) {
382 shift_interrupted[1] = false;
383 scs_timer = timer_read ();
384 register_mods(MOD_BIT(KC_RSFT));
387 #ifdef DISABLE_SPACE_CADET_ROLLOVER
388 if (get_mods() & MOD_BIT(KC_LSFT)) {
389 shift_interrupted[0] = true;
390 shift_interrupted[1] = true;
393 if (!shift_interrupted[1] && timer_elapsed(scs_timer) < TAPPING_TERM) {
394 register_code(RSPC_KEY);
395 unregister_code(RSPC_KEY);
397 unregister_mods(MOD_BIT(KC_RSFT));
403 shift_interrupted[0] = true;
404 shift_interrupted[1] = true;
409 return process_action_kb(record);
412 const bool ascii_to_qwerty_shift_lut[0x80] PROGMEM = {
413 0, 0, 0, 0, 0, 0, 0, 0,
414 0, 0, 0, 0, 0, 0, 0, 0,
415 0, 0, 0, 0, 0, 0, 0, 0,
416 0, 0, 0, 0, 0, 0, 0, 0,
417 0, 1, 1, 1, 1, 1, 1, 0,
418 1, 1, 1, 1, 0, 0, 0, 0,
419 0, 0, 0, 0, 0, 0, 0, 0,
420 0, 0, 1, 0, 1, 0, 1, 1,
421 1, 1, 1, 1, 1, 1, 1, 1,
422 1, 1, 1, 1, 1, 1, 1, 1,
423 1, 1, 1, 1, 1, 1, 1, 1,
424 1, 1, 1, 0, 0, 0, 1, 1,
425 0, 0, 0, 0, 0, 0, 0, 0,
426 0, 0, 0, 0, 0, 0, 0, 0,
427 0, 0, 0, 0, 0, 0, 0, 0,
428 0, 0, 0, 1, 1, 1, 1, 0
431 const uint8_t ascii_to_qwerty_keycode_lut[0x80] PROGMEM = {
432 0, 0, 0, 0, 0, 0, 0, 0,
433 KC_BSPC, KC_TAB, KC_ENT, 0, 0, 0, 0, 0,
434 0, 0, 0, 0, 0, 0, 0, 0,
435 0, 0, 0, KC_ESC, 0, 0, 0, 0,
436 KC_SPC, KC_1, KC_QUOT, KC_3, KC_4, KC_5, KC_7, KC_QUOT,
437 KC_9, KC_0, KC_8, KC_EQL, KC_COMM, KC_MINS, KC_DOT, KC_SLSH,
438 KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7,
439 KC_8, KC_9, KC_SCLN, KC_SCLN, KC_COMM, KC_EQL, KC_DOT, KC_SLSH,
440 KC_2, KC_A, KC_B, KC_C, KC_D, KC_E, KC_F, KC_G,
441 KC_H, KC_I, KC_J, KC_K, KC_L, KC_M, KC_N, KC_O,
442 KC_P, KC_Q, KC_R, KC_S, KC_T, KC_U, KC_V, KC_W,
443 KC_X, KC_Y, KC_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_6, KC_MINS,
444 KC_GRV, KC_A, KC_B, KC_C, KC_D, KC_E, KC_F, KC_G,
445 KC_H, KC_I, KC_J, KC_K, KC_L, KC_M, KC_N, KC_O,
446 KC_P, KC_Q, KC_R, KC_S, KC_T, KC_U, KC_V, KC_W,
447 KC_X, KC_Y, KC_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_GRV, KC_DEL
450 /* for users whose OSes are set to Colemak */
452 #include "keymap_colemak.h"
454 const bool ascii_to_colemak_shift_lut[0x80] PROGMEM = {
455 0, 0, 0, 0, 0, 0, 0, 0,
456 0, 0, 0, 0, 0, 0, 0, 0,
457 0, 0, 0, 0, 0, 0, 0, 0,
458 0, 0, 0, 0, 0, 0, 0, 0,
459 0, 1, 1, 1, 1, 1, 1, 0,
460 1, 1, 1, 1, 0, 0, 0, 0,
461 0, 0, 0, 0, 0, 0, 0, 0,
462 0, 0, 1, 0, 1, 0, 1, 1,
463 1, 1, 1, 1, 1, 1, 1, 1,
464 1, 1, 1, 1, 1, 1, 1, 1,
465 1, 1, 1, 1, 1, 1, 1, 1,
466 1, 1, 1, 0, 0, 0, 1, 1,
467 0, 0, 0, 0, 0, 0, 0, 0,
468 0, 0, 0, 0, 0, 0, 0, 0,
469 0, 0, 0, 0, 0, 0, 0, 0,
470 0, 0, 0, 1, 1, 1, 1, 0
473 const uint8_t ascii_to_colemak_keycode_lut[0x80] PROGMEM = {
474 0, 0, 0, 0, 0, 0, 0, 0,
475 KC_BSPC, KC_TAB, KC_ENT, 0, 0, 0, 0, 0,
476 0, 0, 0, 0, 0, 0, 0, 0,
477 0, 0, 0, KC_ESC, 0, 0, 0, 0,
478 KC_SPC, KC_1, KC_QUOT, KC_3, KC_4, KC_5, KC_7, KC_QUOT,
479 KC_9, KC_0, KC_8, KC_EQL, KC_COMM, KC_MINS, KC_DOT, KC_SLSH,
480 KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7,
481 KC_8, KC_9, CM_SCLN, CM_SCLN, KC_COMM, KC_EQL, KC_DOT, KC_SLSH,
482 KC_2, CM_A, CM_B, CM_C, CM_D, CM_E, CM_F, CM_G,
483 CM_H, CM_I, CM_J, CM_K, CM_L, CM_M, CM_N, CM_O,
484 CM_P, CM_Q, CM_R, CM_S, CM_T, CM_U, CM_V, CM_W,
485 CM_X, CM_Y, CM_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_6, KC_MINS,
486 KC_GRV, CM_A, CM_B, CM_C, CM_D, CM_E, CM_F, CM_G,
487 CM_H, CM_I, CM_J, CM_K, CM_L, CM_M, CM_N, CM_O,
488 CM_P, CM_Q, CM_R, CM_S, CM_T, CM_U, CM_V, CM_W,
489 CM_X, CM_Y, CM_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_GRV, KC_DEL
494 void send_string(const char *str) {
497 uint8_t ascii_code = pgm_read_byte(str);
498 if (!ascii_code) break;
499 keycode = pgm_read_byte(&ascii_to_qwerty_keycode_lut[ascii_code]);
500 if (pgm_read_byte(&ascii_to_qwerty_shift_lut[ascii_code])) {
501 register_code(KC_LSFT);
502 register_code(keycode);
503 unregister_code(keycode);
504 unregister_code(KC_LSFT);
507 register_code(keycode);
508 unregister_code(keycode);
514 void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
515 if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
522 void tap_random_base64(void) {
523 #if defined(__AVR_ATmega32U4__)
524 uint8_t key = (TCNT0 + TCNT1 + TCNT3 + TCNT4) % 64;
526 uint8_t key = rand() % 64;
530 register_code(KC_LSFT);
531 register_code(key + KC_A);
532 unregister_code(key + KC_A);
533 unregister_code(KC_LSFT);
536 register_code(key - 26 + KC_A);
537 unregister_code(key - 26 + KC_A);
541 unregister_code(KC_0);
544 register_code(key - 53 + KC_1);
545 unregister_code(key - 53 + KC_1);
548 register_code(KC_LSFT);
549 register_code(KC_EQL);
550 unregister_code(KC_EQL);
551 unregister_code(KC_LSFT);
554 register_code(KC_SLSH);
555 unregister_code(KC_SLSH);
560 void matrix_init_quantum() {
561 #ifdef BACKLIGHT_ENABLE
562 backlight_init_ports();
567 void matrix_scan_quantum() {
572 #ifdef TAP_DANCE_ENABLE
573 matrix_scan_tap_dance();
583 #if defined(BACKLIGHT_ENABLE) && defined(BACKLIGHT_PIN)
585 static const uint8_t backlight_pin = BACKLIGHT_PIN;
587 #if BACKLIGHT_PIN == B7
588 # define COM1x1 COM1C1
590 #elif BACKLIGHT_PIN == B6
591 # define COM1x1 COM1B1
593 #elif BACKLIGHT_PIN == B5
594 # define COM1x1 COM1A1
597 # error "Backlight pin not supported - use B5, B6, or B7"
600 __attribute__ ((weak))
601 void backlight_init_ports(void)
604 // Setup backlight pin as output and output low.
606 _SFR_IO8((backlight_pin >> 4) + 1) |= _BV(backlight_pin & 0xF);
608 _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF);
610 // Use full 16-bit resolution.
613 // I could write a wall of text here to explain... but TL;DW
614 // Go read the ATmega32u4 datasheet.
615 // And this: http://blog.saikoled.com/post/43165849837/secret-konami-cheat-code-to-high-resolution-pwm-on
617 // Pin PB7 = OCR1C (Timer 1, Channel C)
618 // Compare Output Mode = Clear on compare match, Channel C = COM1C1=1 COM1C0=0
619 // (i.e. start high, go low when counter matches.)
620 // WGM Mode 14 (Fast PWM) = WGM13=1 WGM12=1 WGM11=1 WGM10=0
621 // Clock Select = clk/1 (no prescaling) = CS12=0 CS11=0 CS10=1
623 TCCR1A = _BV(COM1x1) | _BV(WGM11); // = 0b00001010;
624 TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001;
627 #ifdef BACKLIGHT_BREATHING
628 breathing_defaults();
632 __attribute__ ((weak))
633 void backlight_set(uint8_t level)
635 // Prevent backlight blink on lowest level
637 _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF);
640 // Turn off PWM control on backlight pin, revert to output low.
641 TCCR1A &= ~(_BV(COM1x1));
643 } else if ( level == BACKLIGHT_LEVELS ) {
644 // Turn on PWM control of backlight pin
645 TCCR1A |= _BV(COM1x1);
646 // Set the brightness
649 // Turn on PWM control of backlight pin
650 TCCR1A |= _BV(COM1x1);
651 // Set the brightness
652 OCR1x = 0xFFFF >> ((BACKLIGHT_LEVELS - level) * ((BACKLIGHT_LEVELS + 1) / 2));
655 #ifdef BACKLIGHT_BREATHING
656 breathing_intensity_default();
661 #ifdef BACKLIGHT_BREATHING
663 #define BREATHING_NO_HALT 0
664 #define BREATHING_HALT_OFF 1
665 #define BREATHING_HALT_ON 2
667 static uint8_t breath_intensity;
668 static uint8_t breath_speed;
669 static uint16_t breathing_index;
670 static uint8_t breathing_halt;
672 void breathing_enable(void)
674 if (get_backlight_level() == 0)
680 // Set breathing_index to be at the midpoint (brightest point)
681 breathing_index = 0x20 << breath_speed;
684 breathing_halt = BREATHING_NO_HALT;
686 // Enable breathing interrupt
687 TIMSK1 |= _BV(OCIE1A);
690 void breathing_pulse(void)
692 if (get_backlight_level() == 0)
698 // Set breathing_index to be at the midpoint + 1 (brightest point)
699 breathing_index = 0x21 << breath_speed;
702 breathing_halt = BREATHING_HALT_ON;
704 // Enable breathing interrupt
705 TIMSK1 |= _BV(OCIE1A);
708 void breathing_disable(void)
710 // Disable breathing interrupt
711 TIMSK1 &= ~_BV(OCIE1A);
712 backlight_set(get_backlight_level());
715 void breathing_self_disable(void)
717 if (get_backlight_level() == 0)
719 breathing_halt = BREATHING_HALT_OFF;
723 breathing_halt = BREATHING_HALT_ON;
726 //backlight_set(get_backlight_level());
729 void breathing_toggle(void)
733 if (get_backlight_level() == 0)
739 // Set breathing_index to be at the midpoint + 1 (brightest point)
740 breathing_index = 0x21 << breath_speed;
743 breathing_halt = BREATHING_NO_HALT;
746 // Toggle breathing interrupt
747 TIMSK1 ^= _BV(OCIE1A);
749 // Restore backlight level
752 backlight_set(get_backlight_level());
756 bool is_breathing(void)
758 return (TIMSK1 && _BV(OCIE1A));
761 void breathing_intensity_default(void)
763 //breath_intensity = (uint8_t)((uint16_t)100 * (uint16_t)get_backlight_level() / (uint16_t)BACKLIGHT_LEVELS);
764 breath_intensity = ((BACKLIGHT_LEVELS - get_backlight_level()) * ((BACKLIGHT_LEVELS + 1) / 2));
767 void breathing_intensity_set(uint8_t value)
769 breath_intensity = value;
772 void breathing_speed_default(void)
777 void breathing_speed_set(uint8_t value)
779 bool is_breathing_now = is_breathing();
780 uint8_t old_breath_speed = breath_speed;
782 if (is_breathing_now)
784 // Disable breathing interrupt
785 TIMSK1 &= ~_BV(OCIE1A);
788 breath_speed = value;
790 if (is_breathing_now)
792 // Adjust index to account for new speed
793 breathing_index = (( (uint8_t)( (breathing_index) >> old_breath_speed ) ) & 0x3F) << breath_speed;
795 // Enable breathing interrupt
796 TIMSK1 |= _BV(OCIE1A);
801 void breathing_speed_inc(uint8_t value)
803 if ((uint16_t)(breath_speed - value) > 10 )
805 breathing_speed_set(0);
809 breathing_speed_set(breath_speed - value);
813 void breathing_speed_dec(uint8_t value)
815 if ((uint16_t)(breath_speed + value) > 10 )
817 breathing_speed_set(10);
821 breathing_speed_set(breath_speed + value);
825 void breathing_defaults(void)
827 breathing_intensity_default();
828 breathing_speed_default();
829 breathing_halt = BREATHING_NO_HALT;
832 /* Breathing Sleep LED brighness(PWM On period) table
833 * (64[steps] * 4[duration]) / 64[PWM periods/s] = 4 second breath cycle
835 * http://www.wolframalpha.com/input/?i=%28sin%28+x%2F64*pi%29**8+*+255%2C+x%3D0+to+63
836 * (0..63).each {|x| p ((sin(x/64.0*PI)**8)*255).to_i }
838 static const uint8_t breathing_table[64] PROGMEM = {
839 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 6, 10,
840 15, 23, 32, 44, 58, 74, 93, 113, 135, 157, 179, 199, 218, 233, 245, 252,
841 255, 252, 245, 233, 218, 199, 179, 157, 135, 113, 93, 74, 58, 44, 32, 23,
842 15, 10, 6, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
845 ISR(TIMER1_COMPA_vect)
847 // OCR1x = (pgm_read_byte(&breathing_table[ ( (uint8_t)( (breathing_index++) >> breath_speed ) ) & 0x3F ] )) * breath_intensity;
850 uint8_t local_index = ( (uint8_t)( (breathing_index++) >> breath_speed ) ) & 0x3F;
852 if (((breathing_halt == BREATHING_HALT_ON) && (local_index == 0x20)) || ((breathing_halt == BREATHING_HALT_OFF) && (local_index == 0x3F)))
854 // Disable breathing interrupt
855 TIMSK1 &= ~_BV(OCIE1A);
858 OCR1x = (uint16_t)(((uint16_t)pgm_read_byte(&breathing_table[local_index]) * 257)) >> breath_intensity;
868 __attribute__ ((weak))
869 void backlight_init_ports(void)
874 __attribute__ ((weak))
875 void backlight_set(uint8_t level)
883 // Functions for spitting out values
886 void send_dword(uint32_t number) { // this might not actually work
887 uint16_t word = (number >> 16);
889 send_word(number & 0xFFFFUL);
892 void send_word(uint16_t number) {
893 uint8_t byte = number >> 8;
895 send_byte(number & 0xFF);
898 void send_byte(uint8_t number) {
899 uint8_t nibble = number >> 4;
901 send_nibble(number & 0xF);
904 void send_nibble(uint8_t number) {
908 unregister_code(KC_0);
911 register_code(KC_1 + (number - 1));
912 unregister_code(KC_1 + (number - 1));
915 register_code(KC_A + (number - 0xA));
916 unregister_code(KC_A + (number - 0xA));
921 void api_send_unicode(uint32_t unicode) {
924 dword_to_bytes(unicode, chunk);
925 MT_SEND_DATA(DT_UNICODE, chunk, 5);
929 __attribute__ ((weak))
930 void led_set_user(uint8_t usb_led) {
934 __attribute__ ((weak))
935 void led_set_kb(uint8_t usb_led) {
936 led_set_user(usb_led);
939 __attribute__ ((weak))
940 void led_init_ports(void)
945 __attribute__ ((weak))
946 void led_set(uint8_t usb_led)
951 // // Using PE6 Caps Lock LED
952 // if (usb_led & (1<<USB_LED_CAPS_LOCK))
969 //------------------------------------------------------------------------------
970 // Override these functions in your keymap file to play different tunes on
971 // different events such as startup and bootloader jump
973 __attribute__ ((weak))
974 void startup_user() {}
976 __attribute__ ((weak))
977 void shutdown_user() {}
979 //------------------------------------------------------------------------------