gaemir / u8glib

Automatically exported from code.google.com/p/u8glib
0 stars 0 forks source link

Port U8glib to Raspberry Pi #171

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
GPIO Programming: http://elinux.org/RPi_Low-level_peripherals

There seem to be two options:
Low level gpio programming (mmap/linux)

Other option would be to use this lib:
https://projects.drogon.net/raspberry-pi/wiringpi/

Original issue reported on code.google.com by olikr...@gmail.com on 26 May 2013 at 5:52

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
U8glib runs well on the Raspberry Pi - well, I've only used it on the PCD8544 
but I don't see why any SPI type LCD display wouldn't work equally as well.  I 
ported it over so I could have some easy to use routines for a project that I'm 
working on.

For ease of porting I used wiringPi.  The question is, other people will find 
what I've done useful, but how could it be released?  I could send it on up to 
something like github, but it would be better to work with the find chaps that 
continuously work on U8glib to keep it updated.

Original comment by aaron.j....@googlemail.com on 2 Sep 2013 at 2:21

GoogleCodeExporter commented 9 years ago
maybe you can attach your work to this issue. Once i find time, i can include 
it into the repository.

Original comment by olikr...@gmail.com on 3 Sep 2013 at 11:16

GoogleCodeExporter commented 9 years ago
How would you like it - a patch-set against a known release?

Original comment by aaron.j....@googlemail.com on 3 Sep 2013 at 3:28

GoogleCodeExporter commented 9 years ago
patch set would be ok (against which version?)

Original comment by olikr...@gmail.com on 3 Sep 2013 at 4:40

GoogleCodeExporter commented 9 years ago

I've attached the files, an example file and a picture to show that it works.

Also, the instructions (below) are more detailed than I'm sure you'll need, but 
may help other people with this if they want to do it before you've released it.

You'll obviously need to install wiringPi on your RPi

$ wget https://u8glib.googlecode.com/files/u8glib_arduino_v1.13.zip
$ unzip u8glib_arduino_v1.13.zip
$ cd U8glib
And depending on where your patch is:
$ patch -p1 < ../rpi_u8glib.patch 
$ make

$ g++ U8gLogo.cpp -o U8gLogo -l wiringPi -l U8glib -I include -L .
$ sudo ./U8gLogo

I use this with M2tklib (https://code.google.com/p/m2tklib/ - also ported) to 
have nice menus.

Limitations:
1. It's hard coded to use CS0 for the SPI (as mentioned in U8gLogo.cpp).
2. I've only tested it with the PCD8554 LCD display.
3. There is an include directory with a couple of random header files from the 
Arduino camp which I've put in to make it compile.  I've not bothered to look 
into these more as as it stands the library does all I want it to do.
4. There is a printf tucked away I forgot to remove in a layer I wasn't sure 
what to do with.  

Any questions - please ask!

Original comment by aaron.j....@googlemail.com on 4 Sep 2013 at 8:19

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for providing the patch. 

Original comment by olikr...@gmail.com on 4 Sep 2013 at 8:28

GoogleCodeExporter commented 9 years ago
Has this been added to the main code base yet? Or do I still need to download 
the patch and apply it separately?

Original comment by mecwo...@gmail.com on 3 Dec 2013 at 7:14

GoogleCodeExporter commented 9 years ago
Unfortunately i still do not own a Raspberry Pi. So testing is not possible for 
me.

Original comment by olikr...@gmail.com on 3 Dec 2013 at 7:37

GoogleCodeExporter commented 9 years ago
olikr...: I'd like to buy you a Raspberry Pi so you can add official support 
for it :) Where do you live?

Original comment by gez...@gmail.com on 5 Dec 2013 at 3:05

GoogleCodeExporter commented 9 years ago
It is not only that i do not own a Pi, but currently i do not have time to add 
support for a complete new system. Additionally my hope is, that the new "arm" 
release of u8glib can be ported easily to the Raspberry Pi.
Still you are free to contact me through e-mail (see source code)

Original comment by olikr...@gmail.com on 5 Dec 2013 at 6:55

GoogleCodeExporter commented 9 years ago
still pending...

Original comment by olikr...@gmail.com on 22 Jan 2014 at 7:08

GoogleCodeExporter commented 9 years ago
Hi I have a ST7920 12864 lcd, i followed your steps above but changed the 
constructor call in the .cpp from 

//U8GLIB_PCD8544 u8g(10, 3, 11);        // SPI Com: CS = 10, A0 = 3, Reset = 11

to 

U8GLIB_ST7920_128X64_1X u8g(13, 11, 10);    // SPI Com: SCK = en = 18, MOSI = rw = 
16, CS = di = 17

Unfortunately running the program does not display anything. Any comments?

Original comment by larry1c...@gmail.com on 3 May 2014 at 5:37

GoogleCodeExporter commented 9 years ago
from my side, i did not yet worked on the pi, so i also do not know how to 
support here.

Original comment by olikr...@gmail.com on 3 May 2014 at 8:54

GoogleCodeExporter commented 9 years ago
hi, i am new to this and expirimenting with a OLED and Pi. I bought the 4-pin 
model. i am curious if it is possible to attach it direct to the Pi using 
u8glib ? Problem with this display is that i cannot get it to live, don't even 
know if it's broken, is there some method to test ?

Original comment by richardt...@gmail.com on 30 Aug 2014 at 10:43

Attachments:

GoogleCodeExporter commented 9 years ago
There is still no official support for the Pi. In fact, i do not own this 
hardware.

Original comment by olikr...@gmail.com on 3 Sep 2014 at 7:31

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
@richardtepas: I am sorry for deleting your last comment. I can not validate 
the link and also the answer is very specific to one display type. Probably it 
is better to place the link on an Ras-Pi forum.

