OLED display with I2C on OpenWrt

I have https://www.ebay.com/itm/0-96-I2C-IIC-SPI-Serial-128X64-White-OLED-LCD-LED-Display-Module-for-Arduino/272758807233?epid=17012975766&hash=item3f81b11ac1:g:IVcAAOSwYLZbakqv

I have checked : https://wiki.openwrt.org/doc/hardware/port.i2c

If I am right, I2C bus will be available under /dev/.

I have a wrtnode standard shield. GPIO1 and 2 should SDA and SDL.
I would like to put some messages on 0.96" oled. I have a proto for that on RPI3, but it uses wireRPI .

Existing C implementations using I2C via GPIO ports.
Could somebody give suggestion how can I use OLED 0.96?

Your first challenge will be getting physical access to the pins. Since you haven't specified your device, it's impossible to say more on that. No pins, all the software in the world isn't going to help you! Depending on your devices, you may need level shifters as well.

Past that, it's your choice of programming languages and libraries. Bit-banging is "always" an option with in-built hardware support potentially being available depending on the SoC in your device.

I have wrtnode1, with standard shield.

Maybe I can use this library or similar:

it is for ESP/Arduino projects, but I think display registers should be the same on all hardware..

The registers within the display are the same regardless of how they are being accessed, yes.

The Arduino world is pretty broken with respect to portability, as well as having some "interesting" interpretations of the flow of a C++ program, and its Hardware Abstraction Layer (HAL). Be prepared to replace all kinds of proprietary calls around the TWI-based I2C implementation, timers, and data structures (Arduino is not a full C++ implementation and some of its classes may be incompatible with a different target). You'll also find Arduino-targeted code incredibly twisted as the ATmega series of devices don't have much SRAM (2k on an ATmega328) or program flash (32k on an ATmega328, 16k on an ATmega168).

A 128x64 bit array is 1k bytes, right there -- so the concept of a "frame buffer" of that size isn't really possible in a typical Arduino device.

ok, than try with ESP8266 variant github.com/squix78/esp8266-oled-ssd1306.git

but it still using"wire"..

Another bit of code to look at for ideas (which also is not GPL-encumbered) would be a couple of SSD1306-related examples in https://github.com/SuperHouse/esp-open-rtos/tree/master/examples

#ifdef I2C_CONNECTION
#define PROTOCOL SSD1306_PROTO_I2C
#define ADDR SSD1306_I2C_ADDR_0
#define I2C_BUS 0
#define SCL_PIN 5
#define SDA_PIN 4

at pin definition what should I define under openwrt?

You'll have to look at the technical specs for your board.

I have Wrtnode1, like this:
http://wiki.wrtnode.cc/index.php?title=GPIO资源/en

i2c should visible under GPIO#1, GPIO#2..

should I use

#define SCL_PIN 2
#define SDA_PIN 1

under openwrt I do not have like include <i2c/i2c.h>

Looks like they already highlighted it for you on that page

Give it a try and put a 'scope on the pins, or try i2cdetect or the like (which may be in the i2c-tools package).

Welcome to porting software from one OS and/or platform to another :wink:

ahh, sound good;)

What do you think about https://github.com/mkschreder/hack-ssd1306-openwrt
Only difference is, he uses i2c-ch341 via USB.

I typically write all my I2C drivers based off the datasheet directly rather than trying to unravel and port somebody else's code (especially as so much of it is GPL-encumbered).

ok thanks, I understood, I will experiment it later.. it is a big bit for me.

doc available and library samples for arduino and rpi...