diff options
Diffstat (limited to 'quantum/dip_switch.c')
-rw-r--r-- | quantum/dip_switch.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/quantum/dip_switch.c b/quantum/dip_switch.c index eee29aaf91..6e254578d1 100644 --- a/quantum/dip_switch.c +++ b/quantum/dip_switch.c @@ -16,14 +16,16 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <string.h> // for memcpy + #include "dip_switch.h" +#include "gpio.h" +#include "util.h" + #ifdef SPLIT_KEYBOARD # include "split_common/split_util.h" #endif -// for memcpy -#include <string.h> - #if !defined(DIP_SWITCH_PINS) && !defined(DIP_SWITCH_MATRIX_GRID) # error "Either DIP_SWITCH_PINS or DIP_SWITCH_MATRIX_GRID must be defined." #endif @@ -33,7 +35,7 @@ #endif #ifdef DIP_SWITCH_PINS -# define NUMBER_OF_DIP_SWITCHES (sizeof(dip_switch_pad) / sizeof(pin_t)) +# define NUMBER_OF_DIP_SWITCHES (ARRAY_SIZE(dip_switch_pad)) static pin_t dip_switch_pad[] = DIP_SWITCH_PINS; #endif @@ -43,7 +45,7 @@ typedef struct matrix_index_t { uint8_t col; } matrix_index_t; -# define NUMBER_OF_DIP_SWITCHES (sizeof(dip_switch_pad) / sizeof(matrix_index_t)) +# define NUMBER_OF_DIP_SWITCHES (ARRAY_SIZE(dip_switch_pad)) static matrix_index_t dip_switch_pad[] = DIP_SWITCH_MATRIX_GRID; extern bool peek_matrix(uint8_t row_index, uint8_t col_index, bool read_raw); static uint16_t scan_count; |