Rearranged the columns

Rearranged the columns so we can do some bit shifting and OR-ing magic instead
of manually picking bits from various pins.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/427/head
Gergely Nagy 6 years ago
parent e5ad4c0649
commit d927627a07

@ -129,17 +129,17 @@ void Atreus::unselectRow(uint8_t row)
}
uint16_t Atreus::readCols() {
return ((PIND&(_BV(7)) ? 0 : (_BV(0))) |
(PINC&(_BV(6)) ? 0 : (_BV(1))) |
(PINB&(_BV(5)) ? 0 : (_BV(2))) |
(PINB&(_BV(4)) ? 0 : (_BV(3))) |
(PINE&(_BV(6)) ? 0 : (_BV(4))) |
return ((PINB&(_BV(4)) ? 0 : (_BV(0))) |
(PINB&(_BV(5)) ? 0 : (_BV(1))) |
(PINB&(_BV(6)) ? 0 : (_BV(2))) |
(PINB&(_BV(7)) ? 0 : (_BV(3))) |
(PINC&(_BV(6)) ? 0 : (_BV(4))) |
(PIND&(_BV(4)) ? 0 : (_BV(5))) |
(PINB&(_BV(6)) ? 0 : (_BV(6))) |
(PINF&(_BV(6)) ? 0 : (_BV(7))) |
(PINF&(_BV(7)) ? 0 : (_BV(8))) |
(PIND&(_BV(6)) ? 0 : (_BV(9))) |
(PINB&(_BV(7)) ? 0 : (_BV(10))));
(PIND&(_BV(6)) ? 0 : (_BV(6))) |
(PIND&(_BV(7)) ? 0 : (_BV(7))) |
(PINE&(_BV(6)) ? 0 : (_BV(8))) |
(PINF&(_BV(6)) ? 0 : (_BV(9))) |
(PINF&(_BV(7)) ? 0 : (_BV(10))));
}
void Atreus::readMatrixRow(uint8_t current_row)

@ -143,10 +143,10 @@ class Atreus {
R3C0, R3C1, R3C2, R3C3, R3C4, R3C5, R3C6, R3C7, R3C8, R3C9, R3C10, R3C11 \
) \
{ \
{ R0C0, R0C1, R0C2, R0C3, R0C4, XXX, R0C7, R0C8, R0C9, R0C10, R0C11 }, \
{ R1C0, R1C1, R1C2, R1C3, R1C4, XXX, R1C7, R1C8, R1C9, R1C10, R1C11 }, \
{ R2C0, R2C1, R2C2, R2C3, R2C4, R3C5, R2C7, R2C8, R2C9, R2C10, R2C11 }, \
{ R3C0, R3C1, R3C2, R3C3, R3C4, R3C6, R3C7, R3C8, R3C9, R3C10, R3C11 } \
{ R0C3, R0C2, R0C7, R0C11, R0C1, XXX, R0C10, R0C0, R0C4, R0C8, R0C9 }, \
{ R1C3, R1C2, R1C7, R1C11, R1C1, XXX, R1C10, R1C0, R1C4, R1C8, R1C9 }, \
{ R2C3, R2C2, R2C7, R2C11, R2C1, R3C5, R2C10, R2C0, R2C4, R2C8, R2C9 }, \
{ R3C3, R3C2, R3C7, R3C11, R3C1, R3C6, R3C10, R3C0, R3C4, R3C8, R3C9 } \
}
#define KEYMAP_STACKED( \
@ -161,12 +161,11 @@ class Atreus {
R3C6, R3C7, R3C8, R3C9, R3C10, R3C11 \
) \
{ \
{ R0C0, R0C1, R0C2, R0C3, R0C4, XXX, R0C7, R0C8, R0C9, R0C10, R0C11 }, \
{ R1C0, R1C1, R1C2, R1C3, R1C4, XXX, R1C7, R1C8, R1C9, R1C10, R1C11 }, \
{ R2C0, R2C1, R2C2, R2C3, R2C4, R3C5, R2C7, R2C8, R2C9, R2C10, R2C11 }, \
{ R3C0, R3C1, R3C2, R3C3, R3C4, R3C6, R3C7, R3C8, R3C9, R3C10, R3C11 } \
{ R0C3, R0C2, R0C7, R0C11, R0C1, XXX, R0C10, R0C0, R0C4, R0C8, R0C9 }, \
{ R1C3, R1C2, R1C7, R1C11, R1C1, XXX, R1C10, R1C0, R1C4, R1C8, R1C9 }, \
{ R2C3, R2C2, R2C7, R2C11, R2C1, R3C5, R2C10, R2C0, R2C4, R2C8, R2C9 }, \
{ R3C3, R3C2, R3C7, R3C11, R3C1, R3C6, R3C10, R3C0, R3C4, R3C8, R3C9 } \
}
}
}

Loading…
Cancel
Save