T-Deck, esp32-s3 lisp machine


#1

I recently picked up a Lilygo T-Deck (https://www.lilygo.cc/products/t-deck) to play around with it’s LoRa capabilities. I’m already getting tired of programming in C++ and looking to get uLisp up and running on it.

It looks like it could be a pretty capable lisp machine: keyboard, touch display, LoRa, battery management, SD card reader, microphone, speaker, wifi, bluetooth, etc.

Is there a good example doc of using an existing graphics module and keyboard with the uLisp repl, instead of the serial connection? Also, is it possible to integrate uLisp with more than one core of the esp32, using RTOS tasks?

Thanks.


#2

I’ve actually bought one of these too, with the same idea in mind. I’ve checked that uLisp runs on it, but I haven’t got around to interfacing the keyboard and display yet.

As a first step it should just be a matter of redefining the routines gserial() and pserial() in the uLisp source to read characters from the keyboard and print characters to the screen.

As a next step you might want to implement a line editor, which buffers characters until you press return, so you can use the delete key to delete characters you’ve mistyped. This could also implement parenthesis matching. For an example of how to do this have a look at the source of my Lisp Badge; see Lisp Badge on GitHub.


#3

I’ve also bought one with the idea to put ulisp on it. Right now, I am busy with other projects so if you have a solution up and running, that would be great to know.
Thanks
Hans-Günther


#4

How long it takes will depend on how well documented the keyboard and display interfaces are!


#5

There appears to be good documentation of the schematics and some example code for interfacing with the keyboard, graphics, etc at:


#6

Excellent, thanks!


#7

I too got a t-deck and have been playing with running ulisp on it. I got the screen working and was contemplating how to do the keyboard interface. Here are my efforts so far https://github.com/hasn0life/t-deck-ulisp/tree/main


#8

I have edited gserial and pserial as you suggested and now one can type and print to the screen and do some editing. No scrolling or parenthesis matching yet. I’m wondering if it would be a good idea to implement the text buffer as a lisp data structure/string instead of the current c array buffer since that might enable text editing for bigger programs in the future?


#9

Great! I’ll have a look at your code.

I’ve also been working on the T-Deck, and I’ve got the GFX graphics working. However, I’m not sure what to do about scrolling. The ST7789 supports hardware scrolling, but unfortunately only in the horizontal direction the way the T-Deck display is mounted, so I think it will have to be done in software. However, I predict that scrolling the entire screen will be really slow: ie a few seconds. Any suggestions?


#10

I’ve now tested your code and it works great. I based my version on the Adafruit GFX library, which takes about 3 secs to clear the screen, but your version based on the Arduino GFX library does this in 35 msec! I don’t know how the author of that library has achieved it. Also, writing text to the screen is nearly 100 times faster in your version using the Arduino GFX library.

I have a couple of comments on your version:

  • I had to change Compiler warnings from All to Default in the Arduino preferences to get it to compile, in case anyone else has this problem.
  • My version had white text on a black background which I find more readable, but I know opinion varies on this, so perhaps it should be a #define at the start of the source.
  • I suggest making the leading 10 rather than 9 as in your version, as then an exact number of lines fit on the screen, and it’s slightly more readable with a bit more space.

I’d like to switch to basing my work on your version if that’s OK. I’ll implement paragraph matching, initially using the same C array buffer, since that will be easier. I’m still thinking about how to implement scrolling. The Arduino GFX library doesn’t seem to implement reading from the screen, which would be one way of doing it.


#11

Yep, feel free to use whatever I did! I was just going with the most expedient route as this was my first time using ulisp. Its possible that someone could get the adafruit library running fast but I already knew the other one already worked from the example code that came with the t-deck.

I am personally trying to imagine the scaffolding needed for a more full featured text editor, so I’d want it to be possible to scroll back far and edit within the expression. I found the PotatoP recently https://github.com/andreer/PotatoP/tree/main/potatop and I was gonna study that to see if I can reuse his text editor and other infrastructure, it looks really good. That might be too much tho, I’ll see.

Edit: Also I made the changes you suggested tho I didn’t have any compiler warning issues, maybe my (or your) libraries or IDE aren’t updated?


#12

I’ve now released a first version of uLisp for the T-Deck. See:

Making a LilyGO T-Deck uLisp Machine


#13

If my editor code can be useful to you that would be great! The display resolution is the same so hopefully it should just work, but you would have to redo the way keyboard input is read. Happy to answer any questions.


#14

Wow, amazing.

As an emacs fan, I was wondering if anything from imacs (emacs for the esp) could be of use: https://github.com/yesco/imacs.git