olikraus / u8glib

Arduino Monochrom Graphics Library for LCDs and OLEDs
https://github.com/olikraus/u8glib/wiki
Other
1.25k stars 314 forks source link

Using twoST7920 displays on one Arduino using SPI #491

Closed dgoadby closed 5 years ago

dgoadby commented 5 years ago

I am using an ST7920 display in SPI mode with an Arduino UNO. It works well. But I really need two displays in my project. I could use two Arduinos but the data changes very slowly so one Arduino would easily do the job.

My first idea is to create two UG8 objects and then a select line for each display with two display loops. Is that possible or is the memory going to be a constraint?

My second idea is to use only one UG8 object and make the display selection outside of the display loop. Clearly the draw() code would be different for each display. As the screen is redrawn each time then it seems a plausible idea.

Any comments?

olikraus commented 5 years ago

Both ideas should work. The u8g2 FAQ also includes some hints.

dgoadby commented 5 years ago

Thanks. I will probably try the second option first as the memory constraints are less. With an STM Blue Pill the first option would probably work ok. I will feedback my results.