GithubHelp home page GithubHelp logo

seungmannlee / omega2-ili9225 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gamer-cndg/omega2-ili9225

0.0 2.0 0.0 620 KB

A library for interacting with a ILI9225 based display using SPI on the Omega2(+).

C 98.69% Makefile 1.31%

omega2-ili9225's Introduction

Onion Omega2 ILI9225 Library

Description

This library enables the Omega2(+) to control a ILI9225 based display via SPI. It contains many graphics-drawing and display-drawing functions. Due to the current state of the OnionIoT provided bit-banged SPI driver (which has multiple issues), drawing is extremely slow (1-2 FPS). Thus, this library is rather suited for displaying simple user interfaces, simple graphics or static pictures.

Hardware Wireup

You will need:

  • an Onion Omega2 or Omega2+, preferably with the extension dock
  • an ILI9225 display (e.g., on ebay)
  • breadboard and wires

You can connect the wires (MOSI, SCLK, CS, RST, RS, LED) to any free GPIO pin you have. This library uses the spio-gpio-driver from OmegaIoT, which is able to bit-bang SPI on any given pin. The other signals RST (reset), RS (also called register select, data/command or D/C) and LED (backlight control) can also be connected to any GPIO. The library takes an initialization object in which you can define which pins to use.

Library Usage

Your first call should be to ILI9225_Init() with a pin configuration object (see example code). You can then use any of the functions to draw text, shapes or pixels into the framebuffer. At last, you have to transfer the local framebuffer to the display by calling ILI9225_CopyFramebuffer().

The following library functions are available:

  • drawing text with different fonts, sizes and colors
  • drawing shapes (lines, circles, triangles) either filled or outlined with a color
  • changing the orientation of the display (portrait / landscape)
  • turning the display on and off (either by LED GPIO pin or SPI commands)
  • modfying the internal framebuffer directly, or drawing from an external frame buffer
  • executing a graphics demo

Compilation

This project was designed for cross-compliation. Compile your toolchain according to https://docs.onion.io/omega2-docs/cross-compiling.html, change the paths in the Makefile (TOOLCHAIN_ROOT_DIR) and do a make all. Optionally, make upload will attempt to use sshpass with scp to transfer the compiled binary to your Omega Onion2 system. Simply change the IP address and the password if you whish to use this feature.

For a successful compilation, you need the omega_includes and omega_libs folder somewhere on your computer. You can download them here). This folder basically includes the libonionspi, liboniondebug and libugpio library and include files. Change the path in the Makefile accordingly.

After executing make all, the library file libili9225.so and a executable file displayTest will be created. If you wish to to use the dynamic library in your own project, you have to:

  1. set the include path to where the ILI9225.h is (-I somedir)
  2. set the library path to where the libili9225.so and the dependency libonionspi.so, liboniondebug.so and libugpio.so is (-L somelibdir)
  3. set the linker flags to link your executable against the prementioned dependencies (-lili9225 -lonionspi -loniondebug -lugpio)

See the Makefile of this project to see how a userspace program may be compiled and linked against this library.

Testing the compiled binaries

  1. Install the SPI library by typing opkg update && opkg install libonionspi. If you already have that library, skip this step.
  2. Transfer the libili9225.so file from this repository to the /usr/lib/ folder on your Omega2, e.g. by using ssh or scp.
  3. Make sure the wiring is that which is described in the main.c.
  4. Transfer the displayTest file (ELF) to some directory on your Omega2, e.g. /root/ and run it!

Credits

hardware setup

omega2-ili9225's People

Contributors

gamer-cndg avatar maxgerhardt avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.