diff options
author | Joshua Colbeck <Skrymir@users.noreply.github.com> | 2016-07-06 20:29:29 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-06 20:29:29 -0500 |
commit | e0e1c119f0c54ff7b69bf8eaa9e641b60610b4d9 (patch) | |
tree | 67aebd55b1538035a1e5839eff3bb66f89d2aca2 /tmk_core/common/matrix.h | |
parent | 21ee3eb569caffdf2ad581c668682c0109c978e5 (diff) | |
parent | 5ed673d82d6cf91aa966a3e903ac37adb519f12c (diff) |
Merge pull request #1 from Skrymir/patch-1
add ergodox layout
Diffstat (limited to 'tmk_core/common/matrix.h')
-rw-r--r-- | tmk_core/common/matrix.h | 57 |
1 files changed, 23 insertions, 34 deletions
diff --git a/tmk_core/common/matrix.h b/tmk_core/common/matrix.h index 5f2f831b45..71153a5f58 100644 --- a/tmk_core/common/matrix.h +++ b/tmk_core/common/matrix.h @@ -20,59 +20,48 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <stdint.h> #include <stdbool.h> -#if MATRIX_COLS <= 8 -typedef uint8_t matrix_row_t; -#elif MATRIX_COLS <= 16 -typedef uint16_t matrix_row_t; -#elif MATRIX_COLS <= 32 -typedef uint32_t matrix_row_t; + +#if (MATRIX_COLS <= 8) +typedef uint8_t matrix_row_t; +#elif (MATRIX_COLS <= 16) +typedef uint16_t matrix_row_t; +#elif (MATRIX_COLS <= 32) +typedef uint32_t matrix_row_t; #else -# error "There are too many columns." +#error "MATRIX_COLS: invalid value" #endif -#if DIODE_DIRECTION == ROW2COL -# if MATRIX_ROWS <= 8 -typedef uint8_t matrix_col_t; -# elif MATRIX_ROWS <= 16 -typedef uint16_t matrix_col_t; -# elif MATRIX_ROWS <= 32 -typedef uint32_t matrix_col_t; -# else -# error "There are too many rows." -# endif -#endif +#define MATRIX_IS_ON(row, col) (matrix_get_row(row) && (1<<col)) -typedef struct { - uint8_t input_addr:4; - uint8_t bit:4; -} io_pin_t; #ifdef __cplusplus extern "C" { #endif -/* counts the number of rows in the matrix */ + +/* number of matrix rows */ uint8_t matrix_rows(void); -/* counts the number of columns in the matrix */ +/* number of matrix columns */ uint8_t matrix_cols(void); -/* sets up the matrix before matrix_init */ +/* should be called at early stage of startup before matrix_init.(optional) */ void matrix_setup(void); -/* intializes the matrix */ +/* intialize matrix for scaning. */ void matrix_init(void); -/* scans the entire matrix */ +/* scan all key states on matrix */ uint8_t matrix_scan(void); -/* checks if the matrix has been modified */ +/* whether modified from previous scan. used after matrix_scan. */ bool matrix_is_modified(void) __attribute__ ((deprecated)); -/* checks if a key is pressed */ +/* whether a swtich is on */ bool matrix_is_on(uint8_t row, uint8_t col); -/* inspects the state of a row in the matrix */ +/* matrix state on row */ matrix_row_t matrix_get_row(uint8_t row); -/* prints the matrix for debugging */ +/* print matrix for debug */ void matrix_print(void); -/* counts the total number of keys pressed */ -uint8_t matrix_key_count(void); -/* controls power to the matrix */ + + +/* power control */ void matrix_power_up(void); void matrix_power_down(void); + /* executes code for Quantum */ void matrix_init_quantum(void); void matrix_scan_quantum(void); |