diff options
Diffstat (limited to 'software/scan.ino')
-rw-r--r-- | software/scan.ino | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/software/scan.ino b/software/scan.ino index cc72e21..b369609 100644 --- a/software/scan.ino +++ b/software/scan.ino @@ -1,6 +1,7 @@ #include "scan.h" #include "shift.h" #include "software.h" +#include "util.h" // 0 = horizontal (top-bottom), 1 = vertical (left-right) unsigned char scan_direction = 0; @@ -18,6 +19,8 @@ unsigned char get_state_row(unsigned char row, unsigned char direction) { } void scan() { + optimize_scan(); + shift_state[0] = 0x00 ^ (1 << scan_index); shift_state[1] = 0xff ^ get_state_row(scan_index, scan_direction); @@ -45,6 +48,14 @@ void optimize_scan() { } } + Serial.print("[ "); + for(int i = 0; i < 8; i++) { + Serial.print((unsigned int) hv_empty[0][i], DEC); + if(i != 7) Serial.print(", "); + } + Serial.print(" ]"); + + optimal_direction = hv_emptyc[0] > hv_emptyc[1] ? 0 : 1; scan_direction = optimal_direction; memcpy(&scan_order, &hv_emptyc[optimal_direction], sizeof(scan_order)); |