With time eLua will support many dozens of boards. Using many IF's to make a
script portable (like in the current led.lua example) does not look very elegant as the number of boards increases. Should the language support port aliases in the GPIOs? For example, on the EK-LM3S6965 port LED_0 could be aliased to PF_0, BTN_0 to PF_1, BTN_1 to PE_0, etc. That could make scripts more portable without the large number of IF statements. LEDs and buttons are two good uses for this but there are probably others. BTW - What is the proper way of checking whether a port exists from a script (e.g. whether PZ_0 is available on a particular build)? Regards, Jesus Alvarez |
On Tue, Feb 17, 2009 at 5:25 PM, Jesus Alvarez <jalvarez at micromint.com>wrote:
> With time eLua will support many dozens of boards. Using many IF's to make > a > script portable (like in the current led.lua example) does not look very > elegant as the number of boards increases. > > Should the language support port aliases in the GPIOs? For example, on the > EK-LM3S6965 port LED_0 could be aliased to PF_0, BTN_0 to PF_1, BTN_1 to > PE_0, etc. That could make scripts more portable without the large number > of > IF statements. LEDs and buttons are two good uses for this but there are > probably others. Isn't romfs/led.lua what you are looking for? > BTW - What is the proper way of checking whether a port exists from a > script > (e.g. whether PZ_0 is available on a particular build)? Just try to do local test = pio.PZ_0, you'll get a "nil". Best, Bogdan -------------- next part -------------- An HTML attachment was scrubbed... URL: https://lists.berlios.de/pipermail/elua-dev/attachments/20090217/a4144adb/attachment.html |
In reply to this post by Jesus Alvarez
On Tue, Feb 17, 2009 at 12:25, Jesus Alvarez <jalvarez at micromint.com> wrote:
> With time eLua will support many dozens of boards. Indeed, we're close to our first dozen now :) > Using many IF's to make a > script portable (like in the current led.lua example) does not look very > elegant as the number of boards increases. I agree but it works well for the simple example and it all depends on what you need to make portable. Good solutions with the native require(module) Lua mechanism can help here and eLua also provides a "system module", with platform-dependent information for this matters. Should the language support port aliases in the GPIOs? For example, on the > EK-LM3S6965 port LED_0 could be aliased to PF_0, BTN_0 to PF_1, BTN_1 to > PE_0, etc. That could make scripts more portable without the large number > of > IF statements. LEDs and buttons are two good uses for this but there are > probably others. This is used on our LM3S.lua require/module example. Similar modules would be available for diferent platforms (actually kits, that have devices like leds, buttons, buzzers, ....), binding them to the actual port/pins used. A simple require(LM3S.lua) in the beginning of the program does the job. BTW - What is the proper way of checking whether a port exists from a script > (e.g. whether PZ_0 is available on a particular build)? If I remember, Bogdan wrote some low-level portexists and pinexists functions. But I can't remember now if they were made available to the upper (Lua) level, I need to check. Within a few days, I'll be offline for a ~week (yeap, the whole country stops for Carnival and I'll hide somewhere on the mountains close to Rio), working mostly on our new doc structure, that will power both the online site and the offline doc included in the distros. I should be able to learn all the functions we have now :) :) Hopefully I'll manage to find a connection in a friend's house to hear you and say hello :) Regards, > Jesus Alvarez Best Dado > > > > _______________________________________________ > Elua-dev mailing list > Elua-dev at lists.berlios.de > https://lists.berlios.de/mailman/listinfo/elua-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: https://lists.berlios.de/pipermail/elua-dev/attachments/20090217/d2aaa89d/attachment.html |
Free forum by Nabble | Edit this page |