-/* Copyright (C) 2011 by Jacob Alexander
- *
+/* Copyright (C) 2011,2014 by Jacob Alexander
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// ----- Macros -----
// -- pinSetup Macros --
-#define REG_SET(reg) reg |= (1 << ( matrix[row*(MAX_ROW_SIZE+1)+col] % 10 ) ) // Modulo 10 for the define offset for each pin set 12 or 32 -> shift of 2
+#define REG_SET(reg) reg |= (1 << ( matrix[row*(MAX_ROW_SIZE+1)+col] % 10 ) ) // Modulo 10 for the define offset for each pin set 12 or 32 -> shift of 2
#define REG_UNSET(reg) reg &= ~(1 << ( matrix[row*(MAX_ROW_SIZE+1)+col] % 10 ) )
#define PIN_SET(pin,scan,direction) \
case scanDual: \
REG_SET(port##pin); break; \
case scanCol_powrRow: REG_UNSET(ddr##pin); REG_UNSET(DDR##pin); \
- REG_SET(port##pin); REG_SET(PORT##pin); break; \
+ REG_SET(port##pin); REG_SET(PORT##pin); break; \
case powrRow: break; \
case powrCol: REG_SET(ddr##pin); REG_SET(DDR##pin); \
REG_SET(port##pin); REG_SET(PORT##pin); break; \
case scanDual: \
REG_SET(port##pin); break; \
case scanCol_powrRow: REG_SET(ddr##pin); REG_SET(DDR##pin); \
- REG_UNSET(port##pin); REG_UNSET(PORT##pin); break; \
+ REG_UNSET(port##pin); REG_UNSET(PORT##pin); break; \
case powrRow: REG_SET(ddr##pin); REG_SET(DDR##pin); \
- REG_SET(port##pin); REG_SET(PORT##pin); break; \
+ REG_SET(port##pin); REG_SET(PORT##pin); break; \
case powrCol: break; \
} \
break
if ( showDebug == 0 ) // Only show once
{
matrix_debugPins();
- }
+ }
}
// Scans the given matrix determined by the scanMode method
_delay_us( 1 );
col = 1;
row = 1;
- for ( ; col < (MAX_ROW_SIZE+1); col++ ) for ( ; row < (MAX_COL_SIZE+1); row++ )
+ for ( ; col < (MAX_ROW_SIZE+1); col++ ) for ( ; row < (MAX_COL_SIZE+1); row++ )
{
// Scan over the pins for each of the rows, and using the pin alias to determine which pin to set
// (e.g. / 10 is for the pin name (A,B,C,etc.) and % 10 is for the position of the pin (A1,A2,etc.))
}
#endif
}
-
+