summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikkel Jeppesen <2756925+Duckle29@users.noreply.github.com>2020-01-27 05:04:39 +0100
committerDanny <nooges@users.noreply.github.com>2020-01-26 23:04:38 -0500
commit05d6e6ca78087969d7a47862341d10b6b555c37e (patch)
tree5cd80f59929781006d2412a9862a47fc05c4ec7c
parent645c5fabf24411fe65d2172a3509c26e053651a2 (diff)
Ensure setPinInput actually sets input high-Z (#6237)0.7.122
* Ensure setPinInput actually sets input high-z * Fixed _PIN_ADDRESS Macro arguments as recommended by vomindoraan * Fixed instances of setInput to use new behavour * Changed kmac matrix to use input with pullups * Update keyboards/gh60/revc/revc.h Co-Authored-By: fauxpark <fauxpark@gmail.com> * Fixed input state for unselect_rows * fixed merge conflict * Updated all instances of older uses of setPinInput() * Fixed naming mistake Co-authored-by: fauxpark <fauxpark@gmail.com>
-rw-r--r--keyboards/40percentclub/mf68/keymaps/emdarcher/keymap.c2
-rw-r--r--keyboards/atreus62/keymaps/xyverz/keymap.c3
-rw-r--r--keyboards/atreus62/keymaps/xyverz/readme.md4
-rw-r--r--keyboards/eco/keymaps/xyverz/keymap.c4
-rw-r--r--keyboards/gh60/revc/revc.h10
-rw-r--r--keyboards/gingham/matrix.c2
-rw-r--r--keyboards/handwired/owlet60/matrix.c5
-rw-r--r--keyboards/hineybush/h87a/keymaps/wkl/keymap.c2
-rw-r--r--keyboards/hineybush/h88/h88.c2
-rw-r--r--keyboards/kbdfans/kbd75/keymaps/tucznak/keymap.c1
-rw-r--r--keyboards/kmac/matrix.c2
-rw-r--r--keyboards/minidox/keymaps/xyverz/keymap.c4
-rw-r--r--keyboards/noxary/268_2/268_2.c1
-rw-r--r--keyboards/orthodox/keymaps/xyverz/keymap.c4
-rw-r--r--keyboards/yd60mq/yd60mq.c1
-rw-r--r--layouts/community/ortho_4x12/xyverz/keymap.c4
-rw-r--r--layouts/community/ortho_5x12/xyverz/keymap.c4
-rw-r--r--quantum/config_common.h2
-rw-r--r--quantum/quantum.h3
19 files changed, 21 insertions, 39 deletions
diff --git a/keyboards/40percentclub/mf68/keymaps/emdarcher/keymap.c b/keyboards/40percentclub/mf68/keymaps/emdarcher/keymap.c
index 546f862a6e..eb281f5f18 100644
--- a/keyboards/40percentclub/mf68/keymaps/emdarcher/keymap.c
+++ b/keyboards/40percentclub/mf68/keymaps/emdarcher/keymap.c
@@ -48,8 +48,6 @@ void led_set_user(uint8_t usb_led){
} else {
//set to Hi-Z
setPinInput(B0);
- writePinLow(B0);
setPinInput(D5);
- writePinLow(D5);
}
}
diff --git a/keyboards/atreus62/keymaps/xyverz/keymap.c b/keyboards/atreus62/keymaps/xyverz/keymap.c
index 4babed4c11..b852d5d7b9 100644
--- a/keyboards/atreus62/keymaps/xyverz/keymap.c
+++ b/keyboards/atreus62/keymaps/xyverz/keymap.c
@@ -30,6 +30,7 @@ CHANGELOG:
0.6 - Swapped ESC and GRV in all layers.
0.7 - Brought code up to current standards.
0.8 - Added MACLOCK macro.
+ 0.9 - Updated code to correspond to new setPinInput behaviour
TODO:
@@ -124,9 +125,7 @@ void matrix_init_user(void) {
#ifdef BOOTLOADER_CATERINA
// This will disable the red LEDs on the ProMicros
setPinInput(D5);
- writePinLow(D5);
setPinInput(B0);
- writePinLow(B0);
#endif
};
diff --git a/keyboards/atreus62/keymaps/xyverz/readme.md b/keyboards/atreus62/keymaps/xyverz/readme.md
index f91a87da4f..531e3b28d9 100644
--- a/keyboards/atreus62/keymaps/xyverz/readme.md
+++ b/keyboards/atreus62/keymaps/xyverz/readme.md
@@ -30,6 +30,10 @@ The bottom row is fairly Kinesis-ish since the Contour and Advantage keyboards h
### 0.7
* Brought code up to new standards (as of 27 June 2019).
* Updated this readme file.
+### 0.8
+ * Added MACLOCK macro.
+### 0.9
+ * Updated code to correspond to new setPinInput behaviour.
### TODO:
diff --git a/keyboards/eco/keymaps/xyverz/keymap.c b/keyboards/eco/keymaps/xyverz/keymap.c
index 5a1974336a..06054e9ac8 100644
--- a/keyboards/eco/keymaps/xyverz/keymap.c
+++ b/keyboards/eco/keymaps/xyverz/keymap.c
@@ -132,9 +132,7 @@ void matrix_init_user(void) {
#ifdef BOOTLOADER_CATERINA
// This will disable the red LEDs on the ProMicros
setPinInput(D5);
- writePinLow(D5);
setPinInput(B0);
- writePinLow(B0);
#endif
};
@@ -155,4 +153,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
}
return true;
-} \ No newline at end of file
+}
diff --git a/keyboards/gh60/revc/revc.h b/keyboards/gh60/revc/revc.h
index dda7a0db6d..e183f776e9 100644
--- a/keyboards/gh60/revc/revc.h
+++ b/keyboards/gh60/revc/revc.h
@@ -18,11 +18,11 @@ inline void gh60_fn_led_on(void) { setPinOutput(F5); writePinLow(F5); }
inline void gh60_esc_led_on(void) { setPinOutput(F6); writePinLow(F6); }
inline void gh60_wasd_leds_on(void) { setPinOutput(F7); writePinLow(F7); }
-inline void gh60_caps_led_off(void) { setPinInput(B2); writePinLow(B2); }
-inline void gh60_poker_leds_off(void) { setPinInput(F4); writePinLow(F4); }
-inline void gh60_fn_led_off(void) { setPinInput(F5); writePinLow(F5); }
-inline void gh60_esc_led_off(void) { setPinInput(F6); writePinLow(F6); }
-inline void gh60_wasd_leds_off(void) { setPinInput(F7); writePinLow(F7); }
+inline void gh60_caps_led_off(void) { setPinInput(B2); }
+inline void gh60_poker_leds_off(void) { setPinInput(F4); }
+inline void gh60_fn_led_off(void) { setPinInput(F5); }
+inline void gh60_esc_led_off(void) { setPinInput(F6); }
+inline void gh60_wasd_leds_off(void) { setPinInput(F7); }
/* GH60 keymap definition macro
* K2C, K31 and K3C are extra keys for ISO
diff --git a/keyboards/gingham/matrix.c b/keyboards/gingham/matrix.c
index 790ba9c287..5ac81e7911 100644
--- a/keyboards/gingham/matrix.c
+++ b/keyboards/gingham/matrix.c
@@ -150,7 +150,7 @@ static void unselect_row(uint8_t row)
static void unselect_rows(void)
{
for(uint8_t x = 0; x < MATRIX_ROWS; x++) {
- setPinInput(row_pins[x]);
+ setPinInputHigh(row_pins[x]);
}
}
diff --git a/keyboards/handwired/owlet60/matrix.c b/keyboards/handwired/owlet60/matrix.c
index 994f527ec7..dafc19fcc4 100644
--- a/keyboards/handwired/owlet60/matrix.c
+++ b/keyboards/handwired/owlet60/matrix.c
@@ -215,10 +215,7 @@ void matrix_init(void) {
matrix_init_quantum();
setPinInput(D5);
- writePinLow(D5);
-
- setPinInput(B0);
- writePinLow(B0);
+ setPinInput(B0);
}
// modified for per col read matrix scan
diff --git a/keyboards/hineybush/h87a/keymaps/wkl/keymap.c b/keyboards/hineybush/h87a/keymaps/wkl/keymap.c
index 72b4d4e44d..e3e4108233 100644
--- a/keyboards/hineybush/h87a/keymaps/wkl/keymap.c
+++ b/keyboards/hineybush/h87a/keymaps/wkl/keymap.c
@@ -59,7 +59,6 @@ void led_set_user(uint8_t usb_led) {
writePinLow(D5);
} else {
setPinInput(D5);
- writePinLow(D5);
}
if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
@@ -67,7 +66,6 @@ void led_set_user(uint8_t usb_led) {
writePinLow(E6);
} else {
setPinInput(E6);
- writePinLow(E6);
}
}
diff --git a/keyboards/hineybush/h88/h88.c b/keyboards/hineybush/h88/h88.c
index 46d6393907..1f702e9e9d 100644
--- a/keyboards/hineybush/h88/h88.c
+++ b/keyboards/hineybush/h88/h88.c
@@ -54,7 +54,6 @@ void led_set_user(uint8_t usb_led) {
writePinLow(D5);
} else {
setPinInput(D5);
- writePinLow(D5);
}
if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
@@ -62,7 +61,6 @@ void led_set_user(uint8_t usb_led) {
writePinLow(E6);
} else {
setPinInput(E6);
- writePinLow(E6);
}
}
diff --git a/keyboards/kbdfans/kbd75/keymaps/tucznak/keymap.c b/keyboards/kbdfans/kbd75/keymaps/tucznak/keymap.c
index ad3b6f6c5c..1221e753a4 100644
--- a/keyboards/kbdfans/kbd75/keymaps/tucznak/keymap.c
+++ b/keyboards/kbdfans/kbd75/keymaps/tucznak/keymap.c
@@ -85,6 +85,5 @@ void led_set_user(uint8_t usb_led) {
writePinLow(B2);
} else {
setPinInput(B2);
- writePinLow(B2);
}
}
diff --git a/keyboards/kmac/matrix.c b/keyboards/kmac/matrix.c
index 2212ee076b..9bc59a0784 100644
--- a/keyboards/kmac/matrix.c
+++ b/keyboards/kmac/matrix.c
@@ -140,7 +140,7 @@ static void select_col(uint8_t col) {
static void init_pins(void) {
unselect_cols();
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
- setPinInput(row_pins[x]);
+ setPinInputHigh(row_pins[x]);
}
setPinInputHigh(E2);
diff --git a/keyboards/minidox/keymaps/xyverz/keymap.c b/keyboards/minidox/keymaps/xyverz/keymap.c
index 994ee4e1b4..4c7a05227f 100644
--- a/keyboards/minidox/keymaps/xyverz/keymap.c
+++ b/keyboards/minidox/keymaps/xyverz/keymap.c
@@ -169,9 +169,7 @@ void matrix_init_user(void) {
#ifdef BOOTLOADER_CATERINA
// This will disable the red LEDs on the ProMicros
setPinInput(D5);
- writePinLow(D5);
setPinInput(B0);
- writePinLow(B0);
#endif
};
@@ -192,4 +190,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
}
return true;
-} \ No newline at end of file
+}
diff --git a/keyboards/noxary/268_2/268_2.c b/keyboards/noxary/268_2/268_2.c
index 9e2d822364..5af56a386d 100644
--- a/keyboards/noxary/268_2/268_2.c
+++ b/keyboards/noxary/268_2/268_2.c
@@ -21,7 +21,6 @@ void led_set_kb(uint8_t usb_led) {
writePinHigh(B0);
} else {
setPinInput(B0);
- writePinLow(B0);
}
led_set_user(usb_led);
diff --git a/keyboards/orthodox/keymaps/xyverz/keymap.c b/keyboards/orthodox/keymaps/xyverz/keymap.c
index cc3c38943b..0417c1a4a0 100644
--- a/keyboards/orthodox/keymaps/xyverz/keymap.c
+++ b/keyboards/orthodox/keymaps/xyverz/keymap.c
@@ -63,9 +63,7 @@ void matrix_init_user(void) {
#ifdef BOOTLOADER_CATERINA
// This will disable the red LEDs on the ProMicros
setPinInput(D5);
- writePinLow(D5);
setPinInput(B0);
- writePinLow(B0);
#endif
};
@@ -86,4 +84,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
}
return true;
-} \ No newline at end of file
+}
diff --git a/keyboards/yd60mq/yd60mq.c b/keyboards/yd60mq/yd60mq.c
index 96306d6a66..6e391046e5 100644
--- a/keyboards/yd60mq/yd60mq.c
+++ b/keyboards/yd60mq/yd60mq.c
@@ -6,7 +6,6 @@ void led_set_kb(uint8_t usb_led) {
writePinLow(F4);
} else {
setPinInput(F4);
- writePinLow(F4);
}
led_set_user(usb_led);
diff --git a/layouts/community/ortho_4x12/xyverz/keymap.c b/layouts/community/ortho_4x12/xyverz/keymap.c
index a21c143f00..c9811ea4b1 100644
--- a/layouts/community/ortho_4x12/xyverz/keymap.c
+++ b/layouts/community/ortho_4x12/xyverz/keymap.c
@@ -132,9 +132,7 @@ void matrix_init_user(void) {
#ifdef BOOTLOADER_CATERINA
// This will disable the red LEDs on the ProMicros
setPinInput(D5);
- writePinLow(D5);
setPinInput(B0);
- writePinLow(B0);
#endif
};
@@ -155,4 +153,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
}
return true;
-} \ No newline at end of file
+}
diff --git a/layouts/community/ortho_5x12/xyverz/keymap.c b/layouts/community/ortho_5x12/xyverz/keymap.c
index 2cca237bbe..00fca1b48e 100644
--- a/layouts/community/ortho_5x12/xyverz/keymap.c
+++ b/layouts/community/ortho_5x12/xyverz/keymap.c
@@ -151,9 +151,7 @@ void matrix_init_user(void) {
#ifdef BOOTLOADER_CATERINA
// This will disable the red LEDs on the ProMicros
setPinInput(D5);
- writePinLow(D5);
setPinInput(B0);
- writePinLow(B0);
#endif
};
@@ -174,4 +172,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
}
return true;
-} \ No newline at end of file
+}
diff --git a/quantum/config_common.h b/quantum/config_common.h
index 8de3f070c5..f981f3f8cb 100644
--- a/quantum/config_common.h
+++ b/quantum/config_common.h
@@ -132,7 +132,7 @@
# endif
# ifndef __ASSEMBLER__
-# define _PIN_ADDRESS(p, offset) _SFR_IO8(ADDRESS_BASE + (p >> PORT_SHIFTER) + offset)
+# define _PIN_ADDRESS(p, offset) _SFR_IO8(ADDRESS_BASE + ((p) >> PORT_SHIFTER) + (offset))
// Port X Input Pins Address
# define PINx_ADDRESS(p) _PIN_ADDRESS(p, 0)
// Port X Data Direction Register, 0:input 1:output
diff --git a/quantum/quantum.h b/quantum/quantum.h
index 48887026d2..3b9eeaa6de 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -174,7 +174,7 @@ extern layer_state_t layer_state;
#if defined(__AVR__)
typedef uint8_t pin_t;
-# define setPinInput(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF))
+# define setPinInput(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF), PORTx_ADDRESS(pin) &= ~_BV((pin)&0xF))
# define setPinInputHigh(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF), PORTx_ADDRESS(pin) |= _BV((pin)&0xF))
# define setPinInputLow(pin) _Static_assert(0, "AVR processors cannot implement an input as pull low")
# define setPinOutput(pin) (DDRx_ADDRESS(pin) |= _BV((pin)&0xF))
@@ -184,6 +184,7 @@ typedef uint8_t pin_t;
# define writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin))
# define readPin(pin) ((bool)(PINx_ADDRESS(pin) & _BV((pin)&0xF)))
+
#elif defined(PROTOCOL_CHIBIOS)
typedef ioline_t pin_t;