Original comment by olikr...@gmail.com on 7 Sep 2014 at 1:00

GoogleCodeExporter commented 9 years ago
@richardtepas:  It IS possible to get the 4-pin I2C OLED module to work with 
the Pi.  I had to do some additions and modifications but got it working.  I'll 
see what I can do to create a patch file(s) 

Original comment by vern...@gmail.com on 30 Sep 2014 at 4:18

Attachments:

GoogleCodeExporter commented 9 years ago
that would be great! cannot see it exactly on the photo. how did you wire it up 
?
thanks a lot !

Original comment by camera7...@gmail.com on 1 Oct 2014 at 7:25

GoogleCodeExporter commented 9 years ago
这个可以驱动ks108吗?

Original comment by yangkk...@gmail.com on 1 Oct 2014 at 9:37

GoogleCodeExporter commented 9 years ago
unfortunately my chinese is not as good as at was these days..............

Original comment by camera7...@gmail.com on 2 Oct 2014 at 4:21

GoogleCodeExporter commented 9 years ago
In that photo I had used external pull-ups.  But they aren't needed if you use 
the internal pull-ups for the RPi.  Since that photo I've wired it up directly 
using the following pins:

I2C Display   Raspberry Pi
--------------------------
VCC           1 
GND           9
SDA           3 (wiringPi Pin 8)
SCL           5 (wiringPi Pin 9)

Need to get a diff from the standard 1.16 so I can upload a patch.  

Original comment by vern...@gmail.com on 7 Oct 2014 at 3:41

GoogleCodeExporter commented 9 years ago
So even though I'm using U8glib on an ARM (Raspberry Pi), I've opted to use the 
"Arduino" libraries because I'm using C++ and was use to using U8glib with AVR.

Make sure you've got wiringPi 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

To compile the logo:
$ cd examples/U8gLogo
$ make                   // Edit Makefile for U8glib/include directory.  I 
uncompressed U8glib 1.16 in /opt/U8glib
$ ./logo

Original comment by vern...@gmail.com on 7 Oct 2014 at 4:10

Attachments:

GoogleCodeExporter commented 9 years ago
nice patch. I try to add this to the repository.

Original comment by olikr...@gmail.com on 7 Oct 2014 at 5:07

GoogleCodeExporter commented 9 years ago
U8G_I2C_OPT_NO_ACK is not supported for the i2c port, right?

Original comment by olikr...@gmail.com on 7 Oct 2014 at 5:17

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
ToDo (u8glib project)
- checkin patched files
- test ssd1306 (modified, but not clear what has changed)
- create release folder for raspberry pi, create release construction script
- create install instructions, is WiringPi required? Check copyright issues.
- update device wiki page, support only for spi and i2c with ssd130x
- create bintry folder, check for suitable icon (copyright?) 
http://www.raspberrypi.org/trademark-rules/

Original comment by olikr...@gmail.com on 7 Oct 2014 at 6:06

GoogleCodeExporter commented 9 years ago
U8G_I2C_OPT_NO_ACK should be supported.  Actually though it didn't seem to make 
any difference with mine.  Perhaps because it was ignored?  But I did have to 
modify the include files so I could initialize with U8G_I2C_OPT_NO_ACK.

I'm glad it was helpful.  It seems as if there are quite a few of these OLED 
displays out in the wild now.  Thanks so much for making this wonderful library!

Original comment by vern...@gmail.com on 7 Oct 2014 at 1:33

GoogleCodeExporter commented 9 years ago
The modifications I made to the ssd1306 file were in the initialization 
strings.  Quite minor in changes, but wouldn't work until I found the right 
init string.

Original comment by vern...@gmail.com on 7 Oct 2014 at 1:36

GoogleCodeExporter commented 9 years ago
i guess i need to check whether the modification to the init strings will still 
work with my displays.

Original comment by olikr...@gmail.com on 7 Oct 2014 at 6:05

GoogleCodeExporter commented 9 years ago
The change happend to U8glib.h is not clear to me. The virtual function has 
changed from 0022 to 1.0. Is there an issue with wiringPi?

Original comment by olikr...@gmail.com on 7 Oct 2014 at 6:11

GoogleCodeExporter commented 9 years ago
hmm.. some files are distributed under LGPL, which is not as flexible as BSD 
license. This needs to be documented.
All in all, this is the new todo list for this project:

ToDo (u8glib project)
- checkin patched files, except for the c++ classes (because they will not be 
backward compatible)
- C++ files need to be analysed together with wiringPi. Maybe ADURINO define is 
not correct or some extra #ifdef is required inside U8glib.h
- test ssd1306 (init sequence modified, must be checked against the existing 
hardware)
- create release folder for raspberry pi, create release construction script
- create install instructions, WiringPi probably required. 
- Extend copyright documentation: Some files are under LGPL
- update device wiki page, support only for spi and i2c with ssd130x
- create bintry folder, check for suitable icon (copyright?) 
http://www.raspberrypi.org/trademark-rules/
- analyse U8G_I2C_OPT_NO_ACK topic. I still think it is not supported (actually 
it is violation of the I2C specification)

Original comment by olikr...@gmail.com on 7 Oct 2014 at 6:21

GoogleCodeExporter commented 9 years ago
Yeah, actually I don't think I did this correctly. Instead of
modifying u8g_dev_ssd1306_128x64_adafruit3_init_seq, I should have created
something like u8g_dev_ssd1306_128x64_adafruit4_init_seq and then used a
#ifdef for raspberry pi and set it to the adafruit4 init sequence.

Thoughts?

Original comment by vern...@gmail.com on 7 Oct 2014 at 7:08