U8glib: Graphics Lib for LCDs and OLEDs

Hallo Oliver,

Thanks a lot for U8glib, it's great when RAM is limited. Thanks to that, I've been able to use an ATtiny85 w/ Arduino core to control an OLED display.

FYI, I had to remove all *_hw_spi.c files from the library because some symbols were undefined at compile time (for instance SPDR). It seems logical because ATtiny85s don't have any direct hardware API support. Do you believe there is a way to exclude those files automatically? Maybe with the right #ifdef...

If that can help anyone else, here's what I had to do to get everything working (in addition to configuring an Arduino as ATtiny programmer):

  • set the ATtiny internal clock to 8 MHz
  • (OS X) install the latest CrossPack-AVR and replace /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/bin/ld with /usr/local/CrossPack-AVR/avr/bin/ld (solves code relocation issues at the link stage)
  • remove all U8glib/utility/*_hw_spi.c files
  • use a small font because the 8 kB flash is easily exhausted
  • of course, use the lib constructor for software SPI

The next thing I would like to do is to use the USI provided by the ATtiny in order to implement hardware SPI, with the hope that it will both improve performance and reduce program size (currently, just creating the library instance takes 4 kB). I saw that there is some ATtiny support in the library, though not in Arduino context. Does it use USI or just software SPI? If hardware SPI is implemented, can you give me a few hints that would help me make the port from AVR to Arduino? I can then submit a patch.

Thanks again for your lib.