summaryrefslogtreecommitdiff
path: root/keyboard/gh60
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2015-10-27 14:52:18 -0400
committerJack Humbert <jack.humb@gmail.com>2015-10-27 14:52:18 -0400
commitd311fd8d1a0af3b767d26b520d399bf0db22f058 (patch)
treeb9de5704143ac205b4e26222f9d7551e9b161924 /keyboard/gh60
parenta766918d5c48204375f4c207b30bbbf1389df14f (diff)
parent6f3141965e88c4ee0ebf7c18a243e4c2d9c5021b (diff)
Merge pull request #34 from jackhumbert/tmk-master
merging from tmk, new_project script and template
Diffstat (limited to 'keyboard/gh60')
-rw-r--r--keyboard/gh60/Makefile12
-rw-r--r--keyboard/gh60/Makefile.pjrc10
-rw-r--r--keyboard/gh60/keymap_common.h48
-rw-r--r--keyboard/gh60/led.c19
-rw-r--r--keyboard/gh60/matrix.c98
5 files changed, 106 insertions, 81 deletions
diff --git a/keyboard/gh60/Makefile b/keyboard/gh60/Makefile
index b48ee3fde6..daba0f6449 100644
--- a/keyboard/gh60/Makefile
+++ b/keyboard/gh60/Makefile
@@ -42,7 +42,7 @@
TARGET = gh60_lufa
# Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
# Directory keyboard dependent files exist
TARGET_DIR = .
@@ -55,7 +55,7 @@ SRC = keymap_common.c \
ifdef KEYMAP
SRC := keymap_$(KEYMAP).c $(SRC)
else
- SRC := keymap_planck.c $(SRC)
+ SRC := keymap_poker.c $(SRC)
endif
CONFIG_H = config.h
@@ -128,8 +128,8 @@ NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
# Search Path
VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk \ No newline at end of file
diff --git a/keyboard/gh60/Makefile.pjrc b/keyboard/gh60/Makefile.pjrc
index 9655ff65a9..11bd3b7840 100644
--- a/keyboard/gh60/Makefile.pjrc
+++ b/keyboard/gh60/Makefile.pjrc
@@ -42,7 +42,7 @@
TARGET = gh60_pjrc
# Directory common source filess exist
-TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
# Directory keyboard dependent files exist
TARGET_DIR = .
@@ -97,11 +97,11 @@ NKRO_ENABLE = yes # USB Nkey Rollover(+500)
# Search Path
VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
-include $(TOP_DIR)/protocol/pjrc.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
plain: OPT_DEFS += -DKEYMAP_PLAIN
plain: all
diff --git a/keyboard/gh60/keymap_common.h b/keyboard/gh60/keymap_common.h
index 7c95fb8e7c..896badd748 100644
--- a/keyboard/gh60/keymap_common.h
+++ b/keyboard/gh60/keymap_common.h
@@ -38,15 +38,47 @@ extern const uint16_t fn_actions[];
* 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, K36, K37, K38, K39, K3A, K3B \
+ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
+ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
+ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, \
+ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
+ K40, K41, K42, K45, K49, K4A, K4B, K4C, K4D \
) { \
- { 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_##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_##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_##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_##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_##K40, KC_##K41, KC_##K42, KC_NO, KC_NO, KC_##K45, KC_NO, KC_NO, KC_NO, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D } \
}
+/* ANSI valiant. No extra keys for ISO */
+#define KEYMAP_ANSI( \
+ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
+ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
+ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, \
+ K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, \
+ K40, K41, K42, K45, K4A, K4B, K4C, K4D \
+) KEYMAP( \
+ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
+ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
+ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, NO, K2D, \
+ K30, NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, NO, K3D, \
+ K40, K41, K42, K45, NO, K4A, K4B, K4C, K4D \
+)
+
+
+#define KEYMAP_HHKB( \
+ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K49,\
+ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
+ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, \
+ K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3C, \
+ K40, K41, K42, K45, K4A, K4B, K4C, K4D \
+) KEYMAP( \
+ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
+ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
+ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, NO, K2D, \
+ K30, NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
+ K40, K41, K42, K45, K49, K4A, K4B, K4C, K4D \
+)
+
#endif
diff --git a/keyboard/gh60/led.c b/keyboard/gh60/led.c
index 7c98510801..50659d7247 100644
--- a/keyboard/gh60/led.c
+++ b/keyboard/gh60/led.c
@@ -1,16 +1,13 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
-
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
-
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -22,13 +19,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
void led_set(uint8_t usb_led)
{
- if (usb_led & (1<<USB_LED_FUNCTION)) {
- // Output high.
- DDRF |= (1<<0);
- PORTF |= (1<<0);
+ if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
+ // output low
+ DDRB |= (1<<2);
+ PORTB &= ~(1<<2);
} else {
- // Output low.
- DDRF &= ~(1<<0);
- PORTF &= ~(1<<0);
+ // Hi-Z
+ DDRB &= ~(1<<2);
+ PORTB &= ~(1<<2);
}
-}
+} \ No newline at end of file
diff --git a/keyboard/gh60/matrix.c b/keyboard/gh60/matrix.c
index 720ac30043..53a0b731bc 100644
--- a/keyboard/gh60/matrix.c
+++ b/keyboard/gh60/matrix.c
@@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdbool.h>
#include <avr/io.h>
#include <util/delay.h>
-#include "action_layer.h"
#include "print.h"
#include "debug.h"
#include "util.h"
@@ -30,7 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef DEBOUNCE
-# define DEBOUNCE 10
+# define DEBOUNCE 5
#endif
static uint8_t debouncing = DEBOUNCE;
@@ -95,19 +94,6 @@ uint8_t matrix_scan(void)
}
}
- uint8_t layer = biton32(layer_state);
- switch (layer) {
- case 1:
- case 2:
- DDRC |= (1<<7);
- PORTC |= (1<<7);
- break;
- case 0:
- DDRC &= ~(1<<7);
- PORTC &= ~(1<<7);
- break;
- }
-
return 1;
}
@@ -149,67 +135,77 @@ uint8_t matrix_key_count(void)
}
/* Column pin configuration
- * col: 0 1 2 3 4 5 6 7 8 9 10 11
- * pin: F0 F1 F4 F5 F6 F7 B6 B5 B4 D7 D5 D4
+ * col: 0 1 2 3 4 5 6 7 8 9 10 11 12 13
+ * pin: F0 F1 E6 C7 C6 B6 D4 B1 B0 B5 B4 D7 D6 B3 (Rev.A)
+ * pin: B7 (Rev.B)
*/
-
-static void init_cols(void)
+static void init_cols(void)
{
- 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);
+ // Input with pull-up(DDR:0, PORT:1)
+ DDRF &= ~(1<<0 | 1<<1);
+ PORTF |= (1<<0 | 1<<1);
+ DDRE &= ~(1<<6);
+ PORTE |= (1<<6);
+ DDRD &= ~(1<<7 | 1<<6 | 1<<4);
+ PORTD |= (1<<7 | 1<<6 | 1<<4);
+ DDRC &= ~(1<<7 | 1<<6);
+ PORTC |= (1<<7 | 1<<6);
+ DDRB &= ~(1<<7 | 1<<6 | 1<< 5 | 1<<4 | 1<<3 | 1<<1 | 1<<0);
+ PORTB |= (1<<7 | 1<<6 | 1<< 5 | 1<<4 | 1<<3 | 1<<1 | 1<<0);
}
static matrix_row_t read_cols(void)
{
- 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));
+ return (PINF&(1<<0) ? 0 : (1<<0)) |
+ (PINF&(1<<1) ? 0 : (1<<1)) |
+ (PINE&(1<<6) ? 0 : (1<<2)) |
+ (PINC&(1<<7) ? 0 : (1<<3)) |
+ (PINC&(1<<6) ? 0 : (1<<4)) |
+ (PINB&(1<<6) ? 0 : (1<<5)) |
+ (PIND&(1<<4) ? 0 : (1<<6)) |
+ (PINB&(1<<1) ? 0 : (1<<7)) |
+ ((PINB&(1<<0) && PINB&(1<<7)) ? 0 : (1<<8)) | // Rev.A and B
+ (PINB&(1<<5) ? 0 : (1<<9)) |
+ (PINB&(1<<4) ? 0 : (1<<10)) |
+ (PIND&(1<<7) ? 0 : (1<<11)) |
+ (PIND&(1<<6) ? 0 : (1<<12)) |
+ (PINB&(1<<3) ? 0 : (1<<13));
}
/* Row pin configuration
- * row: 0 1 2 3
- * pin: B0 B1 B2 B3
+ * row: 0 1 2 3 4
+ * pin: D0 D1 D2 D3 D5
*/
static void unselect_rows(void)
{
// Hi-Z(DDR:0, PORT:0) to unselect
- DDRB &= ~0b01110000;
- PORTB &= ~0b01110000;
- DDRD &= ~0b10000000;
- PORTD &= ~0b10000000;
+ DDRD &= ~0b00101111;
+ PORTD &= ~0b00101111;
}
static void select_row(uint8_t row)
{
+ // Output low(DDR:1, PORT:0) to select
switch (row) {
case 0:
- DDRB |= (1<<6);
- PORTB &= ~(1<<6);
+ DDRD |= (1<<0);
+ PORTD &= ~(1<<0);
break;
case 1:
- DDRB |= (1<<5);
- PORTB &= ~(1<<5);
+ DDRD |= (1<<1);
+ PORTD &= ~(1<<1);
break;
case 2:
- DDRB |= (1<<4);
- PORTB &= ~(1<<4);
+ DDRD |= (1<<2);
+ PORTD &= ~(1<<2);
break;
case 3:
- DDRD |= (1<<7);
- PORTD &= ~(1<<7);
+ DDRD |= (1<<3);
+ PORTD &= ~(1<<3);
+ break;
+ case 4:
+ DDRD |= (1<<5);
+ PORTD &= ~(1<<5);
break;
}
}