aboutsummaryrefslogtreecommitdiff
path: root/keyboards/pearl
diff options
context:
space:
mode:
authorPhil <baldonp1@tcnjedu>2018-04-06 14:01:24 -0400
committerJack Humbert <jack.humb@gmail.com>2018-04-11 23:55:41 -0400
commit3d3716bbf7a7615da237e6a95f6a4684ae8fac44 (patch)
treeb578113897e69e302f83cf88fccdc68bf0034b8e /keyboards/pearl
parent6982e63a4a0ac7832648583a20f082cb913a96e6 (diff)
downloadqmk_firmware-3d3716bbf7a7615da237e6a95f6a4684ae8fac44.tar.gz
qmk_firmware-3d3716bbf7a7615da237e6a95f6a4684ae8fac44.zip
Beginning implementation of Pearl backlight. Levels and breathing not working yet.
Diffstat (limited to 'keyboards/pearl')
-rw-r--r--keyboards/pearl/config.h2
-rwxr-xr-xkeyboards/pearl/keymaps/phil/keymap.c88
-rw-r--r--keyboards/pearl/pearl.c14
-rw-r--r--keyboards/pearl/rules.mk2
4 files changed, 105 insertions, 1 deletions
diff --git a/keyboards/pearl/config.h b/keyboards/pearl/config.h
index 47a732f76..9f7a148f9 100644
--- a/keyboards/pearl/config.h
+++ b/keyboards/pearl/config.h
@@ -31,6 +31,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
31#define RGBLIGHT_ANIMATIONS 31#define RGBLIGHT_ANIMATIONS
32#define RGBLED_NUM 12 32#define RGBLED_NUM 12
33 33
34#define BACKLIGHT_LEVELS 1
35
34#define MATRIX_ROWS 4 36#define MATRIX_ROWS 4
35#define MATRIX_COLS 13 37#define MATRIX_COLS 13
36 38
diff --git a/keyboards/pearl/keymaps/phil/keymap.c b/keyboards/pearl/keymaps/phil/keymap.c
new file mode 100755
index 000000000..a28fecd26
--- /dev/null
+++ b/keyboards/pearl/keymaps/phil/keymap.c
@@ -0,0 +1,88 @@
1/*
2Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18// Layer shorthand
19#define COLEMAK 0
20#define QWERTY 1
21#define WIN 2
22#define _FN1 3
23#define _FN2 4
24#define LIGHT 5
25
26#include "pearl.h"
27
28const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
29 [COLEMAK] = KEYMAP(
30 KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_NO, KC_BSPC,
31 LGUI_T(KC_ESC), KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT,
32 LSFT_T(KC_DEL), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT),
33 KC_LCTL, KC_LGUI, KC_LALT, LT(_FN1, KC_SPC), KC_NO, LT(_FN2, KC_SPC), TG(QWERTY), TG(WIN)
34 ),
35 [QWERTY] = KEYMAP(
36 KC_TRNS, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_NO, KC_TRNS,
37 KC_TRNS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_TRNS,
38 KC_TRNS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS,
39 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS
40 ),
41 [WIN] = KEYMAP(
42 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS,
43 LCTL_T(KC_ESC), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
44 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
45 KC_LGUI, KC_LALT, KC_LCTL, KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS
46 ),
47 [_FN1] = KEYMAP(
48 KC_GRV, KC_MNXT, KC_NO, KC_PIPE, KC_PLUS, KC_LBRC, KC_RBRC, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_NO, KC_TRNS,
49 KC_TRNS, KC_MPLY, KC_SPC, KC_UNDS, KC_EQUAL, KC_LPRN, KC_RPRN, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDOWN, KC_TRNS,
50 KC_TRNS, KC_MPRV, KC_NO, KC_BSLS, KC_MINUS, KC_LCBR, KC_RCBR, KC_NO, KC_MUTE, KC_VOLU, KC_VOLD, KC_CAPS,
51 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS
52 ),
53 [_FN2] = KEYMAP(
54 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LBRC, KC_RBRC, KC_NO, KC_TRNS,
55 KC_TRNS, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS,
56 KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_F9, KC_F10, KC_F11, KC_F12, KC_CAPS,
57 TG(LIGHT), KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS
58 ),
59 [LIGHT] = KEYMAP(
60 RESET, KC_NO, BL_ON, BL_INC, BL_BRTG, RGB_M_P, RGB_M_B, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, KC_NO, KC_NO,
61 KC_NO, KC_NO, BL_TOGG, BL_STEP, KC_NO, RGB_M_SN, RGB_M_K, RGB_TOG, RGB_HUD, RGB_SAD, RGB_VAD, KC_NO,
62 KC_NO, KC_NO, BL_OFF, BL_DEC, KC_NO, KC_NO, KC_NO, RGB_RMOD, RGB_M_SW, RGB_M_R, RGB_M_G, KC_NO,
63 TG(LIGHT), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO
64 ),
65};
66
67uint32_t layer_state_set_kb(uint32_t state) {
68 if (state & (1<<QWERTY)){
69 PORTD &= ~(1 << PD0);
70 } else {
71 PORTD |= (1 << PD0);
72 }
73
74 if (state & (1<<WIN)){
75 PORTD &= ~(1 << PD1);
76 }
77 else{
78 PORTD |= (1 << PD1);
79 }
80
81 if (state & (1<<LIGHT)){
82 PORTD &= ~(1 << PD6);
83 }
84 else{
85 PORTD |= (1 << PD6);
86 }
87 return state;
88} \ No newline at end of file
diff --git a/keyboards/pearl/pearl.c b/keyboards/pearl/pearl.c
index f9ced53be..3bbadb0a7 100644
--- a/keyboards/pearl/pearl.c
+++ b/keyboards/pearl/pearl.c
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18#include "pearl.h" 18#include "pearl.h"
19#include "rgblight.h" 19#include "rgblight.h"
20#include "backlight.h"
20 21
21#include <avr/pgmspace.h> 22#include <avr/pgmspace.h>
22 23
@@ -39,6 +40,19 @@ void rgblight_set(void) {
39 i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM); 40 i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
40} 41}
41 42
43void backlight_init_ports(void) {
44 DDRD |= (1<<4);
45 PORTD &= ~(1<<4);
46}
47
48void backlight_set(uint8_t level) {
49 if (level > 0) {
50 PORTD |= (1<<4);
51 } else {
52 PORTD &= ~(1<<4);
53 }
54}
55
42__attribute__ ((weak)) 56__attribute__ ((weak))
43void matrix_scan_user(void) { 57void matrix_scan_user(void) {
44 rgblight_task(); 58 rgblight_task();
diff --git a/keyboards/pearl/rules.mk b/keyboards/pearl/rules.mk
index 9165de424..c5b61c6d3 100644
--- a/keyboards/pearl/rules.mk
+++ b/keyboards/pearl/rules.mk
@@ -36,7 +36,7 @@ MOUSEKEY_ENABLE = yes
36EXTRAKEY_ENABLE = yes 36EXTRAKEY_ENABLE = yes
37CONSOLE_ENABLE = yes 37CONSOLE_ENABLE = yes
38COMMAND_ENABLE = yes 38COMMAND_ENABLE = yes
39BACKLIGHT_ENABLE = no 39BACKLIGHT_ENABLE = yes
40RGBLIGHT_ENABLE = yes 40RGBLIGHT_ENABLE = yes
41RGBLIGHT_CUSTOM_DRIVER = yes 41RGBLIGHT_CUSTOM_DRIVER = yes
42 42