aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/v60_type_r/config.h18
-rw-r--r--keyboards/v60_type_r/keymaps/default/config.h26
-rw-r--r--keyboards/v60_type_r/keymaps/default/keymap.c16
-rw-r--r--keyboards/v60_type_r/keymaps/vimouse/config.h31
-rw-r--r--keyboards/v60_type_r/keymaps/vimouse/keymap.c130
-rw-r--r--keyboards/v60_type_r/keymaps/vimouse/readme.md0
-rw-r--r--keyboards/v60_type_r/keymaps/vimouse/rules.mk2
-rw-r--r--keyboards/v60_type_r/readme.md27
-rw-r--r--keyboards/v60_type_r/rules.mk3
-rw-r--r--keyboards/v60_type_r/v60_type_r.c200
-rw-r--r--keyboards/v60_type_r/v60_type_r.h17
11 files changed, 439 insertions, 31 deletions
diff --git a/keyboards/v60_type_r/config.h b/keyboards/v60_type_r/config.h
index c20bfe3a6..1f3ebcd51 100644
--- a/keyboards/v60_type_r/config.h
+++ b/keyboards/v60_type_r/config.h
@@ -48,10 +48,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
48 48
49/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */ 49/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */
50#define DIODE_DIRECTION COL2ROW 50#define DIODE_DIRECTION COL2ROW
51 51
52// #define BACKLIGHT_PIN B7 52#define BACKLIGHT_PIN F7
53// #define BACKLIGHT_BREATHING 53//#define BACKLIGHT_BREATHING
54// #define BACKLIGHT_LEVELS 3 54#define BACKLIGHT_LEVELS 3
55#define BACKLIGHT_ON_STATE 0
56
57#define RGBLIGHT_CUSTOM_DRIVER
58#define RGBLIGHT_ANIMATIONS
59#define RGBLED_NUM 1
60#define RGB_RED_PIN PF6
61#define RGB_GREEN_PIN PF5
62#define RGB_BLUE_PIN PF4
63#define RGB_DI_PIN 0
64#define RGB_STEP 16
55 65
56 66
57/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ 67/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
diff --git a/keyboards/v60_type_r/keymaps/default/config.h b/keyboards/v60_type_r/keymaps/default/config.h
new file mode 100644
index 000000000..9561b0255
--- /dev/null
+++ b/keyboards/v60_type_r/keymaps/default/config.h
@@ -0,0 +1,26 @@
1/* Copyright 2017 REPLACE_WITH_YOUR_NAME
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef CONFIG_USER_H
18#define CONFIG_USER_H
19
20#include "../../config.h"
21
22#ifdef V60_POLESTAR
23#undef V60_POLESTAR
24#endif
25
26#endif
diff --git a/keyboards/v60_type_r/keymaps/default/keymap.c b/keyboards/v60_type_r/keymaps/default/keymap.c
index 58ae81c4b..e277254b9 100644
--- a/keyboards/v60_type_r/keymaps/default/keymap.c
+++ b/keyboards/v60_type_r/keymaps/default/keymap.c
@@ -15,7 +15,7 @@
15 */ 15 */
16 16
17/* This is the default layout provided by the KBP V60 Type R 17/* This is the default layout provided by the KBP V60 Type R
18* as depicted in their manual and on the stock keycaps. 18* as depicted in their manual and on the stock keycaps.
19*/ 19*/
20#include "v60_type_r.h" 20#include "v60_type_r.h"
21 21
@@ -60,7 +60,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
60 KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_LEFT, KC_RIGHT, KC_TRNS, \ 60 KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_LEFT, KC_RIGHT, KC_TRNS, \
61 KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_NO, \ 61 KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_NO, \
62 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS, KC_TRNS), 62 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS, KC_TRNS),
63 63
64}; 64};
65 65
66 66
@@ -86,18 +86,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
86}; 86};
87 87
88 88
89void matrix_init_user(void) {
90
91}
92
93void matrix_scan_user(void) {
94
95}
96
97bool process_record_user(uint16_t keycode, keyrecord_t *record) {
98 return true;
99}
100
101void led_set_user(uint8_t usb_led) { 89void led_set_user(uint8_t usb_led) {
102 90
103} 91}
diff --git a/keyboards/v60_type_r/keymaps/vimouse/config.h b/keyboards/v60_type_r/keymaps/vimouse/config.h
new file mode 100644
index 000000000..3937420d0
--- /dev/null
+++ b/keyboards/v60_type_r/keymaps/vimouse/config.h
@@ -0,0 +1,31 @@
1/* Copyright 2017 REPLACE_WITH_YOUR_NAME
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef CONFIG_USER_H
18#define CONFIG_USER_H
19
20#include "../../config.h"
21
22#define V60_POLESTAR
23
24// place overrides here
25#define MOUSEKEY_INTERVAL 20
26#define MOUSEKEY_DELAY 0
27#define MOUSEKEY_TIME_TO_MAX 60
28#define MOUSEKEY_MAX_SPEED 7
29#define MOUSEKEY_WHEEL_DELAY 0
30
31#endif
diff --git a/keyboards/v60_type_r/keymaps/vimouse/keymap.c b/keyboards/v60_type_r/keymaps/vimouse/keymap.c
new file mode 100644
index 000000000..1dd9f7eaa
--- /dev/null
+++ b/keyboards/v60_type_r/keymaps/vimouse/keymap.c
@@ -0,0 +1,130 @@
1/* Copyright 2017 REPLACE_WITH_YOUR_NAME
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include "v60_type_r.h"
17
18#define _____ KC_TRNS
19#define XXXXX KC_NO
20
21const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
22 /* Keymap 0: Default Layer
23 * ,-----------------------------------------------------------.
24 * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| Bs |
25 * |-----------------------------------------------------------|
26 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
27 * |-----------------------------------------------------------|
28 * |FN0 | A| S| D| F| G| H| J| K| L| ;| '|Return |
29 * |-----------------------------------------------------------|
30 * |LShift | Z| X| C| V| B| N| M| ,| .| /| RShift |
31 * |-----------------------------------------------------------|
32 * |Ctrl|Alt |Gui | Space/L3 |Gui |Alt |Ctrl|Fn1|
33 * `-----------------------------------------------------------'
34 */
35 [0] = KEYMAP(
36 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, XXXXX, KC_BSPC, \
37 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, \
38 LT(1, 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, \
39 KC_LSFT, XXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, XXXXX, \
40 KC_LCTL, KC_LALT, KC_LGUI, LT(2, KC_SPC), KC_RGUI, KC_RALT, KC_RCTL, MO(3)),
41 /* Keymap 1: FN Layer
42 * ,-----------------------------------------------------------.
43 * |` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| Del |
44 * |-----------------------------------------------------------|
45 * | | | | | | | | | | |PSc|SLk|Pau| Ins |
46 * |-----------------------------------------------------------|
47 * | | | | | | | Lt| Dn| Up| Rt|Hom|PgU| |
48 * |-----------------------------------------------------------|
49 * | | | | | | |Mut|VDn|VUp|End|PgD| |
50 * |-----------------------------------------------------------|
51 * | | | | | | | | |
52 * `-----------------------------------------------------------'
53 */
54 [1] = KEYMAP(
55 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, \
56 _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, KC_PSCR, KC_SLCK, KC_PAUS, KC_INS, \
57 _____, _____, _____, _____, _____, _____, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_HOME, KC_PGUP, _____, \
58 _____, _____, _____, _____, _____, _____, _____, KC_MUTE, KC_VOLD, KC_VOLU, KC_END, KC_PGDN, _____, _____, \
59 _____, _____, _____, _____, _____, _____, _____, _____),
60 /* Keymap 2: Mouse Keys Layer
61 * ,-----------------------------------------------------------.
62 * | | | | | | | | | | | | | | |
63 * |-----------------------------------------------------------|
64 * | | | | | | | |MWU|MWD| | | | | |
65 * |-----------------------------------------------------------|
66 * | | | | | | |MLt|MDn|MUp|MRt| | | |
67 * |-----------------------------------------------------------|
68 * | | | | | |SPC|Ms1|Ms2|Ms3| | | |
69 * |-----------------------------------------------------------|
70 * | | | | | | | | |
71 * `-----------------------------------------------------------'
72 */
73 [2] = KEYMAP(
74 _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, \
75 _____, _____, _____, _____, _____, _____, _____, KC_MS_WH_UP, KC_MS_WH_DOWN, _____, _____, _____, _____, _____, \
76 _____, _____, _____, _____, _____, _____, KC_MS_LEFT, KC_MS_DOWN, KC_MS_UP, KC_MS_RIGHT, _____, _____, _____, \
77 _____, _____, _____, _____, _____, _____, KC_SPC, KC_MS_BTN1, KC_MS_BTN2, KC_MS_BTN3, _____, _____, _____, _____, \
78 _____, _____, _____, _____, _____, _____, _____, _____),
79 /* Keymap 3: LED Modification Layer
80 * ,-----------------------------------------------------------.
81 * | |BLT|BLC|UGT|UGP|UGB|UGR| | | | | | | |
82 * |-----------------------------------------------------------|
83 * | |RD+|GN+|BL+|HU+|SA+|VA+| | | | | | | |
84 * |-----------------------------------------------------------|
85 * | |RD-|GN-|BL-|HU-|SA-|VA-| | | | | | |
86 * |-----------------------------------------------------------|
87 * | | | | | | | | | | | | |
88 * |-----------------------------------------------------------|
89 * | | | | | | | | |
90 * `-----------------------------------------------------------'
91 */
92 [3] = KEYMAP(
93 _____, BL_TOGG, BL_STEP, RGB_TOG, RGB_M_P, RGB_M_B, RGB_M_R, _____, _____, _____, _____, _____, _____, _____, _____, \
94 _____, RGB_RI, RGB_GI, RGB_BI, RGB_HUI, RGB_SAI, RGB_VAI, _____, _____, _____, _____, _____, _____, _____, \
95 _____, RGB_RD, RGB_GD, RGB_BD, RGB_HUD, RGB_SAD, RGB_VAD, _____, _____, _____, _____, _____, _____, \
96 _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, \
97 _____, _____, _____, _____, _____, _____, _____, _____),
98};
99
100const uint16_t PROGMEM fn_actions[] = {
101};
102
103const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
104{
105 // MACRODOWN only works in this function
106 switch(id) {
107 case 0:
108 if (record->event.pressed) {
109 register_code(KC_RSFT);
110 } else {
111 unregister_code(KC_RSFT);
112 }
113 break;
114 }
115 return MACRO_NONE;
116};
117
118
119void led_set_user(uint8_t usb_led) {
120 if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
121 // output low
122 DDRE |= (1<<PE6);
123 PORTE &= ~(1<<PE6);
124 }
125 else {
126 // Hi-Z
127 DDRE &= ~(1<<PE6);
128 PORTE &= ~(1<<PE6);
129 }
130}
diff --git a/keyboards/v60_type_r/keymaps/vimouse/readme.md b/keyboards/v60_type_r/keymaps/vimouse/readme.md
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/keyboards/v60_type_r/keymaps/vimouse/readme.md
diff --git a/keyboards/v60_type_r/keymaps/vimouse/rules.mk b/keyboards/v60_type_r/keymaps/vimouse/rules.mk
new file mode 100644
index 000000000..31077066a
--- /dev/null
+++ b/keyboards/v60_type_r/keymaps/vimouse/rules.mk
@@ -0,0 +1,2 @@
1BACKLIGHT_ENABLE = yes
2RGBLIGHT_ENABLE = yes
diff --git a/keyboards/v60_type_r/readme.md b/keyboards/v60_type_r/readme.md
index c6be29091..5065ca106 100644
--- a/keyboards/v60_type_r/readme.md
+++ b/keyboards/v60_type_r/readme.md
@@ -1,19 +1,30 @@
1KBParadise V60 Type R 1KBParadise V60 Type R
2====================== 2======================
3 3
4Released in 2017, the KBP V60 Type R is KB Paradise's first foray into the world of fully programmable keyboards. It utilizes an atmega32u4, Cherry MX switches, standard layout plate, Cherry style stabilizers, and plastic 60% case. 4Released in 2017, the KBP V60 Type R is KB Paradise's first foray into the world of fully programmable keyboards. It utilizes an atmega32u4, Cherry MX switches, standard layout plate, Cherry style stabilizers, and plastic 60% case.
5 5
6The keyboard comes in two flavors: 6The keyboard comes in two flavors:
71. V60 Type R 71. V60 Type R
82. V60 Type R Polestar 82. V60 Type R Polestar
9 9
10The Polestar comes with both in switch and underglow lighting, while the regular Type R has neither. 10The Polestar comes with both in switch and underglow lighting, while the regular Type R has neither.
11 11
12Please note that other variants of the KBP V60 are not fully programmable. 12Please note that other variants of the KBP V60 are not fully programmable.
13 13
14In switch and underglow lighting is currently not supported, but the hex file generated by QMK can still be used for either type r board. 14Backlight and RGB Underglow are both supported.
15 15
16The KB Paradise preferred way of creating the hex file is by using https://tkg.io/, selecting Fantastic60 and then defining your keymap. 16To use the backlight and/or RGB underglow:
17* Create a new keymap
18* Create a rules.mk file in the keymap
19* Add RGBLIGHT_ENABLE = yes and/or BACKLIGHT_ENABLE = yes to the rules.mk
20* Setup your keymap to your preference. Use [the `vimouse` keymap](keymaps/vimouse/keymap.c) as a starting point
21* Some extra keys are defined to allow you to set the red, green and blue values of the underglow directly, rather than using the HSV spectrum. These are RGB_RI, RGB_RD, RGB_GI, RGB_GD, RGB_BI, RGB_BD for increase and decrease of the red, green and blue channels respectively.
22
23The provided `default` keymap pretty closely matches the default V60 Type R keymap, minus the backlight and underglow control keys. The `vimouse` keymap is completely customised and makes use of many of the possibilities, including mouse keys, backlighting, RGB underglow, etc.
24
25Note for those customising: The configuration used in the `vimouse` keymap results in about 93% of the available flash being utilised. Keep that in mind if you're adding functionality.
26
27Note: By default the V60 Type R uses TMK. You should know what you're doing and none of this is guaranteed to work. If you want to stick with the TMK default, then the KB Paradise preferred way of creating the hex file is by using https://tkg.io/, selecting Fantastic60 and then defining your keymap.
17 28
18You will then have to use tkg-toolkit to finish the flashing 29You will then have to use tkg-toolkit to finish the flashing
19 30
@@ -25,6 +36,10 @@ Make example for this keyboard (after setting up your build environment):
25 36
26 make v60_type_r:default 37 make v60_type_r:default
27 38
39or
40
41 make v60_type_r:vimouse
42
28See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. 43See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information.
29 44
30 45
diff --git a/keyboards/v60_type_r/rules.mk b/keyboards/v60_type_r/rules.mk
index a3571e8de..b970f2722 100644
--- a/keyboards/v60_type_r/rules.mk
+++ b/keyboards/v60_type_r/rules.mk
@@ -51,7 +51,7 @@ OPT_DEFS += -DBOOTLOADER_SIZE=512
51# Build Options 51# Build Options
52# change yes to no to disable 52# change yes to no to disable
53# 53#
54BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) 54BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000)
55MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) 55MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700)
56EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) 56EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
57CONSOLE_ENABLE ?= yes # Console for debug(+400) 57CONSOLE_ENABLE ?= yes # Console for debug(+400)
@@ -61,6 +61,7 @@ SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
61# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 61# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
62NKRO_ENABLE ?= no # USB Nkey Rollover 62NKRO_ENABLE ?= no # USB Nkey Rollover
63BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default 63BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default
64RGBLIGHT_ENABLE ?= no # Enable the RGB Underglow
64MIDI_ENABLE ?= no # MIDI support (+2400 to 4200, depending on config) 65MIDI_ENABLE ?= no # MIDI support (+2400 to 4200, depending on config)
65UNICODE_ENABLE ?= no # Unicode 66UNICODE_ENABLE ?= no # Unicode
66BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID 67BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
diff --git a/keyboards/v60_type_r/v60_type_r.c b/keyboards/v60_type_r/v60_type_r.c
index 4f88919bc..016348db9 100644
--- a/keyboards/v60_type_r/v60_type_r.c
+++ b/keyboards/v60_type_r/v60_type_r.c
@@ -15,6 +15,200 @@
15 */ 15 */
16#include "v60_type_r.h" 16#include "v60_type_r.h"
17 17
18#include "rgblight.h"
19
20#include <avr/pgmspace.h>
21
22#include "action_layer.h"
23#include "quantum.h"
24
25// if we've got an RGB underglow!
26#ifdef V60_POLESTAR
27#define SOFTPWM_LED_TIMER_TOP F_CPU/(256*64)
28
29extern rgblight_config_t rgblight_config;
30static uint8_t softpwm_buff[3] = {0};
31
32void matrix_init_user(void) {
33 rgb_init();
34}
35
36bool process_record_user(uint16_t keycode, keyrecord_t *record) {
37 uint8_t r = led[0].r, g = led[0].g, b = led[0].b;
38 switch(keycode) {
39 case RGB_RI:
40 if (record->event.pressed) {
41 r += RGB_STEP;
42 if (r < led[0].r) {
43 r = 255;
44 }
45 rgblight_setrgb(r, g, b);
46 }
47
48 return false;
49 case RGB_RD:
50 if (record->event.pressed) {
51 r -= RGB_STEP;
52 if (r > led[0].r) {
53 r = 0;
54 }
55 rgblight_setrgb(r, g, b);
56 }
57
58 return false;
59 case RGB_BI:
60 if (record->event.pressed) {
61 b += RGB_STEP;
62 if (b < led[0].b) {
63 b = 255;
64 }
65 rgblight_setrgb(r, g, b);
66 }
67
68 return false;
69 case RGB_BD:
70 if (record->event.pressed) {
71 b -= RGB_STEP;
72 if (b > led[0].b) {
73 b = 0;
74 }
75 rgblight_setrgb(r, g, b);
76 }
77
78 return false;
79 case RGB_GI:
80 if (record->event.pressed) {
81 g += RGB_STEP;
82 if (g < led[0].g) {
83 g = 255;
84 }
85 rgblight_setrgb(r, g, b);
86 }
87
88 return false;
89 case RGB_GD:
90 if (record->event.pressed) {
91 g -= RGB_STEP;
92 if (g > led[0].g) {
93 g = 0;
94 }
95 rgblight_setrgb(r, g, b);
96 }
97
98 return false;
99 }
100
101 return true;
102}
103
104
105void rgb_timer_init(void) {
106 /* Timer1 setup */
107 /* CTC mode */
108 TCCR1B |= (1<<WGM12);
109 /* Clock selelct: clk/8 */
110 TCCR1B |= (1<<CS10);
111 /* Set TOP value */
112 uint8_t sreg = SREG;
113 cli();
114 OCR1AH = (SOFTPWM_LED_TIMER_TOP >> 8) & 0xff;
115 OCR1AL = SOFTPWM_LED_TIMER_TOP & 0xff;
116 SREG = sreg;
117
118 // Enable the compare match interrupt on timer 1
119 TIMSK1 |= (1<<OCIE1A);
120}
121
122void rgb_init(void) {
123 DDRF |= (1<<PF6 | 1<<PF5 | 1<<PF4);
124 PORTF |= (1<<PF6 | 1<<PF5 | 1<<PF4);
125
126 rgb_timer_init();
127}
128
129void set_rgb_pin_on(uint8_t pin) {
130 PORTF &= ~(1<<pin);
131}
132
133void set_rgb_pin_off(uint8_t pin) {
134 PORTF |= (1<<pin);
135}
136
137void rgblight_set(void) {
138 // xprintf("Setting RGB underglow\n");
139 if (!rgblight_config.enable) {
140 led[0].r = 0;
141 led[0].g = 0;
142 led[0].b = 0;
143 set_rgb_pin_off(RGB_RED_PIN);
144 set_rgb_pin_off(RGB_GREEN_PIN);
145 set_rgb_pin_off(RGB_BLUE_PIN);
146 }
147
148 // //xprintf("Red: %u, Green: %u, Blue: %u\n", led[0].r, led[0].g, led[0].b);
149}
150
151ISR(TIMER1_COMPA_vect)
152{
153 static uint8_t pwm = 0;
154 pwm++;
155
156 // turn the LEDS on
157 if (pwm == 0) {
158 if (softpwm_buff[0]) {
159 set_rgb_pin_on(RGB_RED_PIN);
160 softpwm_buff[0] = led[0].r;
161 }
162
163 if (softpwm_buff[1]) {
164 set_rgb_pin_on(RGB_GREEN_PIN);
165 softpwm_buff[1] = led[0].g;
166 }
167
168 if (softpwm_buff[2]) {
169 set_rgb_pin_on(RGB_BLUE_PIN);
170 softpwm_buff[2] = led[0].b;
171 }
172 }
173
174 // turn em off
175 if (pwm == softpwm_buff[0]) {
176 set_rgb_pin_off(RGB_RED_PIN);
177 softpwm_buff[0] = led[0].r;
178
179 }
180
181 if (pwm == softpwm_buff[1]) {
182 set_rgb_pin_off(RGB_GREEN_PIN);
183 softpwm_buff[1] = led[0].g;
184 }
185
186 if (pwm == softpwm_buff[2]) {
187 set_rgb_pin_off(RGB_BLUE_PIN);
188 softpwm_buff[2] = led[0].b;
189 }
190}
191#else
192
193void matrix_init_user(void) {
194}
195
196bool process_record_user(uint16_t keycode, keyrecord_t *record) {
197 return true;
198}
199
200#endif // V60_POLESTAR
201
202// we need these functions for both versions
203void led_set_kb(uint8_t usb_led) {
204 // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
205
206 led_set_user(usb_led);
207}
208
209void matrix_scan_user(void) {
210}
211
18void matrix_init_kb(void) { 212void matrix_init_kb(void) {
19 // put your keyboard start-up code here 213 // put your keyboard start-up code here
20 // runs once when the firmware starts up 214 // runs once when the firmware starts up
@@ -35,9 +229,3 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
35 229
36 return process_record_user(keycode, record); 230 return process_record_user(keycode, record);
37} 231}
38
39void led_set_kb(uint8_t usb_led) {
40 // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
41
42 led_set_user(usb_led);
43}
diff --git a/keyboards/v60_type_r/v60_type_r.h b/keyboards/v60_type_r/v60_type_r.h
index 77d871e53..180294d79 100644
--- a/keyboards/v60_type_r/v60_type_r.h
+++ b/keyboards/v60_type_r/v60_type_r.h
@@ -18,6 +18,23 @@
18 18
19#include "quantum.h" 19#include "quantum.h"
20 20
21#include "rgblight.h"
22
23#ifdef V60_POLESTAR
24
25void rgb_init(void);
26void set_rgb_color(uint8_t pin, uint8_t value, uint8_t timer_value);
27
28enum my_keycodes {
29 RGB_RI = SAFE_RANGE,
30 RGB_RD,
31 RGB_GI,
32 RGB_GD,
33 RGB_BI,
34 RGB_BD
35};
36#endif
37
21// This a shortcut to help you visually see your layout. 38// This a shortcut to help you visually see your layout.
22// The first section contains all of the arguments 39// The first section contains all of the arguments
23// The second converts the arguments into a two-dimensional array 40// The second converts the arguments into a two-dimensional array