
SSD130X Display Driver

This hardware abstracted driver can be used to interact with an SSD130XSSD130X over (software-)TWI/I2C. The hardware layer is fully abstracted an can be switched between different plattforms. The TWI/I2C library has to impelement the twi.h- or the twi_soft.h-header used in this repository.
File Structure

drivers/
└── display/
├── font/
| ├── font.h
| ├── font.c
| └── fonts/
| └── font_5x7_ascii.c
└── ssd130x/
├── ssd130x.c
├── ssd130x.h
├── frame/
| ├── frame.c
| └── frame.h
└── tty/
├── tty.c
└── tty.h
hal/
├── common/
| ├── defines/
| | └── TWI_defines.h
| └── enums/
| └── TWI_enums.h
└── avr0/
├── twi/
| ├── twi.c
| └── twi.h
└── twi_soft/
├── twi_soft.c
└── twi_soft.h
core_types/
├── gfx/
| └── elements.h
└── numeric/
├── datatypes.c
└── radix.h
utils/
├── macros/
| └── stringify.h
└── systick/
├── systick.c
└── systick.h
The plattform avr0 can completely be exchanged with any other hardware abstraction library. Note that all unused plattfomrs in ./hal folder should be deleted to prevent compliling issues!
Downloads
The library can be downloaded (zip or tar), cloned or used as submodule in a project.
| Type | File | Description |
| Library | zip / tar | SSD130X display library including all required libraries (including hal-avr(0)-twi and hal-avr(0)-twi_soft). |
Using with git clone
mkdir -p ./drivers/display
git clone https://github.com/0x007E/drivers-display-font.git ./drivers/display
mv ./drivers/display/drivers-display-font ./drivers/display/font
mkdir -p ./drivers/display/
git clone https://github.com/0x007E/drivers-display-ssd130x.git ./drivers/display
mv ./drivers/display/drivers-display-ssd130x ./drivers/display/ssd130x
mkdir -p ./core_types/
git clone https://github.com/0x007E/core_types-gfx.git ./core_types
mv ./core_types/core_types-gfx ./core_types/gfx
git clone https://github.com/0x007E/core_types-numeric.git ./core_types
mv ./core_types/core_types-numeric ./core_types/numeric
mkdir -p ./hal/
git clone https://github.com/0x007E/hal-common.git ./hal
mv ./hal/hal-common ./hal/common
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# Hardware abstraction layer of TWI (Must fit the used plattform)
# HARDWARE-TWI
mkdir -p ./hal/avr0/
git clone https://github.com/0x007E/hal-avr0-twi.git ./hal/avr0
mv ./hal/avr0/hal-avr0-twi ./hal/avr0/twi
# SOFTWARE-TWI
mkdir -p ./hal/avr0/
git clone https://github.com/0x007E/hal-avr0-twi_soft.git ./hal/avr0
mv ./hal/avr0/hal-avr0-twi ./hal/avr0/twi_soft
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
mkdir -p ./utils/
git clone https://github.com/0x007E/utils-macros.git ./utils
mv ./utils/utils-macros ./utils/macros
git clone https://github.com/0x007E/utils-systick.git ./utils
mv ./utils/utils-systick ./utils/systick
Using as git submodule
git submodule add https://github.com/0x007E/drivers-display-font.git ./drivers/display/font
git submodule add https://github.com/0x007E/drivers-display-ssd130x.git ./drivers/display/ssd130x
git submodule add https://github.com/0x007E/core_types-gfx.git ./core_types/gfx
git submodule add https://github.com/0x007E/core_types-numeric.git ./core_types/numeric
git submodule add https://github.com/0x007E/hal-common.git ./hal/common
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# Hardware abstraction layer of TWI (Must fit the used plattform)
# HARDWARE-TWI
git submodule add https://github.com/0x007E/hal-avr0-twi.git ./hal/avr0/twi
# SOFTWARE-TWI
git submodule add https://github.com/0x007E/hal-avr0-twi_soft.git ./hal/avr0/twi_soft
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
git submodule add https://github.com/0x007E/utils-macros.git ./utils/macros
git submodule add https://github.com/0x007E/utils-systick.git ./utils/systick
Programming
#include "../lib/drivers/display/ssd130x/ssd130x.h"
#include "../lib/drivers/display/ssd130x/tty/tty.h"
#include "../lib/drivers/display/ssd130x/frame/frame.h"
#include "../lib/utils/systick/systick.h"
ISR(...)
{
}
{
}
{
}
void systick_tick(void)
Increments the SysTick timer tick counter.
Definition systick.c:61
void systick_timer_wait(unsigned int ticks)
Blocks execution for a specified number of SysTick ticks.
Definition systick.c:168
void systick_timer_wait_ms(unsigned int ms)
void systick_timer_wait_us(unsigned int us)
It is possible to work with the basic ssd130x (low-level-driver) functions (for details see ssd130x.h).
int main(void)
{
#ifdef SSD130X_USE_SOFT_TWI
#else
#endif
ssd230x_clear();
}
void ssd130x_init(void)
Initializes the SSD130X display.
Definition ssd130x.c:79
void systick_init(void)
Initializes the SysTick timer module.
Definition systick.c:35
unsigned char twi_init(void)
Initialize the TWI (I2C) hardware interface in master mode.
Definition twi.c:36
unsigned char twi_soft_init(void)
Initialize the software TWI (I2C) bus.
Definition twi_soft.c:32
To use software-TWI, either a global definition of SSD130X_USE_SOFT_TWI or uncommenting SSD130X_USE_SOFT_TWI in ssd130x.h is required!
To handle text and/or graphics a better approach would be tu use the implemented frame/tty (frontend) functions. A how-to-use guide can be found on here.
TTY - Console Mode
printf("Test");
void tty_init(void)
Initializes the TTY text output interface.
Definition tty.c:44
Details on how-to-use/setup the tty-mode can be found here.
FRAME - Drawing Mode
GFX_Position position = { 102, 2 };
void frame_init(void)
Initializes the frame system and SSD130X display.
Definition frame.c:181
void frame_draw_text(const char *text, GFX_Point position)
Renders a text string on the SSD130X display at a specified position.
Definition frame.c:214
Details on how-to-use/setup the frame-mode can be found here.
Additional Information
| Type | Link | Description |
| SSD1306 | pdf | OLED/PLED Segment/Common Driver with Controller |
R. GAECHTER