|
these little oled display have a two-wire (SDA-SCL) interface (pa11 and pa12 on orange pi PC)
I used the loboris kernel which has I2C support compiled into it (no need to adapt script.bin)
I came across this link - it is the u8-library for the arduino, which can be patched for the raspberry pi.
I works out of the box for the orange pi PC (install the wiringOP library)
I modified the example (logo) so it can display text and does not stay in a loop.
https://code.google.com/p/u8glib/issues/detail?id=171
Make sure you've got wiringPi (wiringOP) installed.
$ wget http://dl.bintray.com/olikraus/u8glib/u8glib_arduino_v1.16.zip
$ unzip u8glib_arduino_v1.16.zip
$ cd U8glib
$ patch -p1 < /tmp/u8glib_1.16.RaspberryPi.patch
$ make
I installed the library
$ cp libU8glib.a /usr/lib
$ cp U8blib.h /usr/include
I used this setting in my example program - which can be adapted to other displays
-> U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);
I could not attach my zip, so here's my example program and Makefile:
int main(void) {
char apa[10]="Orange ";
char apb[10]="Pi PC ";
printf("begin console\r\n");
u8g.setFont(u8g_font_gdr25r);
//u8g.setFont(u8g_font_6x13);
// while(true) {
u8g.firstPage();
do {
// draw();
u8g.setColorIndex(1);
u8g.drawStr(1, 25, apa);
u8g.drawStr(1, 64, apb);
} while( u8g.nextPage() );
// usleep(10*1000);
// }
return 0;
}
--Makefile---
PROGRAMS = console
SOURCES = ${PROGRAMS:=.cpp}
CC=g++
INCLUDE=/opt/include
LIBRARY=/usr/lib
LIBS=-lwiringPi -lU8glib
PREPROCESSOR=-DU8G_RASPBERRY_PI
CCFLAGS=-Ofast -mfpu=vfp
all: ${PROGRAMS}
${PROGRAMS}: ${SOURCES}
${CC} ${PREPROCESSOR} ${CCFLAGS} -Wall -I${INCLUDE} -L${LIBRARY} $@.cpp -o $@ ${LIBS}
clean:
rm $(PROGRAMS)
|
|