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

sysfsGpio - Open Drain en Tri State API have not been implemented #16

Open
annaertd opened this issue Aug 11, 2017 · 1 comment
Open

Comments

@annaertd
Copy link

I created a sample application for the WP8548 on my mangOH green rev 8 board which controls some LEDs via een external pullup resistor. For electronic safety reasons I prefer to use external pullup resistors with my output pins iso internal pullups.
Then I need to control the outputs with open drain functionality.
During build time everything ran smoothly, but, at runtime I discovered that the API functions below have not been implemented.

What is the reason behind this?
Is it possible to add this functionality?

gpioSysfs_SetOpenDrain
gpioSysfs_SetTriState
gpioSysfs_SetHighZ
@CoRfr
Copy link
Contributor

CoRfr commented Sep 22, 2017

Hi @annaertd,

I think they have not been implemented because the chip on WP85 doesn't support them. So the APIs are present to be future proof but in the meantime :/
I would think you can emulate this as explained on the Linux doc: http://elixir.free-electrons.com/linux/v3.3/source/Documentation/gpio.txt

Some GPIO controllers directly support open drain outputs; many don't. When
you need open drain signaling but your hardware doesn't directly support it,
there's a common idiom you can use to emulate it with any GPIO pin that can
be used as either an input or an output:

LOW: gpio_direction_output(gpio, 0) ... this drives the signal
and overrides the pullup.

HIGH: gpio_direction_input(gpio) ... this turns off the output,
so the pullup (or some other device) controls the signal.

So if you use _SetInput it seems you can workaround that.

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

2 participants