This commit is contained in:
Jack Humbert 2015-01-05 16:32:15 -05:00
parent 33e2a6285f
commit d6f2f878f9
3 changed files with 41 additions and 61 deletions

View File

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

View File

@ -5,7 +5,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
ESC, Q, W, E, R, T, Y, U, I, O, P, BSPC,
FN1, A, S, D, F, G, H, J, K, L, SCLN, ENT,
LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, LBRC,
LCTL, BSLS, QUOT, LALT, FN22, FN2, SPC, LEFT, UP, DOWN, RGHT, RBRC),
LCTL, BSLS, QUOT, LALT, FN22, SPC, LEFT, UP, DOWN, RGHT, RBRC),
[1] = KEYMAP(
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, DEL,
TRNS, FN10, FN11, FN12, FN13, FN14, FN15, FN16, FN17, TRNS, TRNS, TRNS,

View File

@ -1,5 +1,6 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
Copyright 2012 Jun Wako
Generated by planckkeyboard.com (2014 Jack Humbert)
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
@ -22,7 +23,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"
@ -43,7 +43,6 @@ static void init_cols(void);
static void unselect_rows(void);
static void select_row(uint8_t row);
inline
uint8_t matrix_rows(void)
{
@ -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;
}
@ -120,7 +106,7 @@ bool matrix_is_modified(void)
inline
bool matrix_is_on(uint8_t row, uint8_t col)
{
return (matrix[row] & ((matrix_row_t)1<<col));
return (matrix[row] & ((matrix_row_t)1<col));
}
inline
@ -148,68 +134,62 @@ uint8_t matrix_key_count(void)
return count;
}
/* 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
*/
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);
DDRB &= ~(1<<7 | 1<<4 | 1<<5 | 1<<6);
PORTB |= (1<<7 | 1<<4 | 1<<5 | 1<<6);
DDRC &= ~(1<<6);
PORTC |= (1<<6);
DDRD &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<7);
PORTD |= (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<7);
DDRF &= ~(1<<7 | 1<<6);
PORTF |= (1<<7 | 1<<6);
}
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 (PINB&(1<<7) ? 0 : (1<<0)) |
(PIND&(1<<0) ? 0 : (1<<1)) |
(PIND&(1<<1) ? 0 : (1<<2)) |
(PIND&(1<<2) ? 0 : (1<<3)) |
(PIND&(1<<3) ? 0 : (1<<4)) |
(PINC&(1<<6) ? 0 : (1<<5)) |
(PIND&(1<<7) ? 0 : (1<<6)) |
(PINB&(1<<4) ? 0 : (1<<7)) |
(PINB&(1<<5) ? 0 : (1<<8)) |
(PINB&(1<<6) ? 0 : (1<<9)) |
(PINF&(1<<7) ? 0 : (1<<10)) |
(PINF&(1<<6) ? 0 : (1<<11));
}
/* Row pin configuration
* row: 0 1 2 3
* pin: B0 B1 B2 B3
*/
static void unselect_rows(void)
{
// Hi-Z(DDR:0, PORT:0) to unselect
DDRB &= ~0b01110000;
PORTB &= ~0b01110000;
DDRD &= ~0b10000000;
PORTD &= ~0b10000000;
DDRF &= ~(1<<0 | 1<<1 | 1<<4 | 1<<5);
PORTF |= (1<<0 | 1<<1 | 1<<4 | 1<<5);
}
static void select_row(uint8_t row)
{
switch (row) {
case 0:
DDRB |= (1<<6);
PORTB &= ~(1<<6);
DDRF |= (1<<0);
PORTF &= ~(1<<0);
break;
case 1:
DDRB |= (1<<5);
PORTB &= ~(1<<5);
DDRF |= (1<<1);
PORTF &= ~(1<<1);
break;
case 2:
DDRB |= (1<<4);
PORTB &= ~(1<<4);
DDRF |= (1<<4);
PORTF &= ~(1<<4);
break;
case 3:
DDRD |= (1<<7);
PORTD &= ~(1<<7);
DDRF |= (1<<5);
PORTF &= ~(1<<5);
break;
}
}