Buttons, display and UI system architecture


#1

Hi, uLisp is amazing project. I would need some help with regards of structuring my project.

I am developing currently an small system with 20x4 LCD display on 6 IO lines, SD card, 4 buttons on IO lines and some IO expanders on I2c. Its based on ATMega1284P. Currently it is just bunch of experiments of certain subsystems written in Arduino C++, I would like a more systemic approach.

The end goal is a basic UI with a menu and on-screen options selectable by 4 way buttons (up down ok back). The minimum system would be to load all files from sd card, show them as as a scrollable list on screen, and then ability to select them and run them. The files would be settings for IO expenders. (I was considering cusom binary format, but with uLisp they could be just sexps and that is pretty amazing to me)

Complete system would have more navigable pages. Like settings page etc. But it’s not a priorty now.

Should I extend ulisp with more functions so the ‘drivers’ for lcd and i2c IO expanders are written in C, and only accesed in high level with ulisp, or would it be advisable to develop entire system in uLisp? In high level i think of (pos-cursor x y), (write-string x) on LCD, and some read and write functions for IO expanders.

Also currently I have PCINTs setup on buttons that generate events that get put into a event buffer and my ui_function consumes them. Since uLisp has no support for PCINTs, I presume I would have to integrate my events as a stream. How would one go about that?

What I can give back is that basic (with-sd-card) reading and writing files works on 1284p so you can update the website. (But I tested this very sparingly).

Thank you very much for your help


#2

My instinct would be to try uLisp first, and rewrite in C if that doesn’t give the performance you need.

I’m not sure you need to use streams; presumably the interrupt routines themselves just place stuff in the buffer and you could make a function to read from it accessible from uLisp-land and call that in the uLisp main loop. Wouldn’t that suffice?


#3

I agree with @odin. There’s an LCD example here you could use as a starting point: LCD character display.