Close

Graphics Library Tests

A project log for Cruise Control Preset

This project supplements the existing cruise control in a vehicle, allowing you to automatically set the cruise control to a selected speed.

scott-hammerschmidtScott Hammerschmidt 04/10/2015 at 18:380 Comments

Last night and today over lunch I worked on displaying some minimal text with the Adafruit library and also with the u8glib. The u8glib was already setup to use the address of my display, so the issue I had last time was just that my SCL and SDA lines weren't connected properly. The example Hello World program worked fine.
I modified it to display a large 65 as shown in my initial mockup image. The u8glib uses fixed size fonts. The 49 pixel Free Universal font was just a little too big, causing the top parts of the numbers to be in the yellow part of the display when the numbers were as far down as I could put them (which makes sense, since the yellow part of the display is 16 pixels and the blue is 48). Using the 42 pixel Free Universal font, I got this:

Using the Adafruit library and stripping down the example program to just display "65", I got this:

The Adafruit library obviously uses a scaled font.

I like the display from the u8glib much better, but that's to be expected from a fixed size font (well, on devices with these specs). I'll have to see how many font sizes I want to use (maybe I can get by with just the large number font (which just contains numbers, and so it is reasonable in size) and a smaller font for the status text.

Regarding code sizes:

u8glib - ROM: 6810 bytes RAM: 236 bytes

Adafruit - ROM: 10540 bytes RAM: 1526 bytes

The frame buffer for this display is: 128*64/8 bytes = 1024 bytes. So it seems clear that the u8glib buffer is not statically allocated, and the Adafruit one is. It could be that the u8glib buffer is allocated only when it needs it, or perhaps it grabs it and holds onto it. Since I don't need to keep the frame buffer around after it's been sent to the display I'd prefer the former approach since I could use the RAM for other things between screen refreshes. I'll have to look into this more.

But the nicer font as well as the lower potential memory usages make me lean towards using the u8glib. I'll progress with that for now.

Discussions