summaryrefslogtreecommitdiffstats
path: root/keyboards/handwired/symmetric70_proto/matrix_fast/matrix_extr.h
blob: e0cf528919b73b8d7ad7426f5d2e21595c68492a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once
// clang-format off

#define DIRECT_SWITCH 1
#define DIODE_ROW2COL 2
#define DIODE_COL2ROW 3

#ifndef ROW2COL
#    define COL2ROW 0
#    define ROW2COL 1
#endif

#ifdef DIRECT_PINS
#    define MATRIX_TYPE DIRECT_SWITCH
#else
#    if DIODE_DIRECTION == ROW2COL
#        define MATRIX_TYPE DIODE_ROW2COL
#    endif
#    if DIODE_DIRECTION == COL2ROW
#        define MATRIX_TYPE DIODE_COL2ROW
#    endif
#endif

#ifndef MATRIX_TYPE
#   error "MATRIX_TYPE could not be determined."
#endif

#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 "MATRIX_ROWS: invalid value"
#endif