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

Charlie's keymap #7

Closed
wants to merge 8 commits into from
Closed
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
81 changes: 81 additions & 0 deletions keyboard/planck/keymap_charlie.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#include "keymap_common.h"
#include "action_layer.h"
#include "action.h"
#include "action_util.h"

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = KEYMAP_AND_REVERSE( /* Charlie querty */
TAB, Q, W, E, R, T, Y, U, I, O, P, BSPC,
LCTL, A, S, D, F, G, H, J, K, L, SCLN, ENT,
LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT,
FN3, LCTL, LALT, LGUI, FN1, FN16, FN2, RGUI, RALT, RCTL, FN3),
[2] = KEYMAP_AND_REVERSE( /* Charlie workman */
TAB, Q, D, R, W, B, J, F, U, P, SCLN, BSPC,
LCTL, A, S, H, T, G, Y, N, E, O, I, ENT,
LSFT, Z, X, M, C, V, K, L, COMM, DOT, SLSH, RSFT,
FN3, LCTL, LALT, LGUI, FN1, FN16, FN2, RGUI, RALT, RCTL, FN3),
[4] = KEYMAP_AND_REVERSE( /* Charlie RAISE */
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, TRNS,
TRNS, FN4, FN5, FN6, FN7, FN8, FN9, FN10, FN11, FN12, FN13, TRNS,
TRNS, F11, F12, F13, F14, F15, F16, F17, TRNS, TRNS, TRNS, TRNS,
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MNXT, VOLD, VOLU, MPLY),
[6] = KEYMAP_AND_REVERSE( /* Charlie LOWER */
GRV, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, BSLS,
TRNS, FN14, FN15, TRNS, TRNS, TRNS, TRNS, MINS, EQL, LBRC, RBRC, QUOT,
TRNS, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, TRNS,
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MNXT, VOLD, VOLU, MPLY),
};


enum function_id {
SPACE_FN,
};

void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
switch (id) {
case SPACE_FN:
if (record->event.pressed) {
// Change the keyboard maps.
// Whatever even layer's are on, turn on the odd one's too.
for (uint8_t i = 0; i < 9; i += 2) {
if (layer_state & (1UL << i))
layer_on(i + 1);
}
layer_on(1);
} else {
// turn off all the even layers.
for (uint8_t i = 0; i < 9; i += 2)
layer_off(i + 1);

if (record->tap.count != 0) {
// Space was tapped rather than used like a modifier.
// So send a space up and down event.
add_key(KC_SPC);
send_keyboard_report();
del_key(KC_SPC);
send_keyboard_report();
}
}
break;
}
}

const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_MOMENTARY(4), // to Fn overlay
[2] = ACTION_LAYER_MOMENTARY(6), // to Fn overlay
[3] = ACTION_MODS_KEY(MOD_LGUI, KC_TAB), // switch windows
[4] = ACTION_MODS_KEY(MOD_LSFT, KC_1), // !
[5] = ACTION_MODS_KEY(MOD_LSFT, KC_2), // @
[6] = ACTION_MODS_KEY(MOD_LSFT, KC_3), // #
[7] = ACTION_MODS_KEY(MOD_LSFT, KC_4), // $
[8] = ACTION_MODS_KEY(MOD_LSFT, KC_5), // %
[9] = ACTION_MODS_KEY(MOD_LSFT, KC_6), // ^
[10] = ACTION_MODS_KEY(MOD_LSFT, KC_7), // &
[11] = ACTION_MODS_KEY(MOD_LSFT, KC_8), // *
[12] = ACTION_MODS_KEY(MOD_LSFT, KC_9), // (
[13] = ACTION_MODS_KEY(MOD_LSFT, KC_0), // )
[14] = ACTION_DEFAULT_LAYER_SET(1), // change to qwerty
[15] = ACTION_DEFAULT_LAYER_SET(0), // change to workman
[16] = ACTION_FUNCTION_TAP(SPACE_FN), // space reverse
};
45 changes: 39 additions & 6 deletions keyboard/planck/keymap_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,54 @@ extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
extern const uint16_t fn_actions[];


// MIT Layout
/* GH60 keymap definition macro
* K2C, K31 and K3C are extra keys for ISO
*/
#define KEYMAP( \
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, K37, K38, K39, K3A, K3B \
K30, K31, K32, K33, K34, K36, K37, K38, K39, K3A, 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_##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_NO, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B } \
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_NO, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B }, \
}

// Grid Layout
#define KEYMAP_GRID( \
/* We don't want to reverse the bottom row */
#define KEYMAP_REVERSE( \
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, K36, K37, K38, K39, K3A, K3B \
) { \
{ KC_##K0B, KC_##K0A, KC_##K09, KC_##K08, KC_##K07, KC_##K06, KC_##K05, KC_##K04, KC_##K03, KC_##K02, KC_##K01, KC_##K00 }, \
{ KC_##K1B, KC_##K1A, KC_##K19, KC_##K18, KC_##K17, KC_##K16, KC_##K15, KC_##K14, KC_##K13, KC_##K12, KC_##K11, KC_##K10 }, \
{ KC_##K2B, KC_##K2A, KC_##K29, KC_##K28, KC_##K27, KC_##K26, KC_##K25, KC_##K24, KC_##K23, KC_##K22, KC_##K21, KC_##K20 }, \
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_NO, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B }, \
}

#define KEYMAP_AND_REVERSE(args...) KEYMAP(args), KEYMAP_REVERSE(args)

#define KEYMAP_SWAP( \
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, K36, K37, K38, K39, K3A, K3B \
) { \
{ KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05 }, \
{ KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15 }, \
{ KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25 }, \
{ KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_NO, KC_##K36, KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34 }, \
}

#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, \
Expand All @@ -57,7 +90,7 @@ extern const uint16_t fn_actions[];
{ 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_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B }, \
}


Expand Down
34 changes: 17 additions & 17 deletions keyboard/planck/matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,29 +136,29 @@ uint8_t matrix_key_count(void)

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<<7 | 1<<6 | 1<<5 | 1<<4);
PORTB |= (1<<7 | 1<<6 | 1<<5 | 1<<4);
DDRD &= ~(1<<7 | 1<<0);
PORTD |= (1<<7 | 1<<0);
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 (PIND&(1<<0) ? 0 : (1<<0)) |
(PINB&(1<<7) ? 0 : (1<<1)) |
(PINF&(1<<0) ? 0 : (1<<2)) |
(PINF&(1<<1) ? 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)) |
(PINB&(1<<6) ? 0 : (1<<8)) |
(PINB&(1<<5) ? 0 : (1<<9)) |
(PINB&(1<<4) ? 0 : (1<<10)) |
(PIND&(1<<7) ? 0 : (1<<11));

}

Expand Down Expand Up @@ -190,4 +190,4 @@ static void select_row(uint8_t row)
break;

}
}
}