Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure setPinInput actually sets input high-Z #6237

Merged
merged 9 commits into from
Jan 27, 2020
Merged

Conversation

Duckle29
Copy link
Contributor

@Duckle29 Duckle29 commented Jul 2, 2019

Description

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

The documentation here says that setPinInput() sets the pin to a high-z input. This is true only if the PORTx register is 0, meaning you have to use writePinLow() to go from setPinInputHigh to input high-z again. This fixes that.

@drashna
Copy link
Member

drashna commented Jul 2, 2019

@nooges @mtei @pelrun Could you double check this?

@fauxpark
Copy link
Member

fauxpark commented Jul 2, 2019

I think this should probably be labelled a breaking change, as this macro is used in a few keyboards and keymaps, and in matrix.c. I do like that it now matches the ChibiOS implementation though.

@nooges
Copy link
Member

nooges commented Jul 2, 2019

So from digging into previous usage of using pinMode from pincontrol.h, this change actually brings setPinInput() in line with that. I’ll dig into its use in matrix.c in a bit.

@mtei
Copy link
Contributor

mtei commented Jul 3, 2019

Looks Good To Me.

And the following source file writePinLow() is an AVR-dependent implementation, so I think those writePinLow() should be removed.

 % find . -name '*.[ch]' | xargs grep -A1 'setPinInput(' | grep -v quantum/quantum.h

./keyboards/kbdfans/kbd75/keymaps/tucznak/keymap.c:        setPinInput(B2);
./keyboards/kbdfans/kbd75/keymaps/tucznak/keymap.c-        writePinLow(B2);
--
./keyboards/yd60mq/yd60mq.c:        setPinInput(F4);
./keyboards/yd60mq/yd60mq.c-        writePinLow(F4);
--
./keyboards/gh60/gh60.h:inline void gh60_caps_led_off(void)     { setPinInput(B2); writePinLow(B2); }
./keyboards/gh60/gh60.h:inline void gh60_poker_leds_off(void)   { setPinInput(F4); writePinLow(F4); }
./keyboards/gh60/gh60.h:inline void gh60_fn_led_off(void)       { setPinInput(F5); writePinLow(F5); }
./keyboards/gh60/gh60.h:inline void gh60_esc_led_off(void)      { setPinInput(F6); writePinLow(F6); }
./keyboards/gh60/gh60.h:inline void gh60_wasd_leds_off(void)    { setPinInput(F7); writePinLow(F7); }
./keyboards/gh60/gh60.h-
--
./keyboards/hineybush/h87a/keymaps/wkl/keymap.c:    setPinInput(D5);
./keyboards/hineybush/h87a/keymaps/wkl/keymap.c-    writePinLow(D5);
--
./keyboards/hineybush/h87a/keymaps/wkl/keymap.c:    setPinInput(E6);
./keyboards/hineybush/h87a/keymaps/wkl/keymap.c-    writePinLow(E6);
--

In addition, we will need to check the following source files:

--
./keyboards/gingham/matrix.c:        setPinInput(row_pins[x]);
./keyboards/gingham/matrix.c-    }
--
./keyboards/touchpad/matrix.c:  setPinInput(D2);
./keyboards/touchpad/matrix.c-
--
./keyboards/wasdat/matrix.c:        setPinInput(row_pins[x]);
./keyboards/wasdat/matrix.c-    }
--
./keyboards/kmac/matrix.c:        setPinInput(row_pins[x]);
./keyboards/kmac/matrix.c-    }
--
./keyboards/staryu/backlight_staryu.h:      setPinInput(backlight_pins[index]);
./keyboards/staryu/backlight_staryu.h-  }
--
./keyboards/ai03/orbit/split_util.c:    setPinInput(SPLIT_HAND_PIN);
./keyboards/ai03/orbit/split_util.c-    return readPin(SPLIT_HAND_PIN);
--
./quantum/split_common/split_util.c:    setPinInput(SPLIT_HAND_PIN);
./quantum/split_common/split_util.c-    return readPin(SPLIT_HAND_PIN);
--

@mtei
Copy link
Contributor

mtei commented Jul 3, 2019

Then I opened #6243 because I found a small bug in quantum/matrix.c regarding the use of setPinInput().

@pelrun
Copy link
Contributor

pelrun commented Jul 3, 2019

LGTM.

@fauxpark
Copy link
Member

fauxpark commented Jul 4, 2019

@mtei the Wasdat can be ticked off your list as of #6247 :)

