1
0
Fork 0
This commit is contained in:
Jack Humbert 2015-08-16 17:56:15 -04:00
commit c9cbff446f
14 changed files with 367 additions and 131 deletions

View file

@ -47,8 +47,6 @@ TOP_DIR = ../..
# Directory keyboard dependent files exist
TARGET_DIR = .
# # project specific files
ifdef COMMON

View file

@ -0,0 +1,49 @@
#include <avr/io.h>
#include "backlight.h"
#define CHANNEL OCR1C
void backlight_init_ports()
{
// Setup PB7 as output and output low.
DDRB |= (1<<7);
PORTB &= ~(1<<7);
// Use full 16-bit resolution.
ICR1 = 0xFFFF;
// I could write a wall of text here to explain... but TL;DW
// Go read the ATmega32u4 datasheet.
// And this: http://blog.saikoled.com/post/43165849837/secret-konami-cheat-code-to-high-resolution-pwm-on
// Pin PB7 = OCR1C (Timer 1, Channel C)
// Compare Output Mode = Clear on compare match, Channel C = COM1C1=1 COM1C0=0
// (i.e. start high, go low when counter matches.)
// WGM Mode 14 (Fast PWM) = WGM13=1 WGM12=1 WGM11=1 WGM10=0
// Clock Select = clk/1 (no prescaling) = CS12=0 CS11=0 CS10=1
TCCR1A = _BV(COM1C1) | _BV(WGM11); // = 0b00001010;
TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001;
backlight_init();
}
void backlight_set(uint8_t level)
{
if ( level == 0 )
{
// 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);
// CHANNEL = level << OFFSET | 0x0FFF;
CHANNEL = ((1 << level) - 1);
}
}

View file

@ -110,19 +110,20 @@ extern const uint16_t fn_actions[];
#define KEYMAP_AND_SWAP(args...) KEYMAP(args), KEYMAP_SWAP(args)
/*
Keymap for the Planck 48 key variant.
*/
#define KEYMAP_48( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B \
// GRD: Grid layout
#define KEYMAP_GRD( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, \
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \
K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E \
) { \
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \
{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \
{ KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B }, \
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E }, \
{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E }, \
{ KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E }, \
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E }, \
{ KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47, KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E } \
}

View file

@ -0,0 +1,40 @@
#include "keymap_common.h"
// GRD: Grid layout
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = KEYMAP_GRD(FN29, FN30, FN31, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL, BSLS, GRV, \
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC, BSPC, DEL, \
CAPS, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, ENT, PGUP, \
LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, RSFT, UP, PGDN, \
LCTL, LALT, LGUI, SPC, SPC, SPC, SPC, SPC, SPC, RALT, APP, RCTL, LEFT, DOWN, RGHT), \
};
const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_MOMENTARY(2), // to Fn overlay
[3] = ACTION_DEFAULT_LAYER_SET(0),
[4] = ACTION_DEFAULT_LAYER_SET(1),
[9] = ACTION_MODS_KEY(MOD_LSFT | MOD_RSFT, KC_PAUSE),
[10] = ACTION_MODS_KEY(MOD_LSFT, KC_1),
[11] = ACTION_MODS_KEY(MOD_LSFT, KC_2),
[12] = ACTION_MODS_KEY(MOD_LSFT, KC_3),
[13] = ACTION_MODS_KEY(MOD_LSFT, KC_4),
[14] = ACTION_MODS_KEY(MOD_LSFT, KC_5),
[15] = ACTION_MODS_KEY(MOD_LSFT, KC_6),
[16] = ACTION_MODS_KEY(MOD_LSFT, KC_7),
[17] = ACTION_MODS_KEY(MOD_LSFT, KC_8),
[18] = ACTION_MODS_KEY(MOD_LSFT, KC_9),
[19] = ACTION_MODS_KEY(MOD_LSFT, KC_0),
[20] = ACTION_MODS_KEY(MOD_LSFT, KC_MINS),
[21] = ACTION_MODS_KEY(MOD_LSFT, KC_EQL),
[22] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV),
[23] = ACTION_MODS_KEY(MOD_LSFT, KC_LBRC),
[24] = ACTION_MODS_KEY(MOD_LSFT, KC_RBRC),
[28] = ACTION_MODS_KEY(MOD_LSFT, KC_BSLS),
[29] = ACTION_BACKLIGHT_TOGGLE(),
[30] = ACTION_BACKLIGHT_INCREASE(),
[31] = ACTION_BACKLIGHT_DECREASE()
};

