Writing “nano-curses” for microcontrollers2010/05/24
My main contract these days is developing into a software stack that needs to both send a lot of debugging and status data, and receive commands over the serial debug port (which in the next generation will be Bluetooth…). The problem is, I need to be able to deal with this in the main codebase in a relatively sane manner. That means using xterm command sequences, but hiding them behind some kind of API. The obvious candidate would be curses, of course.
So, I’m developing a microcontroller version of curses, that’s intended to be as lightweight as possible given the complexity of the problem. The first major cost is the terminal buffer, which has to be at least a byte for every character on the screen. I might experiment later with a non-buffered curses, especially as this is not intended to run over “slow” connections in the first place (at least for my application). The real challenge is going to be figuring out things like subwindow scrolling rules, and all the quirks like keeping track of the cursor when a tab is inserted, etc.
I plan on releasing this code as open-source once it’s reasonably usable, and I have somewhere on my as-yet-nonexistant website to put it…