vsergeev / lua-periphery

A Lua library for peripheral I/O (GPIO, LED, PWM, SPI, I2C, MMIO, Serial) in Linux.
MIT License
182 stars 38 forks source link

Support for internal pull down resistors #21

Closed Henkoglobin closed 4 years ago

Henkoglobin commented 4 years ago

The Raspberry Pi has internal Pull Down resistors that can optionally be enabled (This article demonstrates how to do that in Python).

I have not found any option to do this with lua-periphery... Is this an oversight in the library or am I missing something? Should it be implemented? Or is it just not documented?

Thanks in advance for any insights!

1linux commented 4 years ago

Maybe this is for you:

https://github.com/1inux/lua-gpio-bcm2708

Am 15.12.2019 um 00:49 schrieb Henrik Ilgen notifications@github.com:

The Raspberry Pi has internal Pull Down resistors that can optionally be enabled (This article demonstrates how to do that in Python).

I have not found any option to do this with lua-periphery... Is this an oversight in the library or am I missing something? Should it be implemented? Or is it just not documented?

Thanks in advance for any insights!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Henkoglobin commented 4 years ago

Thanks, this seems very useful. I haven't tried it yet, but I will shortly after christmas.

However, I feel like this should be native functionality of lua-periphery, shouldn't it? Is there a reason why it's not supported out-of-the-box?

vsergeev commented 4 years ago

@Henkoglobin I'll look into this for the periphery series.

vsergeev commented 4 years ago

Unfortunately, this configuration is specific to Broadcom's GPIO controller and not exposed in the Linux userspace API for GPIOs, so it's a bit out of scope of the project. I would recommend just setting the pull ups/downs through the device tree overlay if your configuration is static, or using a wrapper library as @1linux suggested.

Henkoglobin commented 4 years ago

@vsergeev I see, thank you for looking into it!