@mtei
Copy link
Contributor

mtei commented Jul 6, 2019

In quantum/split_common/split_util.c, I opened #6268 that adds SPLIT_HAND_PIN_WITH_PULLUP to use setPinInputHigh().

quantum/quantum.h Outdated Show resolved Hide resolved
@drashna
Copy link
Member

drashna commented Jul 22, 2019

This looks to have a merge conflict now. If that could be resolved?

@Duckle29
Copy link
Contributor Author

Ah forgot about that, should be resolved now :)

quantum/quantum.h Show resolved Hide resolved
quantum/quantum.h Outdated Show resolved Hide resolved
@drashna drashna requested review from a team and removed request for fredizzimo July 30, 2019 07:39
@drashna
Copy link
Member

drashna commented Sep 21, 2019

It looks like there is a merge conflict for this now. Could you fix this?

@Duckle29
Copy link
Contributor Author

Duckle29 commented Dec 8, 2019

Good catch that's a mistake, I'll get that fixed :)

@emdarcher
Copy link
Contributor

We also need sign off from the users whos keymaps have been modified:
@emdarcher
@tucznak

Otherwise it would have to target the breaking changes process.

Ok, looks fine to me now. 👍

@Duckle29 Duckle29 requested a review from zvecr December 12, 2019 14:13
@stale
Copy link

stale bot commented Jan 26, 2020

Thank you for your contribution!
This pull request has been automatically marked as stale because it has not had activity in the last 45 days. It will be closed in 30 days if no further activity occurs. Please feel free to give a status update now, or re-open when it's ready.
For maintainers: Please label with awaiting review, breaking_change, in progress, or on hold to prevent the issue from being re-flagged.

@fauxpark fauxpark requested review from a team and removed request for jackhumbert, algernon, mechmerlin, noroadsleft, skullydazed, yanfali and zvecr January 26, 2020 14:40
@nooges nooges merged commit 05d6e6c into qmk:master Jan 27, 2020
@hineybush
Copy link
Contributor

seems good to me regarding my PCBs.

drashna pushed a commit to zsa/qmk_firmware that referenced this pull request Feb 12, 2020
* 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 <[email protected]>

* Fixed input state for unselect_rows

* fixed merge conflict

* Updated all instances of older uses of setPinInput()

* Fixed naming mistake

Co-authored-by: fauxpark <[email protected]>
fdidron pushed a commit to zsa/qmk_firmware that referenced this pull request Feb 14, 2020
* 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 <[email protected]>

* Fixed input state for unselect_rows

* fixed merge conflict

* Updated all instances of older uses of setPinInput()

* Fixed naming mistake

Co-authored-by: fauxpark <[email protected]>
HokieGeek pushed a commit to HokieGeek/qmk_firmware that referenced this pull request Feb 21, 2020
* 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 <[email protected]>

* Fixed input state for unselect_rows

* fixed merge conflict

* Updated all instances of older uses of setPinInput()

* Fixed naming mistake

Co-authored-by: fauxpark <[email protected]>
fdidron pushed a commit to zsa/qmk_firmware that referenced this pull request Feb 26, 2020
* 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 <[email protected]>

* Fixed input state for unselect_rows

* fixed merge conflict

* Updated all instances of older uses of setPinInput()

* Fixed naming mistake

Co-authored-by: fauxpark <[email protected]>
c0psrul3 pushed a commit to c0psrul3/qmk_firmware that referenced this pull request Mar 23, 2020
* 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 <[email protected]>

* Fixed input state for unselect_rows

* fixed merge conflict

* Updated all instances of older uses of setPinInput()

* Fixed naming mistake

Co-authored-by: fauxpark <[email protected]>
@Duckle29 Duckle29 deleted the pincontrol branch March 27, 2020 18:08
kylekuj pushed a commit to kylekuj/qmk_firmware that referenced this pull request Apr 21, 2020
* 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 <[email protected]>

* Fixed input state for unselect_rows

* fixed merge conflict

* Updated all instances of older uses of setPinInput()

* Fixed naming mistake

Co-authored-by: fauxpark <[email protected]>
BorisTestov pushed a commit to BorisTestov/qmk_firmware that referenced this pull request May 23, 2024
* 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 <[email protected]>

* Fixed input state for unselect_rows

* fixed merge conflict

* Updated all instances of older uses of setPinInput()

* Fixed naming mistake

Co-authored-by: fauxpark <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet