From 2e0d872ab7ba8446cb7a9536acafd59d1db57f14 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Tue, 13 Jan 2015 18:05:37 -0500 Subject: sean --- keyboard/planck/matrix.c | 58 +++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 30 deletions(-) (limited to 'keyboard/planck/matrix.c') diff --git a/keyboard/planck/matrix.c b/keyboard/planck/matrix.c index ca59f7c73b..38d35e3e07 100644 --- a/keyboard/planck/matrix.c +++ b/keyboard/planck/matrix.c @@ -136,38 +136,36 @@ uint8_t matrix_key_count(void) static void init_cols(void) { - 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); + DDRB &= ~(1<<6 | 1<<5 | 1<<4); + PORTB |= (1<<6 | 1<<5 | 1<<4); + DDRD &= ~(1<<7 | 1<<6 | 1<<4); + PORTD |= (1<<7 | 1<<6 | 1<<4); + 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); } static matrix_row_t read_cols(void) { - 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)); + return (PIND&(1<<4) ? 0 : (1<<0)) | + (PIND&(1<<6) ? 0 : (1<<1)) | + (PIND&(1<<7) ? 0 : (1<<2)) | + (PINB&(1<<4) ? 0 : (1<<3)) | + (PINB&(1<<5) ? 0 : (1<<4)) | + (PINB&(1<<6) ? 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)); } static void unselect_rows(void) { - DDRF &= ~(1<<0 | 1<<1 | 1<<4 | 1<<5); - PORTF |= (1<<0 | 1<<1 | 1<<4 | 1<<5); + DDRB &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3); + PORTB |= (1<<0 | 1<<1 | 1<<2 | 1<<3); } @@ -175,20 +173,20 @@ static void select_row(uint8_t row) { switch (row) { case 0: - DDRF |= (1<<0); - PORTF &= ~(1<<0); + DDRB |= (1<<0); + PORTB &= ~(1<<0); break; case 1: - DDRF |= (1<<1); - PORTF &= ~(1<<1); + DDRB |= (1<<1); + PORTB &= ~(1<<1); break; case 2: - DDRF |= (1<<4); - PORTF &= ~(1<<4); + DDRB |= (1<<2); + PORTB &= ~(1<<2); break; case 3: - DDRF |= (1<<5); - PORTF &= ~(1<<5); + DDRB |= (1<<3); + PORTB &= ~(1<<3); break; } -- cgit v1.2.3