Hello
I have played a little bit with my RPi once but i used C library using FFI (because i couldn't find decent Lua library, iirc)
local alien = require 'alien'
local pigpio = alien.load 'pigpio'
and then like:
local gpioRead = pigpio.gpioRead
gpioRead:types{"uint", ret ="int"}
-- ....
-- skip
-- ....
local function piSclkTick()
gpioWrite(SCLK, HIGH)
gpioDelay(SPI_SCLK_HIGH_TIME)
local read_bit = gpioRead(MOSI)
gpioWrite(SCLK, LOW)
gpioDelay(SPI_SCLK_LOW_TIME)
return read_bit
end
etc etc
just read about how to usa FFI with Lua, and docs on pigpio library
Sincerely,
Volodymyr