-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add support for getting/setting GPIOs #2
base: master
Are you sure you want to change the base?
Conversation
Hi! Sorry, for some reason GitHub did not notify me about this PR, just saw it. Thanks so much for giving this repo a shot, really excited to have someone using it! |
I'll fix these and add my other improvements to the PR asap... |
Apologies, could we keep this PR for the GPIO changes only, and make the CY7C65215 changes their own PR? I think adding support for that model will be a pretty big job... |
@@ -45,6 +46,7 @@ repository = 'https://github.com/mbed-ce/cy_serial_bridge/' | |||
|
|||
[tool.poetry.scripts] | |||
cy_serial_cli = 'cy_serial_bridge.cli:main' | |||
cy_flash = 'cy_serial_bridge.flash:main' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is pointing to a script that doesn't exist (in this PR at least?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh sorry - it's a utility for flashing NOR flash chips and similar devices that I'm working on. You need something a bit more complicated than the SPI write of the general CLI, and there are many options, so I thought a separate cy_flash cli program is the way to go.
Its a work in progress, the branch for it is here: https://github.com/runger1101001/cy_serial_bridge/tree/cy_flash_utility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I'll make a separate PR when its ready so for now I will back out this change from this PR.
@@ -59,7 +59,7 @@ class CyType(IntEnum): | |||
6 # Used to indicate a device which is in CDC UART mode (which will automatically work using an OS driver) | |||
) | |||
UART_PHDC = 7 # Used to indicate a device which is in PHDC (Personal Healthcare Device Class) UART mode | |||
|
|||
CDC_DATA = 8 # Used to indicate the CDC data interface (which is a separate interface from the CDC UART interface) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Random question, do you have a source for what this interface actually does? I don't actually know, and I think I wasn't able to find out easily back when I was looking into this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I was curious myself... There is a CDC defintion for SPI devices also, maybe its related to that?
I'm happy to split it... its just that I can't test it without the CY7C65215 changes as that's the only device I have to test with.
I hope its ok that it takes me a few days each time to progress... I have a lot going on right now and have to do this on the side... by the way ultimate goals:
|
Splitting it into three PRs like that sounds perfect! |
As long as you tested the GPIO stuff in this form, it's okay if you can't test it by itself |
ok, made this PR a draft for now, so it doesn't accidentally get merged :-)
|
The CY7C652xx also support GPIOs.
The chip is quite flexible, allowing any of the pins not used for other functions to be used as GPIOs. You have to decide at configuration time whether the pin should be input or output, and for output pins you can set what the initial output state is after reset.
Having GPIO control is useful in one of this chips primary use-cases: in system programming. Having GPIO control allows you to trigger reset pins, set mode pins, check "done" pins and similar things that you need when flashing FPGAs and other devices.
This PR adds support for setting the GPIOs programmatically in the python API.
Please let me know if this meets your expectations? I'm not primarily a python programmer, so please be forgiving! 😃
It is the first PR but I hope to send you one or two more: