diff options
author | Jack Humbert <jack.humb@gmail.com> | 2015-01-14 22:43:01 -0500 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2015-01-14 22:43:01 -0500 |
commit | 4225f0353c2eb85fbd8ca0622eb89757975093e4 (patch) | |
tree | c9a21434e23181b41555b93a7488a65ccbcc3e83 /keyboard/gh60 | |
parent | e4c4d6ad0aa5763504802ae22c6b4504b4084a45 (diff) | |
parent | 173dbe3b283ad4bb9bca2f2ac781eadd5c413bb3 (diff) |
Merge branch 'planck-jack'
Diffstat (limited to 'keyboard/gh60')
-rw-r--r-- | keyboard/gh60/keymap_common.h | 4 | ||||
-rw-r--r-- | keyboard/gh60/keymap_planck.c | 51 | ||||
-rw-r--r-- | keyboard/gh60/matrix.c | 82 |
3 files changed, 39 insertions, 98 deletions
diff --git a/keyboard/gh60/keymap_common.h b/keyboard/gh60/keymap_common.h index 738741815f..7c95fb8e7c 100644 --- a/keyboard/gh60/keymap_common.h +++ b/keyboard/gh60/keymap_common.h @@ -41,12 +41,12 @@ extern const uint16_t fn_actions[]; 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_NO, KC_##K35, 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 } \ } #endif diff --git a/keyboard/gh60/keymap_planck.c b/keyboard/gh60/keymap_planck.c deleted file mode 100644 index 4ff3f3da57..0000000000 --- a/keyboard/gh60/keymap_planck.c +++ /dev/null @@ -1,51 +0,0 @@ -#include "keymap_common.h" - -const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = KEYMAP( /* Native */ - ESC, Q, W, E, R, T, Y, U, I, O, P, FN2, - BSPC, A, S, D, F, G, H, J, K, L, SCLN, QUOT, - TAB, Z, X, C, V, B, N, M, COMM, DOT, SLSH, ENT, - DEL, LCTL, NO, LSFT, LALT, SPC, NO, LEFT, DOWN, UP, RGHT), - [1] = KEYMAP( /* QWERTY->PHOTOSHOP */ - DELETE, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, FN1, - O, G, S, U, T, FN27, F21, F10, F11, F7, F8, F9, - TAB, FN22, FN24, FN6, F1, FN7, F18, F19, F23, F20, F22, FN9, - COMM, DOT, FN10, FN11, FN3, SPC, FN12, F2, FN8, F3, F14), - [2] = KEYMAP( /* 2: FN3 PHOTOSHOP */ - ESC, FN25, FN26, NO, NO, NO, NO, NO, NO, NO, NO, NO, - NO, NO, NO, NO, NO, NO, NO, NO, NO, FN19, FN20, FN21, - C, FN4, NO, FN5, NO, FN23, NO, NO, NO, NO, FN13, NO, - FN14, FN15, FN16, FN17, FN3, SPC, FN18, NO, NO, F24, NO), -}; - -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_DEFAULT_LAYER_SET(0), // set Qwerty layout - [2] = ACTION_DEFAULT_LAYER_SET(1), // set Photoshop presets - [3] = ACTION_LAYER_ON_OFF(2), // Photoshop function layer - - [4] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_F9), // photo folder AHK - [5] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_I), // select inverse - [6] = ACTION_MODS_KEY(MOD_LSFT, KC_M), // marquee select - [7] = ACTION_MODS_KEY(MOD_LALT, KC_BSPC), // fill - [8] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_X), // warp - [9] = ACTION_MODS_KEY(MOD_LCTL | MOD_LALT | MOD_LSFT, KC_F12), // merge all new layer - [10] = ACTION_MODS_KEY(MOD_LCTL, KC_MINS), // zoom out - [11] = ACTION_MODS_KEY(MOD_LCTL, KC_H), // RBG sliders - [12] = ACTION_MODS_KEY(MOD_LCTL, KC_S), // save - [13] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_F5), // layer mask from transparancy - [14] = ACTION_MODS_KEY(MOD_LALT, KC_LBRC), // prev layer - [15] = ACTION_MODS_KEY(MOD_LALT, KC_RBRC), // next layer - [16] = ACTION_MODS_KEY(MOD_LCTL, KC_EQL), // zoom in - [17] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_H), // HSV sliders - [18] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_F11), // save as PNG - [19] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_F7), // gaussian blur - [20] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_F8), // motion blur - [21] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_X), // liquify filter - [22] = ACTION_MODS_KEY(MOD_LSFT, KC_MINS), // prev layer blending - [23] = ACTION_MODS_KEY(MOD_LSFT | MOD_LALT, KC_N), // normal layer blending - [24] = ACTION_MODS_KEY(MOD_LSFT, KC_EQL), // next layer blending - [25] = ACTION_MODS_KEY(MOD_LCTL, KC_Z), // step back - [26] = ACTION_MODS_KEY(MOD_LCTL, KC_Y), // step forward - [27] = ACTION_MODS_KEY(MOD_LCTL, KC_R), // rasterize - -}; diff --git a/keyboard/gh60/matrix.c b/keyboard/gh60/matrix.c index 83016b77ae..720ac30043 100644 --- a/keyboard/gh60/matrix.c +++ b/keyboard/gh60/matrix.c @@ -30,7 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef DEBOUNCE -# define DEBOUNCE 10 +# define DEBOUNCE 10 #endif static uint8_t debouncing = DEBOUNCE; @@ -56,21 +56,12 @@ uint8_t matrix_cols(void) return MATRIX_COLS; } -static -void setup_leds(void) { - DDRF |= 0x00; - PORTF |= 0x00; -} - - void matrix_init(void) { // initialize row and col unselect_rows(); init_cols(); - setup_leds(); - // initialize matrix state: all keys off for (uint8_t i=0; i < MATRIX_ROWS; i++) { matrix[i] = 0; @@ -104,15 +95,16 @@ uint8_t matrix_scan(void) } } - // uint8_t layer = biton32(default_layer_state); - switch (default_layer_state) { + uint8_t layer = biton32(layer_state); + switch (layer) { case 1: - DDRF &= ~(1<<0); - PORTF &= ~(1<<0); - break; case 2: - DDRF |= (1<<0); - PORTF |= (1<<0); + DDRC |= (1<<7); + PORTC |= (1<<7); + break; + case 0: + DDRC &= ~(1<<7); + PORTC &= ~(1<<7); break; } @@ -163,28 +155,28 @@ uint8_t matrix_key_count(void) static void init_cols(void) { - DDRC &= ~(1<<6 | 1<<7); - PORTC |= (1<<6 | 1<<7); - DDRD &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<5); - PORTD |= (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<5); + 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); + DDRD &= ~(1<<0); + PORTD |= (1<<0); DDRB &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<7); PORTB |= (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<7); } static matrix_row_t read_cols(void) { - return (PIND&(1<<5) ? 0 : (1<< 0)) | - (PINC&(1<<7) ? 0 : (1<< 1)) | - (PINC&(1<<6) ? 0 : (1<< 2)) | - (PIND&(1<<3) ? 0 : (1<< 3)) | - (PIND&(1<<2) ? 0 : (1<< 4)) | - (PIND&(1<<1) ? 0 : (1<< 5)) | - (PIND&(1<<0) ? 0 : (1<< 6)) | - (PINB&(1<<7) ? 0 : (1<< 7)) | - (PINB&(1<<3) ? 0 : (1<< 8)) | - (PINB&(1<<2) ? 0 : (1<< 9)) | - (PINB&(1<<1) ? 0 : (1<<10)) | - (PINB&(1<<0) ? 0 : (1<<11)); + return (PINB&(1<<0) ? 0 : (1<< 0)) | + (PINB&(1<<1) ? 0 : (1<< 1)) | + (PINB&(1<<2) ? 0 : (1<< 2)) | + (PINB&(1<<3) ? 0 : (1<< 3)) | + (PINB&(1<<7) ? 0 : (1<< 4)) | + (PIND&(1<<0) ? 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)); } /* Row pin configuration @@ -194,30 +186,30 @@ static matrix_row_t read_cols(void) static void unselect_rows(void) { // Hi-Z(DDR:0, PORT:0) to unselect - DDRD &= ~(1<<4 | 1<<6 | 1<<7); - PORTD |= (1<<4 | 1<<6 | 1<<7); - DDRB &= ~(1<<4); - PORTB |= (1<<4); + DDRB &= ~0b01110000; + PORTB &= ~0b01110000; + DDRD &= ~0b10000000; + PORTD &= ~0b10000000; } static void select_row(uint8_t row) { switch (row) { case 0: - DDRD |= (1<<4); - PORTD &= ~(1<<4); + DDRB |= (1<<6); + PORTB &= ~(1<<6); break; case 1: - DDRD |= (1<<6); - PORTD &= ~(1<<6); + DDRB |= (1<<5); + PORTB &= ~(1<<5); break; case 2: - DDRD |= (1<<7); - PORTD &= ~(1<<7); - break; - case 3: DDRB |= (1<<4); PORTB &= ~(1<<4); break; + case 3: + DDRD |= (1<<7); + PORTD &= ~(1<<7); + break; } } |