qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

rev2.c (1961B)


      1 #include "quantum.h"
      2 
      3 #ifdef SWAP_HANDS_ENABLE
      4 __attribute__ ((weak))
      5 const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
      6   {{0, 4}, {1, 4}, {2, 4}, {3, 4}, {4, 4}, {5, 4}},
      7   {{0, 5}, {1, 5}, {2, 5}, {3, 5}, {4, 5}, {5, 5}},
      8   {{0, 6}, {1, 6}, {2, 6}, {3, 6}, {4, 6}, {5, 6}},
      9   {{0, 7}, {1, 7}, {2, 7}, {3, 7}, {4, 7}, {5, 7}},
     10   {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}},
     11   {{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}},
     12   {{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}, {5, 2}},
     13   {{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}},
     14 };
     15 #endif
     16 
     17 #ifdef BACKLIGHT_ENABLE
     18 static bool backlight_was_toggled = false;
     19 
     20 void suspend_power_down_kb(void) {
     21     if (is_backlight_enabled()) {
     22         backlight_disable();
     23         backlight_was_toggled = true;
     24     }
     25 }
     26 
     27 void suspend_wakeup_init_kb(void) {
     28     if (backlight_was_toggled) {
     29         backlight_enable();
     30         backlight_was_toggled = false;
     31     }
     32 }
     33 #endif
     34 
     35 #ifdef PHYSICAL_LEDS_ENABLE
     36 void led_init_kb(void)
     37 {
     38 #ifdef NUM_LOCK_LED_PIN
     39     gpio_set_pin_output(NUM_LOCK_LED_PIN);
     40     RESET_NUM_LOCK_LED();
     41 #endif // NUM_LOCK_LED_PIN
     42 #ifdef CAPS_LOCK_LED_PIN
     43     gpio_set_pin_output(CAPS_LOCK_LED_PIN);
     44     RESET_CAPS_LOCK_LED();
     45 #endif // CAPS_LOCK_LED_PIN
     46 #ifdef SCROLL_LOCK_LED_PIN
     47     gpio_set_pin_output(SCROLL_LOCK_LED_PIN);
     48     RESET_SCROLL_LOCK_LED();
     49 #endif // SCROLL_LOCK_LED_PIN
     50 }
     51 #endif // PHYSICAL_LEDS_ENABLE
     52 
     53 void matrix_init_kb(void) {
     54 #ifdef PHYSICAL_LEDS_ENABLE
     55   led_init_kb();
     56 #endif // PHYSICAL_LEDS_ENABLE
     57   matrix_init_user();
     58 };
     59 
     60 #ifdef PHYSICAL_LEDS_ENABLE
     61 bool led_update_kb(led_t led_state) {
     62     bool res = led_update_user(led_state);
     63     if(res) {
     64 #ifdef NUM_LOCK_LED_PIN
     65         UPDATE_NUM_LOCK_LED();
     66 #endif // NUM_LOCK_LED_PIN
     67 #ifdef CAPS_LOCK_LED_PIN
     68         UPDATE_CAPS_LOCK_LED();
     69 #endif // CAPS_LOCK_LED_PIN
     70 #ifdef SCROLL_LOCK_LED_PIN
     71         UPDATE_SCROLL_LOCK_LED();
     72 #endif // SCROLL_LOCK_LED_PIN
     73     }
     74     return res;
     75 }
     76 #endif // PHYSICAL_LEDS_ENABLE