Library for "text only" Arduboy sketches?

I’ve mapped out a couple of ideas for Arduboy programs that would require only text on screen - no graphics or line drawing of any kind.

Right now, the buffering area uses a large chunk of RAM because it is a graphic map, and it needs to allow for any changes at all. It uses 1K of RAM.

If there is only text on the screen, the buffer could just be the text representation, and the update to the screen would draw each character from the font during the update. The buffer could be trimmed down to only about 168 bytes of RAM.

Of course, this is a significant change in how the library operates. I am considering attempting this library surgery myself, but figured it was wise to at least check if anyone else has taken a crack at this already.

Anyone have knowledge of such?

I would start with having my Arduboy2 library installed in the IDE. You could then create your own library using Arduboy2’s ArduobyCore class as a base:

#include <Arduboy2Core.h>

class ArduboyTextOnly : public Arduboy2Core

If you want your library to have the capabilities of the standard Arduino print functions, you could include Print and provide a write() function.

class ArduboyTextOnly : pubic Print, public Arduboy2Core

By basing on Arduboy2Core you won’t include the screen buffer. The screen buffer is defined in the Arduboy2Base class, which you aren’t using.

You can then init the display by calling boot().

Your class would provide the text buffer and the function(s) required to render its contents to the display. You wouldn’t use paintScreen() because it requires a pointer to a 1024 byte graphic buffer.

You have to write data to the display in bytes, each of which represents a vertical column of 8 pixels. For this you could use paint8Pixels(). If you always write an entire screen of 1024 bytes, that’s probably all you need.

If you want to get fancy and write only partial areas of the screen, you could use LCDCommandMode(), LCDDataMode() and sendLCDCommand(). Or for more efficiency you could go lower and use SPI functions directly, similar to the RAM version of paintScreen(), or even directly control of the SPI controller, like the PROGMEM version of paintScreen().

You may wish look at drawChar(), and other functions in the Arduboy2 class, as templates for the function(s) in your library.

Documentation for controlling the display is here:

Yep, exactly… this is exactly what paint8Pixels exists in the core library… to allow to defining your own buffer modes that are entirely abstracted. You only need a function capable of pragmatically generating the screen 8 pixels at a time and calling paint8Pixels accordingly… pretty simple if you’re looping over a character buffer and then finding character sprites and looping over those to find the pixels to paint to render individual characters.

Such a class (simple 16x8 character buffer) would make a nice addition to the base library. Though honestly it’s not really necessary unless you REALLY need that 1k display buffer RAM for some other use.

I’ve considering a nicer option with per-pixel scrolling of text for scrolling long buffers… that would get a little more complex but not terribly so.