diff options
author | lokher <lokher@gmail.com> | 2022-12-06 17:04:10 +0800 |
---|---|---|
committer | lokher <lokher@gmail.com> | 2022-12-06 17:04:10 +0800 |
commit | 27fc28fd2ff52e079a5bc58d6aaea4c752420615 (patch) | |
tree | 7ac943fb1ba4f430a7220efd18f66f6a77205c30 /quantum/dip_switch.c | |
parent | e736133392fe6427cfb995da0787337189828272 (diff) | |
parent | 2709b6ed616f8012ff4cfd3ee69a822a8d188351 (diff) |
Merge upstream master
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; |