summaryrefslogtreecommitdiffstats
path: root/quantum/dip_switch.c
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2022-11-28 07:54:00 +1100
committerNick Brassel <nick@tzarc.org>2022-11-28 07:54:00 +1100
commit4020674163fc80914059c4c9c3be5c0ae00bd150 (patch)
tree6f4187d72b04d03572adf507502afbda9726d696 /quantum/dip_switch.c
parent8f9b49dc5b05fd3421e47aa76822a5b2199dfca6 (diff)
parent9e78e65a566487b2f4fe7b663971a01deb6ddad2 (diff)
Merge remote-tracking branch 'upstream/develop'
Diffstat (limited to 'quantum/dip_switch.c')
-rw-r--r--quantum/dip_switch.c12
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;