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

Implementation for IO-Expanders #44

Merged
merged 1 commit into from
Jul 31, 2024
Merged

Conversation

PercyJW-2
Copy link
Contributor

Currently, only MCP23017 Devices are possible, but I have tested the Implementation and it works

@sago35
Copy link
Owner

sago35 commented Jul 30, 2024

@PercyJW-2
Thank you for the PR. It looks good at first glance.

I have one question. I think the kbexpander.go is handling switches connected in a matrix to the MCP23017. Is the source code based on kbmatrix.go?

@PercyJW-2
Copy link
Contributor Author

PercyJW-2 commented Jul 30, 2024 via email

Comment on lines +35 to +40
if !o.InvertDiode {
_ = expanderDevice.Pin(c).SetMode(mcp23017.Output)
_ = expanderDevice.Pin(c).Set(true)
} else {
_ = expanderDevice.Pin(c).SetMode(mcp23017.Input | mcp23017.Pullup)
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you are using Pullup here? I think the PR can be merged as it is now.
Depending on the reason, it might be necessary to create a PR in the future that allows for selecting either Pullup or Pulldown, including for kbmatrix.go.

I have one more request. Could you share the expected circuit diagram? kbmatrix.go assumes the following. I assume it's the same circuit, just differing in whether to use pullup or pulldown.

image
https://kicanvas.org/?github=https%3A%2F%2Fgithub.com%2Fsago35%2Ftinygo-keyboard%2Ftree%2Fmain%2Fkicad%2Ffric10key%2Ffric10key

@PercyJW-2
Copy link
Contributor Author

PercyJW-2 commented Jul 31, 2024 via email

@sago35
Copy link
Owner

sago35 commented Jul 31, 2024

I see, it only supports pull-up. Understood.

https://ww1.microchip.com/downloads/en/DeviceDoc/20001952C.pdf

Copy link
Owner

@sago35 sago35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks for your contoribution!! @PercyJW-2

@sago35 sago35 merged commit 46ecb0e into sago35:main Jul 31, 2024
1 check passed
@PercyJW-2 PercyJW-2 deleted the kb-expander branch July 31, 2024 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants