pull/427/head
Jesse Vincent 6 years ago
parent 86d014e7e1
commit febf2babbc

@ -82,11 +82,11 @@ KALEIDOSCOPE_INIT_PLUGINS(Macros);
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
switch (macroIndex) { switch (macroIndex) {
case RESET: case RESET:
Atreus.resetDevice(); Atreus.resetDevice();
break; break;
default: default:
break; break;
} }
return MACRO_NONE; return MACRO_NONE;

@ -48,7 +48,7 @@ void Atreus::setup(void) {
wdt_disable(); wdt_disable();
delay(100); delay(100);
for (uint8_t i=0; i < ROWS; i++) { for (uint8_t i = 0; i < ROWS; i++) {
unselectRow(i); unselectRow(i);
keyState_[i] = previousKeyState_[i] = 0; keyState_[i] = previousKeyState_[i] = 0;
} }
@ -80,70 +80,67 @@ void Atreus::setup(void) {
TIMSK1 = _BV(TOIE1); TIMSK1 = _BV(TOIE1);
} }
void Atreus::selectRow(uint8_t row) void Atreus::selectRow(uint8_t row) {
{
switch (row) { switch (row) {
case 0: case 0:
DDRD |= (_BV(0)); DDRD |= (_BV(0));
PORTD &= ~(_BV(0)); PORTD &= ~(_BV(0));
break; break;
case 1: case 1:
DDRD |= (_BV(1)); DDRD |= (_BV(1));
PORTD &= ~(_BV(1)); PORTD &= ~(_BV(1));
break; break;
case 2: case 2:
DDRD |= (_BV(3)); DDRD |= (_BV(3));
PORTD &= ~(_BV(3)); PORTD &= ~(_BV(3));
break; break;
case 3: case 3:
DDRD |= (_BV(2)); DDRD |= (_BV(2));
PORTD &= ~(_BV(2)); PORTD &= ~(_BV(2));
break; break;
default: default:
break; break;
} }
} }
void Atreus::unselectRow(uint8_t row) void Atreus::unselectRow(uint8_t row) {
{
switch (row) { switch (row) {
case 0: case 0:
DDRD &= ~(_BV(0)); DDRD &= ~(_BV(0));
PORTD |= (_BV(0)); PORTD |= (_BV(0));
break; break;
case 1: case 1:
DDRD &= ~(_BV(1)); DDRD &= ~(_BV(1));
PORTD |= (_BV(1)); PORTD |= (_BV(1));
break; break;
case 2: case 2:
DDRD &= ~(_BV(3)); DDRD &= ~(_BV(3));
PORTD |= (_BV(3)); PORTD |= (_BV(3));
break; break;
case 3: case 3:
DDRD &= ~(_BV(2)); DDRD &= ~(_BV(2));
PORTD |= (_BV(2)); PORTD |= (_BV(2));
break; break;
default: default:
break; break;
} }
} }
uint16_t Atreus::readCols() { uint16_t Atreus::readCols() {
return ((PINB&(_BV(4)) ? 0 : (_BV(0))) | return ((PINB & (_BV(4)) ? 0 : (_BV(0))) |
(PINB&(_BV(5)) ? 0 : (_BV(1))) | (PINB & (_BV(5)) ? 0 : (_BV(1))) |
(PINB&(_BV(6)) ? 0 : (_BV(2))) | (PINB & (_BV(6)) ? 0 : (_BV(2))) |
(PINB&(_BV(7)) ? 0 : (_BV(3))) | (PINB & (_BV(7)) ? 0 : (_BV(3))) |
(PINC&(_BV(6)) ? 0 : (_BV(4))) | (PINC & (_BV(6)) ? 0 : (_BV(4))) |
(PIND&(_BV(4)) ? 0 : (_BV(5))) | (PIND & (_BV(4)) ? 0 : (_BV(5))) |
(PIND&(_BV(6)) ? 0 : (_BV(6))) | (PIND & (_BV(6)) ? 0 : (_BV(6))) |
(PIND&(_BV(7)) ? 0 : (_BV(7))) | (PIND & (_BV(7)) ? 0 : (_BV(7))) |
(PINE&(_BV(6)) ? 0 : (_BV(8))) | (PINE & (_BV(6)) ? 0 : (_BV(8))) |
(PINF&(_BV(6)) ? 0 : (_BV(9))) | (PINF & (_BV(6)) ? 0 : (_BV(9))) |
(PINF&(_BV(7)) ? 0 : (_BV(10)))); (PINF & (_BV(7)) ? 0 : (_BV(10))));
} }
void Atreus::readMatrixRow(uint8_t current_row) void Atreus::readMatrixRow(uint8_t current_row) {
{
uint16_t mask, cols; uint16_t mask, cols;
previousKeyState_[current_row] = keyState_[current_row]; previousKeyState_[current_row] = keyState_[current_row];

Loading…
Cancel
Save