From 60433d71a198e2dd0b74b345b2227a72fe351e3d Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Thu, 29 Nov 2018 16:19:36 -0500 Subject: [PATCH] add leds --- keyboards/moonlander/keymaps/default/keymap.c | 11 ++- keyboards/moonlander/moonlander.c | 67 ++++++------------- 2 files changed, 32 insertions(+), 46 deletions(-) diff --git a/keyboards/moonlander/keymaps/default/keymap.c b/keyboards/moonlander/keymaps/default/keymap.c index 88910f5605..b24ffa9858 100644 --- a/keyboards/moonlander/keymaps/default/keymap.c +++ b/keyboards/moonlander/keymaps/default/keymap.c @@ -24,7 +24,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, - KC_RSFT,KC_LCTL,KC_LALT,KC_LGUI,KC_RALT, + MO(1),KC_LCTL,KC_LALT,KC_LGUI,KC_RALT, + KC_BSPC,KC_SPC, KC_ENT +), + +[1] = LAYOUT_moonlander( + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, + KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, + KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, + MO(1),KC_LCTL,KC_LALT,KC_LGUI,KC_RALT, KC_BSPC,KC_SPC, KC_ENT ) diff --git a/keyboards/moonlander/moonlander.c b/keyboards/moonlander/moonlander.c index 07f7303901..a8267eb8b6 100644 --- a/keyboards/moonlander/moonlander.c +++ b/keyboards/moonlander/moonlander.c @@ -18,76 +18,53 @@ along with this program. If not, see . #include "moonlander.h" void matrix_init_kb(void) { + setPinOutput(B0); + setPinOutput(B1); + setPinOutput(B2); + writePinLow(B0); + writePinLow(B1); + writePinLow(B2); } void matrix_scan_kb(void) { } -uint32_t layer_state_set_user(uint32_t state) { - ergodox_board_led_off(); - ergodox_right_led_1_off(); - ergodox_right_led_2_off(); - ergodox_right_led_3_off(); +uint32_t layer_state_set_kb(uint32_t state) { + writePinLow(B0); + writePinLow(B1); + writePinLow(B2); uint8_t layer = biton32(state); switch (layer) { case 0: - #ifdef RGBLIGHT_COLOR_LAYER_0 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0); - #else - #ifdef RGBLIGHT_ENABLE - rgblight_init(); - #endif - #endif break; case 1: - ergodox_right_led_1_on(); - #ifdef RGBLIGHT_COLOR_LAYER_1 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_1); - #endif + writePinHigh(B0); break; case 2: - ergodox_right_led_2_on(); - #ifdef RGBLIGHT_COLOR_LAYER_2 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_2); - #endif + writePinHigh(B1); break; case 3: - ergodox_right_led_3_on(); - #ifdef RGBLIGHT_COLOR_LAYER_3 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_3); - #endif + writePinHigh(B2); break; case 4: - ergodox_right_led_1_on(); - ergodox_right_led_2_on(); - #ifdef RGBLIGHT_COLOR_LAYER_4 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_4); - #endif + writePinHigh(B0); + writePinHigh(B1); break; case 5: - ergodox_right_led_1_on(); - ergodox_right_led_3_on(); - #ifdef RGBLIGHT_COLOR_LAYER_5 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_5); - #endif + writePinHigh(B0); + writePinHigh(B2); break; case 6: - ergodox_right_led_2_on(); - ergodox_right_led_3_on(); - #ifdef RGBLIGHT_COLOR_LAYER_6 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_6); - #endif + writePinHigh(B1); + writePinHigh(B2); break; case 7: - ergodox_right_led_1_on(); - ergodox_right_led_2_on(); - ergodox_right_led_3_on(); - #ifdef RGBLIGHT_COLOR_LAYER_7 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_7); - #endif + writePinHigh(B0); + writePinHigh(B1); + writePinHigh(B2); break; default: break;