changes as necessary for multiple HATs#12
Open
ifurusato wants to merge 1 commit intopimoroni:mainfrom
Open
Conversation
Member
|
Hi @ifurusato. Thank you very much for this! I have a few minor comments I'll list separately. |
Comment on lines
+109
to
+112
| self._pin_user_sw = gpiodevice.get_pin(self.PI_USER_SW_PIN, "IHM-SW", INPD) | ||
|
|
||
| # Setup amplifier enable. This mutes the audio by default | ||
| self._pin_amp_en = gpiodevice.get_pin(self.PI_AMP_EN_PIN, "IHM-AMP-En", OUTL if start_muted else OUTH) | ||
| # Setup amplifier enable. This mutes the audio by default | ||
| self._pin_amp_en = gpiodevice.get_pin(self.PI_AMP_EN_PIN, "IHM-AMP-En", OUTL if start_muted else OUTH) |
Member
There was a problem hiding this comment.
Since these are not assigned for the second IHM, I assume that switch_pressed(), mute_audio(), and unmute_audio() will fail if called? Can you include some handling for this? E.g. set self._pin_user_sw and self._pin_amp_en to None then check for that in all relevant places?
Pull Request Test Coverage Report for Build 11788891006Details
💛 - Coveralls |
Member
|
It's possible for multiple library instances to share the same "pin", they just can't both claim it. I did something to this end in the ST7789 library where if pre-claimed pins (basically just a gpiod lines object and an offset) are passed into the constructor, it will use them directly. Might also be useful here? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This introduces some backward-compatible changes to the Inventor HAT Mini library to permit multiple HATs co-existing. This disables audio and the User button on anything but the default I2C address of
0x17, since those pins would be in conflict.