View file

@ -57,6 +57,16 @@ uint8_t matrix_cols(void)
void matrix_init(void)
{
// To use PORTF disable JTAG with writing JTD bit twice within four cycles.
MCUCR |= (1<<JTD);
MCUCR |= (1<<JTD);
backlight_init_ports();
// Turn status LED on
DDRE |= (1<<6);
PORTE |= (1<<6);
// initialize row and col
unselect_rows();
init_cols();
@ -134,60 +144,84 @@ uint8_t matrix_key_count(void)
return count;
}
//
// Atomic PCB Rev 0 Pin Assignments
//
// Column: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
// Pin: F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7, D3, D2, D1
//
static void init_cols(void)
{
DDRB &= ~(1<<6 | 1<<5 | 1<<4);
PORTB |= (1<<6 | 1<<5 | 1<<4);
DDRD &= ~(1<<7 | 1<<6 | 1<<4);
PORTD |= (1<<7 | 1<<6 | 1<<4);
DDRB &= ~(1<<4 | 1<<0);
PORTB |= (1<<4 | 1<<0);
DDRC &= ~(1<<7);
PORTC |= (1<<7);
DDRD &= ~(1<<7 | 1<<6 | 1<<4 | 1<<3 | 1<<2 | 1<<1);
PORTD |= (1<<7 | 1<<6 | 1<<4 | 1<<3 | 1<<2 | 1<<1);
DDRF &= ~(1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7);
PORTF |= (1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7);
}
static matrix_row_t read_cols(void)
{
return (PIND&(1<<4) ? 0 : (1<<0)) |
(PIND&(1<<6) ? 0 : (1<<1)) |
(PIND&(1<<7) ? 0 : (1<<2)) |
(PINB&(1<<4) ? 0 : (1<<3)) |
(PINB&(1<<5) ? 0 : (1<<4)) |
(PINB&(1<<6) ? 0 : (1<<5)) |
(PINF&(1<<7) ? 0 : (1<<6)) |
(PINF&(1<<6) ? 0 : (1<<7)) |
(PINF&(1<<5) ? 0 : (1<<8)) |
(PINF&(1<<4) ? 0 : (1<<9)) |
(PINF&(1<<1) ? 0 : (1<<10)) |
(PINF&(1<<0) ? 0 : (1<<11));
return (PINF&(1<<1) ? 0 : (1<<0)) |
(PINF&(1<<0) ? 0 : (1<<1)) |
(PINB&(1<<0) ? 0 : (1<<2)) |
(PINC&(1<<7) ? 0 : (1<<3)) |
(PINF&(1<<4) ? 0 : (1<<4)) |
(PINF&(1<<5) ? 0 : (1<<5)) |
(PINF&(1<<6) ? 0 : (1<<6)) |
(PINF&(1<<7) ? 0 : (1<<7)) |
(PIND&(1<<4) ? 0 : (1<<8)) |
(PIND&(1<<6) ? 0 : (1<<9)) |
(PINB&(1<<4) ? 0 : (1<<10)) |
(PIND&(1<<7) ? 0 : (1<<11)) |
(PIND&(1<<3) ? 0 : (1<<12)) |
(PIND&(1<<2) ? 0 : (1<<13)) |
(PIND&(1<<1) ? 0 : (1<<14));
}
//
// Atomic PCB Rev 0 Pin Assignments
//
// Row: 0, 1, 2, 3, 4
// Pin: D0, D5, B5, B6, C6
//
static void unselect_rows(void)
{
DDRB &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3);
PORTB |= (1<<0 | 1<<1 | 1<<2 | 1<<3);
DDRB &= ~(1<<5 | 1<<6);
PORTB |= (1<<5 | 1<<6);
DDRD &= ~(1<<0 | 1<<5);
PORTD |= (1<<0 | 1<<5);
DDRC &= ~(1<<6);
PORTC |= (1<<6);
}
static void select_row(uint8_t row)
{
switch (row) {
case 0:
DDRB |= (1<<0);
PORTB &= ~(1<<0);
DDRD |= (1<<0);
PORTD &= ~(1<<0);
break;
case 1:
DDRB |= (1<<1);
PORTB &= ~(1<<1);
DDRD |= (1<<5);
PORTD &= ~(1<<5);
break;
case 2:
DDRB |= (1<<2);
PORTB &= ~(1<<2);
DDRB |= (1<<5);
PORTB &= ~(1<<5);
break;
case 3:
DDRB |= (1<<3);
PORTB &= ~(1<<3);
DDRB |= (1<<6);
PORTB &= ~(1<<6);
break;
case 4:
DDRC |= (1<<6);
PORTC &= ~(1<<6);
break;
}
}

View file

@ -47,12 +47,18 @@ TOP_DIR = ../..
# Directory keyboard dependent files exist
TARGET_DIR = .
# Default to PCB matrix
ifndef MATRIX
MATRIX=matrix_pcb.c
endif
$(warning MATRIX: $(MATRIX))
# # project specific files
ifdef COMMON
SRC = keymap_common.c \
$(MATRIX) \
led.c \
backlight.c \
beeps.c
@ -72,7 +78,7 @@ endif
else
SRC = extended_keymap_common.c \
analog.c \
$(MATRIX) \
led.c \
backlight.c \
beeps.c

View file

@ -3,26 +3,32 @@
## Setting up the environment
### Windows
1. Install [MHV AVR Tools][mhv] for AVR GCC compiler and [Cygwin][cygwin](or [MinGW][mingw]) for shell terminal.
1. Install [WinAVR Tools](http://sourceforge.net/projects/winavr/) for AVR GCC compiler.
2. Install [DFU-Programmer][dfu-prog] (the -win one).
3. Start DFU bootloader on the chip first time you will see 'Found New Hardware Wizard' to install driver. If you install device driver properly you can find chip name like 'ATmega32U4' under 'LibUSB-Win32 Devices' tree on 'Device Manager'. If not you will need to update its driver on 'Device Manager' to the `dfu-programmer` driver.
### Mac
1. Install [CrossPack](https://www.obdev.at/downloads/crosspack/CrossPack-AVR-20131216.dmg).
1. Install [CrossPack](http://www.obdev.at/products/crosspack/index.html) or install Xcode from the App Store and install the Command Line Tools from `Xcode->Preferences->Downloads`.
2. Install [DFU-Programmer][dfu-prog].
### Linux
1. Install AVR GCC with your favorite package manager.
2. Install [DFU-Programmer][dfu-prog].
##Verify Your Installation
1. Clone the following repository: https://github.com/jackhumbert/tmk_keyboard
2. Open a Terminal and `cd` into `tmk_keyboard/keyboard/planck`
3. Run `make`. This should output a lot of information about the build process.
## Using the built-in functions
Here is a list of some of the functions avaiable from the command line:
Here is a list of some of the functions available from the command line:
* `make clean`: clean the environment - may be required in-between builds
* `make`: compile the code
* `make COMMON=true`: compile with the common (non-extended) keymap
* `make KEYMAP=<keymap>`: compile with the extended keymap file `extended_keymaps_extended_keymap_<keymap>.c`
* `make MATRIX=<matrix_file>`: compile with the referenced matrix file. Default if unspecified is `matrix_pcb.c`. For handwired boards, use `matrix_handwired.c`.
* `make KEYMAP=<keymap>`: compile with the extended keymap file `extended_keymaps/extended_keymap_<keymap>.c`
* `make COMMON=true KEYMAP=<keymap>`: compile with the common keymap file `common_keymaps/keymap_<keymap>.c`
* `make dfu`: build and flash the layout to the PCB
* `make dfu-force`: build and force-flash the layout to the PCB (may be require for first flash)
@ -76,7 +82,7 @@ A number of other keycodes have been added that you may find useful:
### Function layers
The extended keymap extends the number of function layers from 32 to the near-infinite value of 256. Rather than using `FN<num>` notation (still avaiable, but limited to `FN0`-`FN31`), you can use the `FUNC(<num>)` notation. `F(<num>)` is a shortcut for this.
The extended keymap extends the number of function layers from 32 to the near-infinite value of 256. Rather than using `FN<num>` notation (still available, but limited to `FN0`-`FN31`), you can use the `FUNC(<num>)` notation. `F(<num>)` is a shortcut for this.
The function actions are unchanged, and you can see the full list of them [here](https://github.com/jackhumbert/tmk_keyboard/blob/master/common/action_code.h). They are explained in detail [here](https://github.com/jackhumbert/tmk_keyboard/blob/master/doc/keymap.md#2-action).

View file

@ -0,0 +1,61 @@
#include <avr/io.h>
#include "backlight.h"
#define CHANNEL OCR1C
void backlight_init_ports()
{
// Setup PB7 as output and output low.
DDRB |= (1<<7);
PORTB &= ~(1<<7);
// Use full 16-bit resolution.
ICR1 = 0xFFFF;
// I could write a wall of text here to explain... but TL;DW
// Go read the ATmega32u4 datasheet.
// And this: http://blog.saikoled.com/post/43165849837/secret-konami-cheat-code-to-high-resolution-pwm-on
// Pin PB7 = OCR1C (Timer 1, Channel C)
// Compare Output Mode = Clear on compare match, Channel C = COM1C1=1 COM1C0=0
// (i.e. start high, go low when counter matches.)
// WGM Mode 14 (Fast PWM) = WGM13=1 WGM12=1 WGM11=1 WGM10=0
// Clock Select = clk/1 (no prescaling) = CS12=0 CS11=0 CS10=1
TCCR1A = _BV(COM1C1) | _BV(WGM11); // = 0b00001010;
TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001;
backlight_init();
}
void backlight_set(uint8_t level)
{
if ( level == 0 )
{
// Turn off PWM control on PB7, revert to output low.
TCCR1A &= ~(_BV(COM1C1));
CHANNEL = 0x0;
// Prevent backlight blink on lowest level
PORTB &= ~(_BV(PORTB7));
}
else if ( level == BACKLIGHT_LEVELS )
{
// Prevent backlight blink on lowest level
PORTB &= ~(_BV(PORTB7));
// Turn on PWM control of PB7
TCCR1A |= _BV(COM1C1);
// Set the brightness
CHANNEL = 0xFFFF;
}
else
{
// Prevent backlight blink on lowest level
PORTB &= ~(_BV(PORTB7));
// Turn on PWM control of PB7
TCCR1A |= _BV(COM1C1);
// Set the brightness
CHANNEL = 0xFFFF >> ((BACKLIGHT_LEVELS - level) * ((BACKLIGHT_LEVELS + 1) / 2));
}
}

View file

@ -14,44 +14,40 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LSFT, LCTL, LALT, LGUI, FN1, SPC, FN2, LEFT, DOWN, UP, RGHT),
[2] = KEYMAP( /* fn1 lower */
F1, F2, F3, F4, F5, TRNS, TRNS, F6, F7, F8, F9, F10,
F1, F2, F3, F4, F5, NO, NO, F6, F7, F8, F9, F10,
1, 2, 3, 4, 5, F18, DEL, 6, 7, 8, 9, 0,
FN3, FN4, TRNS, GRV, MINS, TRNS, TRNS, BSLS, LBRC, RBRC, TRNS, TRNS,
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, FN5, HOME, PGDN, PGUP, END),
FN3, FN4, FN28, GRV, MINS, TRNS, INS, BSLS, LBRC, RBRC, TRNS, TRNS,
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, HOME, PGDN, PGUP, END),
[3] = KEYMAP( /* fn2 raise */
F1, F2, F3, F4, F5, TRNS, TRNS, F6, F7, F8, F9, F10,
F11, F12, F13, F14, F15, F18, DEL, F16, F17, F18, F19, F20,
FN3, FN4, TRNS, TRNS, TRNS, TRNS, TRNS, EJCT, PWR, LSFT,PAUSE, RSFT,
LEFT, DOWN, UP, RGHT, FN5, TRNS, TRNS, MNXT, VOLD, VOLU, MUTE),
[4] = KEYMAP( /* lower + raise */
LEFT, DOWN, UP, RGHT, TRNS, TRNS, TRNS, TRNS, LEFT, DOWN, UP, RGHT,
HOME, PGDN, PGUP, END, TRNS, F18, DEL, TRNS, HOME, PGDN, PGUP, END,
FN3, FN4, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, EJCT, PWR, MPLY, RSFT,
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MNXT, VOLD, VOLU, MUTE),
MRWD, MPLY, MFFD, NO, NO, FN21, FN22, EJCT, PWR, LSFT,PAUSE, RSFT,
FN11, FN12, FN13, FN14, FN15, F18, DEL, FN16, FN17, FN18, FN19, FN20,
FN3, FN4, FN28, FN23, FN24, TRNS, INS, FN25, FN26, FN27, MPRV, MNXT,
TRNS, TRNS, TRNS, TRNS, FN1, TRNS, FN2, NO, VOLD, VOLU, MUTE),
};
const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_MOMENTARY(2), // to Fn overlay LOWER
[2] = ACTION_LAYER_MOMENTARY(3), // to Fn overlay RAISE
[3] = ACTION_DEFAULT_LAYER_SET(0),
[4] = ACTION_DEFAULT_LAYER_SET(1),
[5] = ACTION_LAYER_MOMENTARY(4), // to Fn overlay LOWER + RAISE
[10] = ACTION_MODS_KEY(MOD_LSFT, KC_1),
[11] = ACTION_MODS_KEY(MOD_LSFT, KC_2),
[12] = ACTION_MODS_KEY(MOD_LSFT, KC_3),
[13] = ACTION_MODS_KEY(MOD_LSFT, KC_4),
[14] = ACTION_MODS_KEY(MOD_LSFT, KC_5),
[15] = ACTION_MODS_KEY(MOD_LSFT, KC_6),
[16] = ACTION_MODS_KEY(MOD_LSFT, KC_7),
[17] = ACTION_MODS_KEY(MOD_LSFT, KC_8),
[18] = ACTION_MODS_KEY(MOD_LSFT, KC_9),
[19] = ACTION_MODS_KEY(MOD_LSFT, KC_0),
[20] = ACTION_MODS_KEY(MOD_LSFT, KC_MINS),
[21] = ACTION_MODS_KEY(MOD_LSFT, KC_EQL),
[22] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV),
[23] = ACTION_MODS_KEY(MOD_LSFT, KC_LBRC),
[24] = ACTION_MODS_KEY(MOD_LSFT, KC_RBRC),
[28] = ACTION_MODS_KEY(MOD_LSFT, KC_BSLS),
[11] = ACTION_MODS_KEY(MOD_LSFT, KC_1),
[12] = ACTION_MODS_KEY(MOD_LSFT, KC_2),
[13] = ACTION_MODS_KEY(MOD_LSFT, KC_3),
[14] = ACTION_MODS_KEY(MOD_LSFT, KC_4),
[15] = ACTION_MODS_KEY(MOD_LSFT, KC_5),
[16] = ACTION_MODS_KEY(MOD_LSFT, KC_6),
[17] = ACTION_MODS_KEY(MOD_LSFT, KC_7),
[18] = ACTION_MODS_KEY(MOD_LSFT, KC_8),
[19] = ACTION_MODS_KEY(MOD_LSFT, KC_9),
[20] = ACTION_MODS_KEY(MOD_LSFT, KC_0),
[21] = ACTION_MODS_KEY(MOD_LSFT, KC_SLSH),
[22] = ACTION_MODS_KEY(MOD_LSFT, KC_EQL),
[23] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV),
[24] = ACTION_MODS_KEY(MOD_LSFT, KC_MINS),
[25] = ACTION_MODS_KEY(MOD_LSFT, KC_BSLS),
[26] = ACTION_MODS_KEY(MOD_LSFT, KC_LBRC),
[27] = ACTION_MODS_KEY(MOD_LSFT, KC_RBRC),
[28] = ACTION_MODS_KEY(MOD_LSFT | MOD_RSFT, KC_PAUSE),
};

View file

@ -35,8 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//#define MATRIX_HAS_GHOST
/* number of backlight levels */
/* NOTE: this is the max value of 0..BACKLIGHT_LEVELS so really 16 levels. */
#define BACKLIGHT_LEVELS 15
#define BACKLIGHT_LEVELS 3
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
@ -51,8 +50,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
/*
* Feature disable options
* These options are also useful to firmware size reduction.

View file

@ -0,0 +1,50 @@
#include "extended_keymap_common.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = { /* Qwerty */
{KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
{KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, 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_QUOT},
{KC_LCTL, KC_LGUI, KC_LALT, BL_STEP, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
// Space is repeated to accommadate for both spacebar wiring positions
},
[1] = { /* WASD + NumPad */
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P7, KC_P8, KC_P9, KC_PSLS, KC_PMNS, KC_TRNS},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P4, KC_P5, KC_P6, KC_PAST, KC_PPLS, KC_TRNS},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PDOT, KC_PENT, KC_TRNS},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_SPC, KC_P0, FUNC(1), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}
},
[2] = { /* RAISE */
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS},
{KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
{KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
[3] = { /* LOWER */
{S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_DEL},
{KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)},
{KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_PGUP, KC_END}
}
};
const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_MOMENTARY(2), // to RAISE
[2] = ACTION_LAYER_MOMENTARY(3), // to LOWER
[3] = ACTION_DEFAULT_LAYER_SET(0),
[4] = ACTION_DEFAULT_LAYER_SET(1),
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
// MACRODOWN only works in this function
switch(id) {
case 0:
return MACRODOWN(T(CM_T), END);
break;
}
return MACRO_NONE;
};

