I finally used ffi with libserialport for doing all the serial configuration and reading from the port: https://gist.github.com/joerg-krause/6d0a8a4949670ee103e6c22006f0cc37.
I guess it is not very luvit idiomatic, but at least it works for me. 2016-09-02 17:30 GMT+02:00 Tim Caswell <[email protected]>: > Are there any small simply primitives that I could bake into luvi that > made this possible with pure lua+ffi? I know I would use serial all the > time if I had the option (for talking to microcontrollers over USB mostly) > > On Fri, Sep 2, 2016 at 1:46 AM, Martin Croome <[email protected]> > wrote: > >> Hi Jorg >> >> We have working serial support, The tack we took is a mixture of Luvit, C >> and FFI. We use FFI for read and write, C for line monitoring threads and >> Luvit (uv.poll for events on the port). >> >> Regards >> >> Martin >> >> >> On Wednesday, May 25, 2016 at 1:15:37 PM UTC+2, Jörg Krause wrote: >>> >>> Hi, >>> >>> I am trying to read data from a serial port using Luvit. My simple >>> example is running, however, I have an issue with fs_read() as it calls the >>> callback function even if no data are received. >>> >>> This is my example: https://gist.github.com/joerg-krause/cba5a56577a048 >>> 3ceb8ea4ecda5ff0ba >>> >>> This is the output: >>> >>> # luvit main.lua >>> '' >>> '' >>> '' >>> '' >>> '' >>> >>> My problem with this issue is that it consumes much more CPU cycles on >>> my embedded Linux system than reading from "/dev/input/event0". >>> >>> Any ideas what's wrong here? >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "luvit" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to a topic in the > Google Groups "luvit" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/luvit/m_bJes9J2p0/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "luvit" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
