[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Raspberry Pi GPIO module for LuaJIT
- From: Craig Barnes <craigbarnes85@...>
- Date: Tue, 1 May 2012 01:25:27 +0100
Hi, thanks for this. I've thrown a copy up on GitHub[1] and intend to
package it for the Fedora 17 (not 14) remix when it's available. I'm
willing to maintain it and package for other distributions if there's
some interest. I don't yet have a Pi to test with, although hopefully
it'll arrive before Fedora 17 does.
[1]: https://github.com/craigbarnes/luajit-rpi-gpio
On 30 April 2012 20:34, Mike Pall <mikelu-1204@mike.de> wrote:
>
> The Raspberry Pi foundation sent me a free RPi. Many thanks to
> Alex Bradbury for arranging this! As expected, LuaJIT runs just
> fine on the little device. :-)
>
> To give something back, I've written a simple GPIO module, which
> allows you to control the GPIO pins from a Lua script. It uses the
> LuaJIT FFI and doesn't need any extra C modules!
>
> Provided you've already compiled LuaJIT for the RPi, here's how to
> install the module:
> mkdir -p /usr/local/share/lua/5.1/rpi
> cp gpio.lua /usr/local/share/lua/5.1/rpi/gpio.lua
>
> The attached sample script testgpio.lua blinks an LED + resistor
> attached to GPIO 0 and reads the input status of GPIO 6.
>
> [Yes, you need to be root to run that, since it works without the
> help of a driver, by writing directly to the device.]
>
> You can read/write the pins with the gpio.pin[] table. These
> correspond to the numbering given on the following drawing of the
> GPIO connector on the RPi: http://elinux.org/File:GPIOs.png
>
> There's also a raw API for accessing all of the GPIO pins on the
> chip. Please read the source for details and do NOT use raw pin
> numbers, unless you know what they do! Don't blame me, if you fry
> your RPi -- you're on your own.
>
> Arguably, the module is quite primitive right now. There's much
> more you can do with the chip. Docs are available from:
> http://elinux.org/RPi_Low-level_peripherals
>
> Since I'm already way too busy, I'd appreciate it if someone would
> step forward and take over development, put it under version
> control, package it up and so on. The current sample module is
> public domain. I guess the Lua community would probably most
> welcome a MIT licensed module. Thank you!
>
> --Mike