View file

@ -2,50 +2,49 @@
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = { /* Joe colemak */
{FUNC(3), KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_MINS},
{KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT },
{FUNC(15), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT},
{KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, FUNC(1), KC_SPC, KC_SPC, FUNC(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
{F(3), KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_MINS},
{KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT },
{F(15), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT},
{KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, F(1), KC_SPC, KC_SPC, F(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
[1] = { /* Joe soft Colemak */
{FUNC(3), CM_Q, CM_W, CM_F, CM_P, CM_G, CM_J, CM_L, CM_U, CM_Y, CM_SCLN, KC_MINS},
{KC_BSPC, CM_A, CM_R, CM_S, CM_T, CM_D, CM_H, CM_N, CM_E, CM_I, CM_O, KC_ENT },
{FUNC(15), CM_Z, CM_X, CM_C, CM_V, CM_B, CM_K, CM_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT},
{KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, FUNC(1), KC_SPC, KC_SPC, FUNC(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
{F(3), CM_Q, CM_W, CM_F, CM_P, CM_G, CM_J, CM_L, CM_U, CM_Y, CM_SCLN, KC_MINS},
{KC_BSPC, CM_A, CM_R, CM_S, CM_T, CM_D, CM_H, CM_N, CM_E, CM_I, CM_O, KC_ENT },
{F(15), CM_Z, CM_X, CM_C, CM_V, CM_B, CM_K, CM_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT},
{KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, F(1), KC_SPC, KC_SPC, F(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
[2] = { /* Joe NUMPAD */
{FUNC(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, LSFT(KC_9), LSFT(KC_0), KC_P7, KC_P8, KC_P9, KC_PSLS},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, LSFT(KC_5), KC_PEQL, KC_P4, KC_P5, KC_P6, KC_PAST},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PCMM, KC_P1, KC_P2, KC_P3, KC_PMNS},
{KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, FUNC(1), KC_TRNS, KC_TRNS, FUNC(2), KC_P0, KC_PDOT, KC_PENT, KC_PPLS}
{F(3), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, LSFT(KC_9), LSFT(KC_0), KC_P7, KC_P8, KC_P9, KC_PSLS},
{KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, LSFT(KC_5), KC_PEQL, KC_P4, KC_P5, KC_P6, KC_PAST},
{KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_PCMM, KC_P1, KC_P2, KC_P3, KC_PMNS},
{KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, F(1), KC_TRNS, KC_TRNS, F(2), KC_P0, KC_PDOT, KC_PENT, KC_PPLS}
},
[3] = { /* Joe 1337 haxOr5*/
{F(3), KC_Q, KC_W, KC_F, KC_P, KC_6, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_MINS},
{KC_BSPC, KC_4, KC_R, KC_5, KC_7, KC_D, KC_H, KC_N, KC_3, KC_1, KC_0, KC_ENT },
{F(15), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT},
{KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, F(1), KC_SPC, KC_SPC, F(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
[4] = { /* Joe LOWER fn1 */
{KC_GRV, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(28), FUNC(27), FUNC(26), FUNC(25)},
{KC_TRNS, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS },
{KC_BSLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LBRC, KC_RBRC, KC_EQL },
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_TRNS, KC_TRNS, FUNC(2), KC_HOME, KC_PGDN, KC_PGUP, KC_END }
{KC_GRV, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, M(3), M(2), M(1), M(0) },
{KC_BSPC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS},
{KC_BSLS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_LBRC, KC_RBRC, KC_EQL },
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, F(1), KC_TRNS, KC_TRNS, F(2), KC_HOME, KC_PGDN, KC_PGUP, KC_END }
},
[5] = { /* Joe UPPER fn2 */
{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, KC_BTN1, KC_MS_U, KC_BTN2, KC_BTN3, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, RESET },
{KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_BTN4, KC_MENU, KC_CAPS, KC_INS, KC_PSCR, KC_TRNS, LCTL(KC_PGUP), LCTL(KC_PGDN) },
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_TRNS, KC_TRNS, FUNC(2), LCTL(LALT(KC_LEFT)), LCTL(LALT(KC_DOWN)), LCTL(LALT(KC_UP)), LCTL(LALT(KC_RGHT))}
{KC_DEL, KC_BTN1, KC_MS_U, KC_BTN2, KC_BTN3, KC_WH_U, KC_BTN4, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_NO },
{KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_L, KC_WH_D, KC_WH_R, KC_NO, KC_NO, KC_NO, LCTL(KC_PGUP), LCTL(KC_PGDN) },
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, F(1), KC_NO, KC_NO, F(2), LCTL(LALT(KC_LEFT)), LCTL(LALT(KC_DOWN)), LCTL(LALT(KC_UP)), LCTL(LALT(KC_RGHT))}
},
[6] = { /* Joe SPECIAL fn3 */
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, LCTL(LSFT(CM_U)), KC_TRNS, KC_TRNS, KC_SLEP},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET },
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS},
{FUNC(6), FUNC(7), FUNC(8), KC_TRNS, FUNC(1), KC_TRNS, KC_TRNS, FUNC(2), KC_MUTE, KC_VOLD, KC_VOLU, KC_MPLY}
{KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO },
{KC_NO, KC_MPLY, KC_MPRV, KC_MNXT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RESET },
{KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO },
{F(6), F(7), F(8), F(9), F(1), KC_TRNS, KC_TRNS, F(2), KC_POWER, KC_WAKE, KC_SLEP, LCTL(LALT(KC_L))}
}
};
enum macro_id {
M_Q0,
M_Q1,
M_Q2,
M_Q3
};
const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_MOMENTARY(4), // fn1
[2] = ACTION_LAYER_MOMENTARY(5), // fn2
@ -57,32 +56,31 @@ const uint16_t PROGMEM fn_actions[] = {
[6] = ACTION_DEFAULT_LAYER_SET(0),
[7] = ACTION_DEFAULT_LAYER_SET(1),
[8] = ACTION_DEFAULT_LAYER_SET(2),
[9] = ACTION_DEFAULT_LAYER_SET(3),
/* tab on tap, shift on hold */
[15] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_TAB),
/* smiley macros */
[25] = ACTION_MACRO(M_Q0),
[26] = ACTION_MACRO(M_Q1),
[27] = ACTION_MACRO(M_Q2),
[28] = ACTION_MACRO(M_Q3),
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
switch (id) {
case M_Q0:
case 0:
/* :) */
return MACRODOWN( DOWN(KC_LSFT), TYPE(KC_SCLN), TYPE(KC_0), UP(KC_LSFT), END );
case M_Q1:
break;
case 1:
/* :( */
return MACRODOWN( DOWN(KC_LSFT), TYPE(KC_SCLN), TYPE(KC_9), UP(KC_LSFT), END );
case M_Q2:
break;
case 2:
/* (: | :) */
return MACRODOWN( DOWN(KC_LSFT), TYPE(KC_9), TYPE(KC_SCLN), TYPE(KC_SPC), TYPE(KC_SPC), TYPE(KC_SCLN), TYPE(KC_0), UP(KC_LSFT), TYPE(KC_LEFT), TYPE(KC_LEFT), TYPE(KC_LEFT), END );
case M_Q3:
break;
case 3:
/* :( | ): */
return MACRODOWN( DOWN(KC_LSFT), TYPE(KC_SCLN), TYPE(KC_9), TYPE(KC_SPC), TYPE(KC_SPC), TYPE(KC_0), TYPE(KC_SCLN), UP(KC_LSFT), TYPE(KC_LEFT), TYPE(KC_LEFT), TYPE(KC_LEFT), END );
break;
default:
break;
}

View file

@ -181,6 +181,13 @@ static matrix_row_t read_cols(void)
}
//
// Planck PCB Rev 1 Pin Assignments
//
// Row: 0, 1, 2, 3
// Pin: D0, D5, B5, B6
//
static void unselect_rows(void)
{
DDRB &= ~(1<<5 | 1<<6);
@ -190,13 +197,6 @@ static void unselect_rows(void)
}
//
// Planck PCB Rev 1 Pin Assignments
//
// Row: 0, 1, 2, 3
// Pin: D0, D5, B5, B6
//
static void select_row(uint8_t row)
{
switch (row) {