1
0
Fork 0

reverting gh60

This commit is contained in:
Jack Humbert 2015-10-27 12:47:12 -04:00
parent 547da78335
commit 0e93ee235f
3 changed files with 58 additions and 68 deletions

View file

@ -55,7 +55,7 @@ SRC = keymap_common.c \
ifdef KEYMAP ifdef KEYMAP
SRC := keymap_$(KEYMAP).c $(SRC) SRC := keymap_$(KEYMAP).c $(SRC)
else else
SRC := keymap_planck.c $(SRC) SRC := keymap_poker.c $(SRC)
endif endif
CONFIG_H = config.h CONFIG_H = config.h

View file

@ -1,16 +1,13 @@
/* /*
Copyright 2012 Jun Wako <wakojun@gmail.com> Copyright 2012 Jun Wako <wakojun@gmail.com>
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or the Free Software Foundation, either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. 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) void led_set(uint8_t usb_led)
{ {
if (usb_led & (1<<USB_LED_FUNCTION)) { if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
// Output high. // output low
DDRF |= (1<<0); DDRB |= (1<<2);
PORTF |= (1<<0); PORTB &= ~(1<<2);
} else { } else {
// Output low. // Hi-Z
DDRF &= ~(1<<0); DDRB &= ~(1<<2);
PORTF &= ~(1<<0); PORTB &= ~(1<<2);
} }
} }

View file

@ -1,16 +1,13 @@
/* /*
Copyright 2012 Jun Wako <wakojun@gmail.com> Copyright 2012 Jun Wako <wakojun@gmail.com>
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or the Free Software Foundation, either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -22,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdbool.h> #include <stdbool.h>
#include <avr/io.h> #include <avr/io.h>
#include <util/delay.h> #include <util/delay.h>
#include "action_layer.h"
#include "print.h" #include "print.h"
#include "debug.h" #include "debug.h"
#include "util.h" #include "util.h"
@ -30,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef DEBOUNCE #ifndef DEBOUNCE
# define DEBOUNCE 10 # define DEBOUNCE 5
#endif #endif
static uint8_t debouncing = DEBOUNCE; static uint8_t debouncing = DEBOUNCE;
@ -95,19 +91,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; return 1;
} }
@ -149,67 +132,77 @@ uint8_t matrix_key_count(void)
} }
/* Column pin configuration /* Column pin configuration
* col: 0 1 2 3 4 5 6 7 8 9 10 11 * col: 0 1 2 3 4 5 6 7 8 9 10 11 12 13
* pin: F0 F1 F4 F5 F6 F7 B6 B5 B4 D7 D5 D4 * 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); // Input with pull-up(DDR:0, PORT:1)
PORTF |= (1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7); DDRF &= ~(1<<0 | 1<<1);
DDRD &= ~(1<<0); PORTF |= (1<<0 | 1<<1);
PORTD |= (1<<0); DDRE &= ~(1<<6);
DDRB &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<7); PORTE |= (1<<6);
PORTB |= (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<7); 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) static matrix_row_t read_cols(void)
{ {
return (PINB&(1<<0) ? 0 : (1<< 0)) | return (PINF&(1<<0) ? 0 : (1<<0)) |
(PINB&(1<<1) ? 0 : (1<< 1)) | (PINF&(1<<1) ? 0 : (1<<1)) |
(PINB&(1<<2) ? 0 : (1<< 2)) | (PINE&(1<<6) ? 0 : (1<<2)) |
(PINB&(1<<3) ? 0 : (1<< 3)) | (PINC&(1<<7) ? 0 : (1<<3)) |
(PINB&(1<<7) ? 0 : (1<< 4)) | (PINC&(1<<6) ? 0 : (1<<4)) |
(PIND&(1<<0) ? 0 : (1<< 5)) | (PINB&(1<<6) ? 0 : (1<<5)) |
(PINF&(1<<7) ? 0 : (1<< 6)) | (PIND&(1<<4) ? 0 : (1<<6)) |
(PINF&(1<<6) ? 0 : (1<< 7)) | (PINB&(1<<1) ? 0 : (1<<7)) |
(PINF&(1<<5) ? 0 : (1<< 8)) | ((PINB&(1<<0) && PINB&(1<<7)) ? 0 : (1<<8)) | // Rev.A and B
(PINF&(1<<4) ? 0 : (1<< 9)) | (PINB&(1<<5) ? 0 : (1<<9)) |
(PINF&(1<<1) ? 0 : (1<<10)) | (PINB&(1<<4) ? 0 : (1<<10)) |
(PINF&(1<<0) ? 0 : (1<<11)); (PIND&(1<<7) ? 0 : (1<<11)) |
(PIND&(1<<6) ? 0 : (1<<12)) |
(PINB&(1<<3) ? 0 : (1<<13));
} }
/* Row pin configuration /* Row pin configuration
* row: 0 1 2 3 * row: 0 1 2 3 4
* pin: B0 B1 B2 B3 * pin: D0 D1 D2 D3 D5
*/ */
static void unselect_rows(void) static void unselect_rows(void)
{ {
// Hi-Z(DDR:0, PORT:0) to unselect // Hi-Z(DDR:0, PORT:0) to unselect
DDRB &= ~0b01110000; DDRD &= ~0b00101111;
PORTB &= ~0b01110000; PORTD &= ~0b00101111;
DDRD &= ~0b10000000;
PORTD &= ~0b10000000;
} }
static void select_row(uint8_t row) static void select_row(uint8_t row)
{ {
// Output low(DDR:1, PORT:0) to select
switch (row) { switch (row) {
case 0: case 0:
DDRB |= (1<<6); DDRD |= (1<<0);
PORTB &= ~(1<<6); PORTD &= ~(1<<0);
break; break;
case 1: case 1:
DDRB |= (1<<5); DDRD |= (1<<1);
PORTB &= ~(1<<5); PORTD &= ~(1<<1);
break; break;
case 2: case 2:
DDRB |= (1<<4); DDRD |= (1<<2);
PORTB &= ~(1<<4); PORTD &= ~(1<<2);
break; break;
case 3: case 3:
DDRD |= (1<<7); DDRD |= (1<<3);
PORTD &= ~(1<<7); PORTD &= ~(1<<3);
break;
case 4:
DDRD |= (1<<5);
PORTD &= ~(1<<5);
break; break;
} }
} }