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

Support for "wide" ports #3

Open
ed-xmos opened this issue Oct 18, 2024 · 1 comment
Open

Support for "wide" ports #3

ed-xmos opened this issue Oct 18, 2024 · 1 comment

Comments

@ed-xmos
Copy link
Collaborator

ed-xmos commented Oct 18, 2024

1b ports are often scarce. It would be nice to support wide ports. I think this can be done using drive high/low if we can turn off the pull resistors. Unfortunately full control of the port is difficult due to some of the SETCs not working but I think there is a way.

The idea is as follows for pot reader:

  • Make wide port input and sample + mask desired pin to get init value
  • Change port to DRIVE_HIGH_WEAK_PULL_DOWN if value is low, or DRIVE_LOW_WEAK_PULL_UP if value is high
  • Output a one or zero (opposite of init value) on the desired pin, all others will be weak pulled and wait to charge
  • Change port to input (all Hi-Z)
  • Wait for desired pin to cross threshold. pinsneq can be used with a port timer but it needs code to mask the value in SW as other pins may change at this time. So we need to repeat this case until we get the transition we want.

We will get a slight loss of accuracy due to having to mask on each pins.

@ed-xmos
Copy link
Collaborator Author

ed-xmos commented Oct 21, 2024

This has been done for potentiometer mode.

Rheostat mode not yet implemented but should be quite straightforward. Suggest we wait for demand for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant