From a7182e20707517496f2d4071fbe8f8eff36e22e6 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 25 Jan 2016 16:33:09 -0800 Subject: [PATCH] Modernize some 'int' datatypes --- KeyboardConfig.h | 19 ++++++++++--------- KeyboardioFirmware.h | 7 +++---- KeyboardioFirmware.ino | 6 +++--- key_defs.h | 4 ++-- led_control.h | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/KeyboardConfig.h b/KeyboardConfig.h index d9c3195c..40ae0bb6 100644 --- a/KeyboardConfig.h +++ b/KeyboardConfig.h @@ -6,15 +6,16 @@ #define EEPROM_KEYMAP_LOCATION 0 -int RIGHT_COLS=8; -int RIGHT_ROWS=4; -int LEFT_COLS=8; -int LEFT_ROWS=4; -int left_colpins[]= {7,6,5,4,3,2,1,0}; -int left_rowpins[]= {8,9,10,11}; - -int right_colpins[]= {0,1,2,3,4,5,6,7}; -int right_rowpins[]= {8,9,10,11}; +#define RIGHT_COLS 8 +#define RIGHT_ROWS 4 +#define LEFT_COLS 8 +#define LEFT_ROWS 4 + +uint8_t left_colpins[]= {7,6,5,4,3,2,1,0}; +uint8_t left_rowpins[]= {8,9,10,11}; + +uint8_t right_colpins[]= {0,1,2,3,4,5,6,7}; +uint8_t right_rowpins[]= {8,9,10,11}; diff --git a/KeyboardioFirmware.h b/KeyboardioFirmware.h index 8fe33b6e..80f8d628 100644 --- a/KeyboardioFirmware.h +++ b/KeyboardioFirmware.h @@ -29,15 +29,14 @@ void setup(); #include #include "KeyboardioSX1509.h" -//extern int usbMaxPower; +//extern uint8_t usbMaxPower; char x; char y; -byte matrixState[ROWS][COLS]; +uint8_t matrixState[ROWS][COLS]; static const Key keymaps[KEYMAPS][ROWS][COLS] = { KEYMAP_LIST }; -long reporting_counter = 0; byte primary_keymap = 0; byte temporary_keymap = 0; @@ -83,7 +82,7 @@ void send_key_events(); void send_key_event(byte row, byte col); void press_key(Key mappedKey); -int setup_sx1509(sx1509Class sx1509, int colpins[], int rowpins[]); +int setup_sx1509(sx1509Class sx1509, uint8_t colpins[], uint8_t rowpins[]); #ifndef VERSION #define VERSION "locally-built" diff --git a/KeyboardioFirmware.ino b/KeyboardioFirmware.ino index 783f8990..ed3a63bc 100644 --- a/KeyboardioFirmware.ino +++ b/KeyboardioFirmware.ino @@ -293,14 +293,14 @@ void press_key(Key mappedKey) { Keyboard.press(mappedKey.rawKey); } -void make_input(sx1509Class sx1509, int pin) { +void make_input(sx1509Class sx1509, uint8_t pin) { sx1509.pinDir(pin, INPUT); // Set SX1509 pin 1 as an input sx1509.writePin(pin, HIGH); // Activate pull-up } -void make_output(sx1509Class sx1509, int pin) { +void make_output(sx1509Class sx1509, uint8_t pin) { sx1509.pinDir(pin, OUTPUT); sx1509.writePin(pin, HIGH); @@ -314,7 +314,7 @@ void setup_pins() { } -int setup_sx1509 (sx1509Class sx1509, int colpins[], int rowpins[]) { +int setup_sx1509 (sx1509Class sx1509, uint8_t colpins[], uint8_t rowpins[]) { byte initted; for (int counter = 0; counter < 10; counter++) { diff --git a/key_defs.h b/key_defs.h index 9317e90b..27285b89 100644 --- a/key_defs.h +++ b/key_defs.h @@ -3,8 +3,8 @@ #include "HIDTables.h" typedef struct { - int8_t flags; - int8_t rawKey; + uint8_t flags; + uint8_t rawKey; } Key; diff --git a/led_control.h b/led_control.h index 78eb109e..1e06a3fe 100644 --- a/led_control.h +++ b/led_control.h @@ -17,7 +17,7 @@ #define LED_COUNT 64 -static const int8_t key_led_map[4][16] = { +static const uint8_t key_led_map[4][16] = { {3,4,11,12,19,20,26,27, 36,37,43,44,51,52,59,60}, {2,5,10,13,18,21,31,28, 35,32,42,45,50,53,58,61}, {1,6,9,14, 17,22,25,29, 34,38,41,46,49,54,57,62},