summaryrefslogtreecommitdiff
path: root/keyboard/atomic/matrix.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboard/atomic/matrix.c')
-rw-r--r--keyboard/atomic/matrix.c72
1 files changed, 27 insertions, 45 deletions
diff --git a/keyboard/atomic/matrix.c b/keyboard/atomic/matrix.c
index 98102cb694..2f2dbdb108 100644
--- a/keyboard/atomic/matrix.c
+++ b/keyboard/atomic/matrix.c
@@ -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)
{
@@ -56,7 +55,6 @@ uint8_t matrix_cols(void)
return MATRIX_COLS;
}
-
void matrix_init(void)
{
// initialize row and col
@@ -96,7 +94,6 @@ uint8_t matrix_scan(void)
}
}
-
return 1;
}
@@ -109,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
@@ -137,51 +134,39 @@ 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)
{
- DDRC &= ~(1<<6 | 1<<7);
- PORTC |= (1<<6 | 1<<7);
- DDRD &= ~(1<<4 | 1<<5 | 1<<6 | 1<<7);
- PORTD |= (1<<4 | 1<<5 | 1<<6 | 1<<7);
- DDRB &= ~(1<<4 | 1<<5 | 1<<6);
- PORTB |= (1<<4 | 1<<5 | 1<<6);
- 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);
+ 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 (PINC&(1<<6) ? 0 : (1<< 0)) |
- (PINC&(1<<7) ? 0 : (1<< 1)) |
- (PIND&(1<<5) ? 0 : (1<< 2)) |
- (PIND&(1<<4) ? 0 : (1<< 3)) |
- (PIND&(1<<6) ? 0 : (1<< 4)) |
- (PIND&(1<<7) ? 0 : (1<< 5)) |
- (PINB&(1<<4) ? 0 : (1<< 6)) |
- (PINB&(1<<5) ? 0 : (1<< 7)) |
- (PINB&(1<<6) ? 0 : (1<< 8)) |
- (PINF&(1<<7) ? 0 : (1<< 9)) |
- (PINF&(1<<6) ? 0 : (1<<10)) |
- (PINF&(1<<5) ? 0 : (1<<11)) |
- (PINF&(1<<4) ? 0 : (1<<12)) |
- (PINF&(1<<1) ? 0 : (1<<13)) |
- (PINF&(1<<0) ? 0 : (1<<14));
+ 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));
+
}
-/* 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 &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<7);
- PORTB |= (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<7);
+ DDRB &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3);
+ PORTB |= (1<<0 | 1<<1 | 1<<2 | 1<<3);
+
}
static void select_row(uint8_t row)
@@ -203,9 +188,6 @@ static void select_row(uint8_t row)
DDRB |= (1<<3);
PORTB &= ~(1<<3);
break;
- case 4:
- DDRB |= (1<<7);
- PORTB &= ~(1<<7);
- break;
+
}
}