1.3inch OLED HAT User Manual
Version: V1.0 Oct. 16 2017 3
CLK (1) is connected to SCL of Raspberry Pi; Using I2C interface: The level of DC controls the
address of slave. Here it is connected to the ground, thus 7-bits of I2C address is: 0x3C.
DEMO CODE
We provide BCM2835, WiringPi and python programs for this module. They has commonly used
display functions: drawing dot, line, rectangle, circle, setting sizes and line width; filling arias, and
displaying English characters of 5 common fonts and other display’s functions.
Following instructions are offered for you convenience
1. Initialize SPI function of the Raspberry Pi
sudo raspi-config
Select: Advanced Options -> SPI -> yes
Activate SPI hardware driver
2. Installation of function libraries
Before installation of Raspberry Pi libraries please read it carefully:
https://www.waveshare.com/wiki/Libraries_Installation_for_RPi
It is detailed description of WiringPi, bcm2835 and python installation.
3. Usage
BCM2835 and WiringPi program should be only copied into directory of Raspberry Pi ()by
samba or directly copy to the SD card). The following code are compied directly to the user
directory of Pi.
3.1 Usage of BCM2835
Run ls command as you can see below:
bin: contains “.o” files. We don’t need to change it generally
Fonts: contains 5 commonly used fonts
Pic: contains pictures used for displaying. The resolution of pictures must be 128x128,
otherwise they cannot be displayed properly. And the format of pictures must be BMP.
Obj: contains object files, like main.c, OLED_Driver.c, DEV_Config.c, OLED_GUI.c and their
header files.
main.c:
The mian function. What need to note is that even though there are
OLED_ScanDir used to control the direction of scanning, you need not to change it. Because
this module is designed for Raspberry Pi, and for compatibility, we don’t recommend you to
change it.
DEV_Config.c:
definitions of Raspberry Pi’s pins and modes; according to foregoing
hardware configuration the changing of communication mode needs only “.h” file
modification in macro-definitions USE_SPI and USE_IIC;