Esempio n. 1
0
static void print_eeconfig(void)
{
    print("default_layer: "); print_dec(eeconfig_read_default_layer()); print("\n");

    debug_config_t dc;
    dc.raw = eeconfig_read_debug();
    print("debug_config.raw: "); print_hex8(dc.raw); print("\n");
    print(".enable: "); print_dec(dc.enable); print("\n");
    print(".matrix: "); print_dec(dc.matrix); print("\n");
    print(".keyboard: "); print_dec(dc.keyboard); print("\n");
    print(".mouse: "); print_dec(dc.mouse); print("\n");

    keymap_config_t kc;
    kc.raw = eeconfig_read_keymap();
    print("keymap_config.raw: "); print_hex8(kc.raw); print("\n");
    print(".swap_control_capslock: "); print_dec(kc.swap_control_capslock); print("\n");
    print(".capslock_to_control: "); print_dec(kc.capslock_to_control); print("\n");
    print(".swap_lalt_lgui: "); print_dec(kc.swap_lalt_lgui); print("\n");
    print(".swap_ralt_rgui: "); print_dec(kc.swap_ralt_rgui); print("\n");
    print(".no_gui: "); print_dec(kc.no_gui); print("\n");
    print(".swap_grave_esc: "); print_dec(kc.swap_grave_esc); print("\n");
    print(".swap_backslash_backspace: "); print_dec(kc.swap_backslash_backspace); print("\n");

#ifdef BACKLIGHT_ENABLE
    backlight_config_t bc;
    bc.raw = eeconfig_read_backlight();
    print("backlight_config.raw: "); print_hex8(bc.raw); print("\n");
    print(".enable: "); print_dec(bc.enable); print("\n");
    print(".level: "); print_dec(bc.level); print("\n");
#endif
}
Esempio n. 2
0
void matrix_init_user(void) {
    // This keymap only has a single base layer, so reset the default if needed
    if(eeconfig_read_default_layer() > 1){
        eeconfig_update_default_layer(1);
        default_layer_set(1);
    }
}
Esempio n. 3
0
// Call user matrix init, set default RGB colors and then
// call the keymap's init function
void matrix_init_user(void) {
#ifdef RGBLIGHT_ENABLE
  uint8_t default_layer = eeconfig_read_default_layer();

  rgblight_enable();

  if (true) {
    if (default_layer & (1UL << _COLEMAK)) {
      rgblight_set_magenta;
    }
    else if (default_layer & (1UL << _DVORAK)) {
      rgblight_set_green;
    }
    else if (default_layer & (1UL << _WORKMAN)) {
      rgblight_set_purple;
    }
    else {
      rgblight_set_teal;
    }
  }
  else
  {
    rgblight_set_red;
    rgblight_mode(5);
  }
#endif
#ifdef AUDIO_ENABLE
//  wait_ms(21); // gets rid of tick
//  stop_all_notes();
//  PLAY_SONG(tone_hackstartup);
#endif
  matrix_init_keymap();
}
Esempio n. 4
0
// Set LED according to the default layer
void default_layer_led_set(void) {
    switch (biton32(eeconfig_read_default_layer())) {
      case COLEMAK:
        // LED2 for COLEMAK
        ergodox_right_led_2_on();
        break;
      case QWERTY:
        // LED3 for QWERTY
        ergodox_right_led_3_on();
        break;
    };
};
Esempio n. 5
0
void magic(void)
{
    /* check signature */
    if (!eeconfig_is_enabled()) {
        eeconfig_init();
    }

    /* debug enable */
    debug_config.raw = eeconfig_read_debug();

    /* keymap config */
    keymap_config.raw = eeconfig_read_keymap();

    uint8_t default_layer = 0;
    default_layer = eeconfig_read_default_layer();
    default_layer_set((uint32_t)default_layer);

}
Esempio n. 6
0
void keyboard_post_init_rgb(void) {

#ifdef RGBLIGHT_ENABLE
  if (userspace_config.rgb_layer_change) {
    rgblight_enable_noeeprom();
    switch (biton32(eeconfig_read_default_layer())) {
      case _COLEMAK:
        rgblight_sethsv_noeeprom_magenta(); break;
      case _DVORAK:
        rgblight_sethsv_noeeprom_springgreen(); break;
      case _WORKMAN:
        rgblight_sethsv_noeeprom_goldenrod(); break;
      default:
        rgblight_sethsv_noeeprom_cyan(); break;
    }
    rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
  }
#endif
}
Esempio n. 7
0
static void print_eeconfig(void)
{

// Print these variables if NO_PRINT or USER_PRINT are not defined.
#if !defined(NO_PRINT) && !defined(USER_PRINT)

    print("default_layer: "); print_dec(eeconfig_read_default_layer()); print("\n");

    debug_config_t dc;
    dc.raw = eeconfig_read_debug();
    print("debug_config.raw: "); print_hex8(dc.raw); print("\n");
    print(".enable: "); print_dec(dc.enable); print("\n");
    print(".matrix: "); print_dec(dc.matrix); print("\n");
    print(".keyboard: "); print_dec(dc.keyboard); print("\n");
    print(".mouse: "); print_dec(dc.mouse); print("\n");

    keymap_config_t kc;
    kc.raw = eeconfig_read_keymap();
    print("keymap_config.raw: "); print_hex8(kc.raw); print("\n");
    print(".swap_control_capslock: "); print_dec(kc.swap_control_capslock); print("\n");
    print(".capslock_to_control: "); print_dec(kc.capslock_to_control); print("\n");
    print(".swap_lalt_lgui: "); print_dec(kc.swap_lalt_lgui); print("\n");
    print(".swap_ralt_rgui: "); print_dec(kc.swap_ralt_rgui); print("\n");
    print(".no_gui: "); print_dec(kc.no_gui); print("\n");
    print(".swap_grave_esc: "); print_dec(kc.swap_grave_esc); print("\n");
    print(".swap_backslash_backspace: "); print_dec(kc.swap_backslash_backspace); print("\n");
    print(".nkro: "); print_dec(kc.nkro); print("\n");

#ifdef BACKLIGHT_ENABLE
    backlight_config_t bc;
    bc.raw = eeconfig_read_backlight();
    print("backlight_config.raw: "); print_hex8(bc.raw); print("\n");
    print(".enable: "); print_dec(bc.enable); print("\n");
    print(".level: "); print_dec(bc.level); print("\n");
#endif /* BACKLIGHT_ENABLE */

#endif /* !NO_PRINT */

}
Esempio n. 8
0
void matrix_init_rgb(void) {
#ifdef INDICATOR_LIGHTS
  current_mod = last_mod = get_mods();
  current_led = last_led = host_keyboard_leds();
  current_osm = last_osm = get_oneshot_mods();
#endif

  if (userspace_config.rgb_layer_change) {
    rgblight_enable_noeeprom();
    switch (biton32(eeconfig_read_default_layer())) {
      case _COLEMAK:
        rgblight_sethsv_noeeprom_magenta(); break;
      case _DVORAK:
        rgblight_sethsv_noeeprom_springgreen(); break;
      case _WORKMAN:
        rgblight_sethsv_noeeprom_goldenrod(); break;
      default:
        rgblight_sethsv_noeeprom_cyan(); break;
    }
    rgblight_mode_noeeprom(1);
  }
}
Esempio n. 9
0
// Runs state check and changes underglow color and animation
// on layer change, no matter where the change was initiated
// Then runs keymap's layer change check
uint32_t layer_state_set_user(uint32_t state) {
#ifdef RGBLIGHT_ENABLE
  uint8_t default_layer = eeconfig_read_default_layer();
  if (rgb_layer_change) {
    switch (biton32(state)) {
    case _NAV:
      rgblight_set_blue;
      rgblight_mode(1);
      break;
    case _SYMB:
      rgblight_set_blue;
      rgblight_mode(2);
      break;
    case _MOUS:
      rgblight_set_yellow;
      rgblight_mode(1);
      break;
    case _MACROS:
      rgblight_set_orange;
      is_overwatch ? rgblight_mode(17) : rgblight_mode(18);
      break;
    case _MEDIA:
      rgblight_set_green;
      rgblight_mode(22);
      break;
    case _GAMEPAD:
      rgblight_set_orange;
      rgblight_mode(17);
      break;
    case _DIABLO:
      rgblight_set_red;
      rgblight_mode(5);
      break;
    case _RAISE:
      rgblight_set_yellow;
      rgblight_mode(5);
      break;
    case _LOWER:
      rgblight_set_orange;
      rgblight_mode(5);
      break;
    case _ADJUST:
      rgblight_set_red;
      rgblight_mode(23);
      break;
    case _COVECUBE:
      rgblight_set_green;
      rgblight_mode(2);
      break;
    default:
      if (default_layer & (1UL << _COLEMAK)) {
        rgblight_set_magenta;
      }
      else if (default_layer & (1UL << _DVORAK)) {
        rgblight_set_green;
      }
      else if (default_layer & (1UL << _WORKMAN)) {
        rgblight_set_purple;
      }
      else {
        rgblight_set_teal;
      }
      rgblight_mode(1);
      break;
    }
  }
#endif
  return layer_state_set_keymap (state);
}
Esempio n. 10
0
void bootmagic(void)
{
    /* check signature */
    if (!eeconfig_is_enabled()) {
        eeconfig_init();
    }

    /* do scans in case of bounce */
    print("bootmagic scan: ... ");
    uint8_t scan = 100;
    while (scan--) { matrix_scan(); wait_ms(10); }
    print("done.\n");

    /* bootmagic skip */
    if (bootmagic_scan_key(BOOTMAGIC_KEY_SKIP)) {
        return;
    }

    /* eeconfig clear */
    if (bootmagic_scan_key(BOOTMAGIC_KEY_EEPROM_CLEAR)) {
        eeconfig_init();
#ifdef KEYMAP_IN_EEPROM_ENABLE
        write_keymap_to_eeprom();
#endif
#ifdef LEDMAP_IN_EEPROM_ENABLE
        write_ledmap_to_eeprom();
#endif
    }

    /* bootloader */
    if (bootmagic_scan_key(BOOTMAGIC_KEY_BOOTLOADER)) {
        bootloader_jump();
    }

    /* user-defined checks */
    hook_bootmagic();

    /* debug enable */
    debug_config.raw = eeconfig_read_debug();
    if (bootmagic_scan_key(BOOTMAGIC_KEY_DEBUG_ENABLE)) {
        if (bootmagic_scan_key(BOOTMAGIC_KEY_DEBUG_MATRIX)) {
            debug_config.matrix = !debug_config.matrix;
        } else if (bootmagic_scan_key(BOOTMAGIC_KEY_DEBUG_KEYBOARD)) {
            debug_config.keyboard = !debug_config.keyboard;
        } else if (bootmagic_scan_key(BOOTMAGIC_KEY_DEBUG_MOUSE)) {
            debug_config.mouse = !debug_config.mouse;
        } else {
            debug_config.enable = !debug_config.enable;
        }
    }
    eeconfig_write_debug(debug_config.raw);

    /* keymap config */
    keymap_config.raw = eeconfig_read_keymap();
    if (bootmagic_scan_key(BOOTMAGIC_KEY_SWAP_CONTROL_CAPSLOCK)) {
        keymap_config.swap_control_capslock = !keymap_config.swap_control_capslock;
    }
    if (bootmagic_scan_key(BOOTMAGIC_KEY_CAPSLOCK_TO_CONTROL)) {
        keymap_config.capslock_to_control = !keymap_config.capslock_to_control;
    }
    if (bootmagic_scan_key(BOOTMAGIC_KEY_SWAP_LALT_LGUI)) {
        keymap_config.swap_lalt_lgui = !keymap_config.swap_lalt_lgui;
    }
    if (bootmagic_scan_key(BOOTMAGIC_KEY_SWAP_RALT_RGUI)) {
        keymap_config.swap_ralt_rgui = !keymap_config.swap_ralt_rgui;
    }
    if (bootmagic_scan_key(BOOTMAGIC_KEY_NO_GUI)) {
        keymap_config.no_gui = !keymap_config.no_gui;
    }
    if (bootmagic_scan_key(BOOTMAGIC_KEY_SWAP_GRAVE_ESC)) {
        keymap_config.swap_grave_esc = !keymap_config.swap_grave_esc;
    }
    if (bootmagic_scan_key(BOOTMAGIC_KEY_SWAP_BACKSLASH_BACKSPACE)) {
        keymap_config.swap_backslash_backspace = !keymap_config.swap_backslash_backspace;
    }
    if (bootmagic_scan_key(BOOTMAGIC_HOST_NKRO)) {
        keymap_config.nkro = !keymap_config.nkro;
    }
    eeconfig_write_keymap(keymap_config.raw);

#ifdef NKRO_ENABLE
    keyboard_nkro = keymap_config.nkro;
#endif

    /* default layer */
    uint8_t default_layer = 0;
    if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_0)) { default_layer |= (1<<0); }
    if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_1)) { default_layer |= (1<<1); }
    if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_2)) { default_layer |= (1<<2); }
    if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_3)) { default_layer |= (1<<3); }
    if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_4)) { default_layer |= (1<<4); }
    if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_5)) { default_layer |= (1<<5); }
    if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_6)) { default_layer |= (1<<6); }
    if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_7)) { default_layer |= (1<<7); }
    if (default_layer) {
        eeconfig_write_default_layer(default_layer);
        default_layer_set((uint32_t)default_layer);
    } else {
        default_layer = eeconfig_read_default_layer();
        default_layer_set((uint32_t)default_layer);
    }
}
Esempio n. 11
0
void matrix_scan_user(void) {  // runs frequently to update info
    uint8_t modifiders = get_mods();
    uint8_t layer = biton32(layer_state);
    static bool has_layer_changed = true;

    if (!skip_leds) {
        ergodox_board_led_off();
        ergodox_right_led_1_off();
        ergodox_right_led_2_off();
        ergodox_right_led_3_off();
        
        // Since we're not using the LEDs here for layer indication anymore,
        // then lets use them for modifier indicators.  Shame we don't have 4...
        // Also, no "else", since we want to know each, independantly. 
        if ( modifiders & MODS_SHIFT_MASK) {
            ergodox_right_led_2_on();
        }
        if ( modifiders & MODS_CTRL_MASK) {
            ergodox_right_led_1_on();
        }
        if ( modifiders & MODS_ALT_MASK) {
            ergodox_right_led_3_on();
        }
        
    }
    if (layer != current_layer) {
        has_layer_changed = true;
        current_layer = layer;
    }
    // Check layer, and apply color if its changed since last check
    if (has_layer_changed) {
        uint8_t default_layer = 0;
        default_layer = eeconfig_read_default_layer();

        switch (layer) {
            case SYMB:
                rgblight_set_blue;
                rgblight_mode(2);
                break;
            case OVERWATCH:
                rgblight_set_orange;
                rgblight_mode(17);
                break;
            case DIABLO:
                rgblight_set_red;
                rgblight_mode(5);
                break;
            case MOUS:
                rgblight_set_urine;
                rgblight_mode(1);
                break;
            case 7:
                rgblight_sethsv (255,255,255);
                rgblight_mode(1);
                break;
            default:
                if (default_layer & (1UL << COLEMAK)) {
                    rgblight_set_green;
                }
                else if (default_layer & (1UL << DVORAK)) {
                    rgblight_set_magenta;
                }
                else if (default_layer & (1UL << WORKMAN)) {
                    rgblight_set_purple;
                }
                else {
                    rgblight_set_teal;
                }
                rgblight_mode(1);
                break;
        }
        has_layer_changed = false;
    }

    // Run Diablo 3 macro checking code.
    run_diablo_macro_check();
#ifdef LEADER_KEYS
    LEADER_DICTIONARY() {
        leading = false;
        leader_end();
        SEQ_ONE_KEY(KC_C) {
            SEND_STRING("Covecube");
        }
        SEQ_TWO_KEYS(KC_S, KC_D) {
            SEND_STRING("StableBit DrivePool");
        }
        SEQ_TWO_KEYS(KC_C, KC_D) {
            SEND_STRING("StableBit CloudDrive");
        }