summaryrefslogtreecommitdiffstats
path: root/keyboard
diff options
context:
space:
mode:
Diffstat (limited to 'keyboard')
-rw-r--r--keyboard/planck/Makefile4
-rw-r--r--keyboard/planck/backlight.c17
-rw-r--r--keyboard/planck/backlight.h2
-rw-r--r--keyboard/planck/config.h4
-rw-r--r--keyboard/planck/extended_keymap_common.c26
-rw-r--r--keyboard/planck/extended_keymap_common.h25
-rw-r--r--keyboard/planck/extended_keymaps/extended_keymap_jack.c2
-rw-r--r--keyboard/planck/matrix.c4
8 files changed, 67 insertions, 17 deletions
diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile
index e021e9e90b..773783ad1d 100644
--- a/keyboard/planck/Makefile
+++ b/keyboard/planck/Makefile
@@ -53,7 +53,7 @@ TARGET_DIR = .
ifdef COMMON
SRC = keymap_common.c \
- matrix_handwire.c \
+ matrix.c \
led.c \
backlight.c
@@ -66,7 +66,7 @@ endif
else
SRC = extended_keymap_common.c \
- matrix_handwire.c \
+ matrix.c \
led.c \
backlight.c
diff --git a/keyboard/planck/backlight.c b/keyboard/planck/backlight.c
index ee7e31ee9c..a560687ec0 100644
--- a/keyboard/planck/backlight.c
+++ b/keyboard/planck/backlight.c
@@ -2,9 +2,11 @@
#include <avr/io.h>
#include "backlight.h"
+#define CHANNEL OCR1C
-void backlight_init_ports()
+void backlight_init_ports(uint8_t level)
{
+
// Setup PB7 as output and output low.
DDRB |= (1<<7);
PORTB &= ~(1<<7);
@@ -24,9 +26,8 @@ void backlight_init_ports()
TCCR1A = _BV(COM1C1) | _BV(WGM11); // = 0b00001010;
TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001;
-
- // Default to zero duty cycle.
- OCR1C = 0x0000;
+
+ backlight_init();
}
void backlight_set(uint8_t level)
@@ -35,12 +36,14 @@ void backlight_set(uint8_t level)
{
// Turn off PWM control on PB7, revert to output low.
TCCR1A &= ~(_BV(COM1C1));
+ // CHANNEL = level << OFFSET | 0x0FFF;
+ CHANNEL = ((1 << level) - 1);
}
else
{
// Turn on PWM control of PB7
TCCR1A |= _BV(COM1C1);
- OCR1C = level << 12 | 0x0FFF;
+ // CHANNEL = level << OFFSET | 0x0FFF;
+ CHANNEL = ((1 << level) - 1);
}
-}
-
+} \ No newline at end of file
diff --git a/keyboard/planck/backlight.h b/keyboard/planck/backlight.h
deleted file mode 100644
index 0fe1f4a72b..0000000000
--- a/keyboard/planck/backlight.h
+++ /dev/null
@@ -1,2 +0,0 @@
-
-void backlight_init_ports(void);
diff --git a/keyboard/planck/config.h b/keyboard/planck/config.h
index 0b0c152479..4e49a2b897 100644
--- a/keyboard/planck/config.h
+++ b/keyboard/planck/config.h
@@ -23,9 +23,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0001
-#define MANUFACTURER jackhumbert
+#define MANUFACTURER Ortholinear Keyboards
#define PRODUCT Planck
-#define DESCRIPTION t.m.k. keyboard firmware for the Planck
+#define DESCRIPTION A compact ortholinear keyboard
/* key matrix size */
#define MATRIX_ROWS 4
diff --git a/keyboard/planck/extended_keymap_common.c b/keyboard/planck/extended_keymap_common.c
index f8fc3209fb..841b249431 100644
--- a/keyboard/planck/extended_keymap_common.c
+++ b/keyboard/planck/extended_keymap_common.c
@@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "action.h"
#include "action_macro.h"
#include "debug.h"
+#include "backlight.h"
static action_t keycode_to_action(uint16_t keycode);
@@ -46,7 +47,30 @@ action_t action_for_key(uint8_t layer, keypos_t key)
action_t action;
action.code = ACTION_MACRO(keycode & 0xFF);
return action;
- }
+ } else if (keycode >= BL_0 & keycode <= BL_15) {
+ action_t action;
+ action.code = ACTION_BACKLIGHT_LEVEL(keycode & 0x000F);
+ return action;
+ } else if (keycode == BL_DEC) {
+ action_t action;
+ action.code = ACTION_BACKLIGHT_DECREASE();
+ return action;
+ } else if (keycode == BL_INC) {
+ action_t action;
+ action.code = ACTION_BACKLIGHT_INCREASE();
+ return action;
+ } else if (keycode == BL_TOGG) {
+ action_t action;
+ action.code = ACTION_BACKLIGHT_TOGGLE();
+ return action;
+ } else if (keycode == BL_STEP) {
+ action_t action;
+ action.code = ACTION_BACKLIGHT_STEP();
+ return action;
+ } else if (keycode == RESET) {
+ bootloader_jump();
+ return;
+ }
switch (keycode) {
case KC_FN0 ... KC_FN31:
diff --git a/keyboard/planck/extended_keymap_common.h b/keyboard/planck/extended_keymap_common.h
index 66712459c6..21d8978b7b 100644
--- a/keyboard/planck/extended_keymap_common.h
+++ b/keyboard/planck/extended_keymap_common.h
@@ -149,4 +149,29 @@ extern const uint16_t fn_actions[];
#define MACRODOWN(...) (record->event.pressed ? MACRO(__VA_ARGS__) : MACRO_NONE)
+#define BL_ON 0x4009
+#define BL_OFF 0x4000
+#define BL_0 0x4000
+#define BL_1 0x4001
+#define BL_2 0x4002
+#define BL_3 0x4003
+#define BL_4 0x4004
+#define BL_5 0x4005
+#define BL_6 0x4006
+#define BL_7 0x4007
+#define BL_8 0x4008
+#define BL_9 0x4009
+#define BL_10 0x400A
+#define BL_11 0x400B
+#define BL_12 0x400C
+#define BL_13 0x400D
+#define BL_14 0x400E
+#define BL_15 0x400F
+#define BL_DEC 0x4010
+#define BL_INC 0x4011
+#define BL_TOGG 0x4012
+#define BL_STEP 0x4013
+
+#define RESET 0x5000
+
#endif
diff --git a/keyboard/planck/extended_keymaps/extended_keymap_jack.c b/keyboard/planck/extended_keymaps/extended_keymap_jack.c
index 416ae83450..de966ca9df 100644
--- a/keyboard/planck/extended_keymaps/extended_keymap_jack.c
+++ b/keyboard/planck/extended_keymaps/extended_keymap_jack.c
@@ -5,7 +5,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
{KC_TAB, CM_Q, CM_W, CM_F, CM_P, CM_G, CM_J, CM_L, CM_U, CM_Y, CM_SCLN, KC_BSPC},
{KC_ESC, CM_A, CM_R, CM_S, CM_T, CM_D, CM_H, CM_N, CM_E, CM_I, CM_O, KC_QUOT},
{KC_LSFT, CM_Z, CM_X, CM_C, CM_V, CM_B, CM_K, CM_M, CM_COMM, CM_DOT, CM_SLSH, KC_ENT},
- {M(0), KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_NO, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
+ {BL_STEP, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_NO, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
[1] = { /* Jack hard-coded colemak */
{KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
diff --git a/keyboard/planck/matrix.c b/keyboard/planck/matrix.c
index e3926caece..156e081d14 100644
--- a/keyboard/planck/matrix.c
+++ b/keyboard/planck/matrix.c
@@ -62,8 +62,8 @@ void matrix_init(void)
MCUCR |= (1<<JTD);
MCUCR |= (1<<JTD);
- // TODO fix this dependency
- backlight_init_ports();
+ // Pass default level here
+ backlight_init_ports(15);
// initialize row and col
unselect_rows();