You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Michal Lenc <mi...@seznam.cz> on 2024/03/15 16:20:26 UTC

Access GPIO pins over Lua

Hello,

has anyone tried accessing GPIO pins over Lua? I have tried LED example
presented at NuttX workshop a year or two ago and userled driver is
working fine, but using the same code on GPIO registered pin fails
(assert on open). I suppose io.open is implemented only for userleds and
does not work for GPIO? Thanks.

Best regards,

Michal Lenc


Re: Access GPIO pins over Lua

Posted by Jernej Turnsek <je...@gmail.com>.
Hi,
with Luajit, one could use FFI to access NuttX GPIO functions directly. But
I am afraid that Luajit is currently available only for CM7.

On the other hand, one can write standard Lua extension in C and use it
with plain Lua to access GPIOs. There are numerous examples of how to do it
on internet.

Regards,
Jernej

On Fri, Mar 15, 2024 at 5:20 PM Michal Lenc <mi...@seznam.cz> wrote:

> Hello,
>
> has anyone tried accessing GPIO pins over Lua? I have tried LED example
> presented at NuttX workshop a year or two ago and userled driver is
> working fine, but using the same code on GPIO registered pin fails
> (assert on open). I suppose io.open is implemented only for userleds and
> does not work for GPIO? Thanks.
>
> Best regards,
>
> Michal Lenc
>
>