summaryrefslogtreecommitdiffstats
path: root/keyboard/gh60
diff options
context:
space:
mode:
Diffstat (limited to 'keyboard/gh60')
-rw-r--r--keyboard/gh60/Makefile2
-rw-r--r--keyboard/gh60/keymap_common.h48
-rw-r--r--keyboard/gh60/led.c14
-rw-r--r--keyboard/gh60/matrix.c98
4 files changed, 67 insertions, 95 deletions
diff --git a/keyboard/gh60/Makefile b/keyboard/gh60/Makefile
index 083b87c30..6b0f1a0e8 100644
--- a/keyboard/gh60/Makefile
+++ b/keyboard/gh60/Makefile
@@ -55,7 +55,7 @@ SRC = keymap_common.c \
ifdef KEYMAP
SRC := keymap_$(KEYMAP).c $(SRC)
else
- SRC := keymap_poker.c $(SRC)
+ SRC := keymap_planck.c $(SRC)
endif
CONFIG_H = config.h
diff --git a/keyboard/gh60/keymap_common.h b/keyboard/gh60/keymap_common.h
index 896badd74..7c95fb8e7 100644
--- a/keyboard/gh60/keymap_common.h
+++ b/keyboard/gh60/keymap_common.h
@@ -38,47 +38,15 @@ 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, 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 \
+ 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_##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 } \
+ { 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 } \
}
-/* 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 62abcd79d..7c9851080 100644
--- a/keyboard/gh60/led.c
+++ b/keyboard/gh60/led.c
@@ -22,13 +22,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_CAPS_LOCK)) {
- // output low
- DDRB |= (1<<2);
- PORTB &= ~(1<<2);
+ if (usb_led & (1<<USB_LED_FUNCTION)) {
+ // Output high.
+ DDRF |= (1<<0);
+ PORTF |= (1<<0);
} else {
- // Hi-Z
- DDRB &= ~(1<<2);
- PORTB &= ~(1<<2);
+ // Output low.
+ DDRF &= ~(1<<0);
+ PORTF &= ~(1<<0);
}
}
diff --git a/keyboard/gh60/matrix.c b/keyboard/gh60/matrix.c
index a61215152..720ac3004 100644
--- a/keyboard/gh60/matrix.c
+++ b/keyboard/gh60/matrix.c
@@ -22,6 +22,7 @@ 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"
@@ -29,7 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef DEBOUNCE
-# define DEBOUNCE 5
+# define DEBOUNCE 10
#endif
static uint8_t debouncing = DEBOUNCE;
@@ -94,6 +95,19 @@ 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;
}
@@ -135,77 +149,67 @@ uint8_t matrix_key_count(void)
}
/* Column pin configuration
- * 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)
+ * 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
*/
-static void init_cols(void)
+
+static void init_cols(void)
{
- // 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);
+ 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 (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));
+ 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
- * row: 0 1 2 3 4
- * pin: D0 D1 D2 D3 D5
+ * row: 0 1 2 3
+ * pin: B0 B1 B2 B3
*/
static void unselect_rows(void)
{
// Hi-Z(DDR:0, PORT:0) to unselect
- DDRD &= ~0b00101111;
- PORTD &= ~0b00101111;
+ DDRB &= ~0b01110000;
+ PORTB &= ~0b01110000;
+ DDRD &= ~0b10000000;
+ PORTD &= ~0b10000000;
}
static void select_row(uint8_t row)
{
- // Output low(DDR:1, PORT:0) to select
switch (row) {
case 0:
- DDRD |= (1<<0);
- PORTD &= ~(1<<0);
+ DDRB |= (1<<6);
+ PORTB &= ~(1<<6);
break;
case 1:
- DDRD |= (1<<1);
- PORTD &= ~(1<<1);
+ DDRB |= (1<<5);
+ PORTB &= ~(1<<5);
break;
case 2:
- DDRD |= (1<<2);
- PORTD &= ~(1<<2);
+ DDRB |= (1<<4);
+ PORTB &= ~(1<<4);
break;
case 3:
- DDRD |= (1<<3);
- PORTD &= ~(1<<3);
- break;
- case 4:
- DDRD |= (1<<5);
- PORTD &= ~(1<<5);
+ DDRD |= (1<<7);
+ PORTD &= ~(1<<7);
break;
}
}