Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dp60 indicator mode #8801

Merged
merged 5 commits into from
Nov 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions keyboards/dp60/config.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
/**
* config.h
*
Copyright 2020 astro <yuleiz@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once

Expand Down
12 changes: 12 additions & 0 deletions keyboards/dp60/dp60.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
/**
* dp60.c
*
Copyright 2020 astro <yuleiz@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "dp60.h"
Expand Down
11 changes: 11 additions & 0 deletions keyboards/dp60/dp60.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
/**
* dp60.h
*
Copyright 2020 astro <yuleiz@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once

Expand Down
15 changes: 15 additions & 0 deletions keyboards/dp60/keymaps/allleds/keymap.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/**
* keymap.c
*
Copyright 2020 astro <yuleiz@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
Expand Down
15 changes: 15 additions & 0 deletions keyboards/dp60/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/**
* keymap.c
*
Copyright 2020 astro <yuleiz@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
Expand Down
25 changes: 25 additions & 0 deletions keyboards/dp60/keymaps/indicator/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* config.h
*
Copyright 2020 astro <yuleiz@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once

#include "config_common.h"

#define RGB_INDICATOR_NUM 8
#undef RGBLED_NUM
#define RGBLED_NUM (18+RGB_INDICATOR_NUM)

#define RGB_INDICATOR_PIN B1
#define RGBLIGHT_LAYERS
101 changes: 101 additions & 0 deletions keyboards/dp60/keymaps/indicator/indicator.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/**
* indicator.c
*
Copyright 2020 astro <yuleiz@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "dp60.h"

#include "rgblight_list.h"
#include "rgblight.h"


// caps led
const rgblight_segment_t PROGMEM dp60_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{18, 1, HSV_RED}
);

// scroll led
const rgblight_segment_t PROGMEM dp60_scrolllock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{19, 1, HSV_GREEN}
);

// num led
const rgblight_segment_t PROGMEM dp60_numlock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{20, 1, HSV_BLUE}
);

// light 21 to 26 for layer 1-5
const rgblight_segment_t PROGMEM dp60_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{21, 1, HSV_PURPLE}
);
const rgblight_segment_t PROGMEM dp60_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{22, 1, HSV_CYAN}
);
const rgblight_segment_t PROGMEM dp60_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{23, 1, HSV_YELLOW}
);
const rgblight_segment_t PROGMEM dp60_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{24, 1, HSV_PINK}
);
const rgblight_segment_t PROGMEM dp60_layer5_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{25, 1, HSV_ORANGE}
);

// rgb light layers
const rgblight_segment_t* const PROGMEM dp60_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
dp60_capslock_layer,
dp60_scrolllock_layer,
dp60_numlock_layer,
dp60_layer1_layer,
dp60_layer2_layer,
dp60_layer3_layer,
dp60_layer4_layer,
dp60_layer5_layer
);

void keyboard_post_init_user(void) {
// Enable the LED layers
rgblight_layers = dp60_rgb_layers;
}

extern rgblight_config_t rgblight_config;
extern void rgblight_layers_write(void);
extern void indicator_write(LED_TYPE *start_led, uint8_t num_leds);

void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds)
{
ws2812_setleds(start_led, RGBLED_NUM-RGB_INDICATOR_NUM);

indicator_write(start_led + (RGBLED_NUM - RGB_INDICATOR_NUM), RGB_INDICATOR_NUM);
}

bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if (res) {
rgblight_set_layer_state(0, led_state.caps_lock);
rgblight_set_layer_state(1, led_state.scroll_lock);
rgblight_set_layer_state(2, led_state.num_lock);
}
return res;
}

layer_state_t layer_state_set_kb(layer_state_t state) {
state = layer_state_set_user(state);
rgblight_set_layer_state(3, layer_state_cmp(state, 1));
rgblight_set_layer_state(4, layer_state_cmp(state, 2));
rgblight_set_layer_state(5, layer_state_cmp(state, 3));
rgblight_set_layer_state(6, layer_state_cmp(state, 4));
rgblight_set_layer_state(7, layer_state_cmp(state, 5));
return state;
}
32 changes: 32 additions & 0 deletions keyboards/dp60/keymaps/indicator/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* keymap.c
*
Copyright 2020 astro <yuleiz@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_60_hhkb(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL, KC_BSLS, KC_GRV,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,KC_RBRC,KC_BSPC,
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, MO(1),
KC_LGUI, KC_LALT, LT(1,KC_SPC), KC_RALT,KC_RGUI ),

[1] = LAYOUT_60_hhkb(
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,_______,KC_PSCR,
RESET, RGB_TOG,RGB_MOD,_______,KC_F13,KC_F14,_______,_______,_______,_______,_______,KC_PGUP,KC_PGDN,_______,
KC_CAPS, _______,_______,_______,_______,_______,KC_LEFT,KC_DOWN, KC_UP,KC_RIGHT,KC_HOME,KC_END,_______,
_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,
_______,_______, _______, _______,_______),
};
26 changes: 26 additions & 0 deletions keyboards/dp60/keymaps/indicator/led_driver.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* led_driver.c
*
Copyright 2020 astro <yuleiz@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#undef RGB_DI_PIN
#define RGB_DI_PIN RGB_INDICATOR_PIN
#define ws2812_setleds indicator_setleds
#define ws2812_setleds_pin indicator_setleds_pin
#include "ws2812.c"

void indicator_write(LED_TYPE *start_led, uint8_t num_leds)
{
indicator_setleds(start_led, num_leds);
}
10 changes: 10 additions & 0 deletions keyboards/dp60/keymaps/indicator/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

Indicator RGB leds support for the open source viper/eagle fr4 [plate](https://github.com/yulei/viper_plate.git)

Three wires need to be soldered:

B1 pin (SCLK at the board) to the plate's D pin

VCC to plate's V

GND to plate's G
4 changes: 4 additions & 0 deletions keyboards/dp60/keymaps/indicator/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

RGBLIGHT_ENABLE = yes # Use RGB underglow light

SRC += indicator.c led_driver.c
61 changes: 38 additions & 23 deletions keyboards/dp60/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
@@ -1,31 +1,46 @@
/**
* keymap.c
*
Copyright 2020 astro <yuleiz@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_60_ansi_split_bs_rshift(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL, KC_DEL, KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,KC_RBRC,KC_BSLS,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, MO(1),
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT,KC_RGUI, TG(1), KC_RCTL),

[1] = LAYOUT_60_ansi_split_bs_rshift(
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,_______,KC_PSCR,
RESET, RGB_TOG,RGB_MOD,_______,_______,_______,_______,_______,_______,_______,_______,KC_PGUP,KC_PGDN,_______,
_______, _______,_______,_______,_______,_______,KC_LEFT,KC_DOWN, KC_UP,KC_RIGHT,KC_HOME,KC_END,_______,
_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,
_______,_______,_______, _______, _______,_______,TG(0),_______),
[0] = LAYOUT_all(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL, KC_DEL, KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,KC_RBRC,KC_BSLS,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, KC_NUHS, KC_ENT,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, MO(1),
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RGUI,KC_RALT, MO(1), KC_RCTL),

[2] = LAYOUT_60_ansi_split_bs_rshift(
[1] = LAYOUT_all(
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,_______,KC_DEL,
RESET, _______,KC_UP,_______,_______,_______,_______,_______,KC_PAUS,KC_SLCK,KC_PSCR,KC_PGUP,_______,KC_INS,
_______, KC_LEFT,KC_DOWN,KC_RIGHT,_______,_______,_______,_______, _______,_______,KC_HOME,KC_END,_______, _______,
_______,_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,KC_PGDN,_______,_______,
_______,_______,_______, _______, _______,MO(2),TG(0),_______),

[2] = LAYOUT_all(
_______, _______,_______, _______,_______, _______,_______, _______,_______, _______,_______, _______,_______,_______,_______,
_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,
_______, _______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,
_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,
_______,_______,_______, _______, _______,_______,_______,_______),
_______, _______,KC_VOLU,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,
KC_MUTE, KC_MPRV,KC_VOLD,KC_MNXT,_______,_______,_______,_______, _______,_______,_______,_______,_______, _______,
_______, _______, RGB_TOG,RGB_MOD,RGB_RMOD,RGB_VAI,RGB_VAD,RGB_HUI,RGB_HUD,RGB_SAI,RGB_SAD,_______,_______,_______,
_______,_______,_______, KC_MPLY, _______,_______,_______,_______),

[3] = LAYOUT_60_ansi_split_bs_rshift(
[3] = LAYOUT_all(
_______, _______,_______, _______,_______, _______,_______, _______,_______, _______,_______, _______,_______,_______,_______,
_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,
_______, _______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,
_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,
_______,_______,_______, _______, _______,_______,_______,_______)
};
_______, _______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,
_______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,
_______,_______,_______, _______, _______,_______,_______,_______)
};
1 change: 1 addition & 0 deletions keyboards/dp60/keymaps/via/rules.mk
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
VIA_ENABLE = yes
LTO_ENABLE = yes
RGBLIGHT_ENABLE = yes #enables underglow, but will not disable per key leds
17 changes: 16 additions & 1 deletion keyboards/dp60/matrix.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/**
* matrix.c
*
Copyright 2020 astro <yuleiz@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"

static uint8_t debouncing = DEBOUNCE;
Expand Down Expand Up @@ -242,4 +257,4 @@ static void select_col(uint8_t col) {
writePinHigh(D5);
break;
}
}
}