Pixels
Graphics library for TTF LCD devices.
Pixels is an open source TFT LCD graphics library for Arduino (and easily
portable to other platforms). In addition to usual graphics features, it
implements anti-aliased graphics primitives, supports converted TTF fonts,
and provides an access to hardware scrolling features.
The library structure separates hardware specific layer (LCD controller
driver, communication protocol) and general graphics layer. The separation
simplifies a porting of the library for new devices.
The library is natively supported by
Pixelmeister GUI modeling tool.
Pixelmeister emulates the library API on desktop computers, converts TTF
fonts and images to Pixels-friendly format and exports developed programs
prototypes (sketches) to be compiled for a target device.
Here is a minimalistic Pixels application sample:
#include <Pixels_PPI16.h>
#include <Pixels_Antialiasing.h> // optional
#include <Pixels_HX8352.h>
Pixels pxs;
void setup() {
pxs.init();
pxs.setBackground(0,40,0);
pxs.setColor(0,255,0);
pxs.clear();
pxs.fillRectangle(10,10,100,100);
}
void loop() {
}
The
#include directives specify a communication method and a controller
type. (
Important: communication method .h file should precede
a controller type)
Supported communication types:
Pixels_PPI8.h - parallel interface, 8 bit
-
Pixels_PPI16.h - parallel interface, 16 bit
-
Pixels_SPIhw.h - hardware SPI
-
Pixels_SPIsw.h - software SPI
Currently supported controllers:
HX8340 (ITDB02-2.2SP)
HX8352
ILI9163 (Arduino Robot LCD)
ILI9325 (TFT_PQ 2.4)
ILI9341 (ElecFreaks TFT2.2SP Shield)
ILI9481 (HY-3.2TFT)
S6D0164 (ElecFreaks 2.2 TFT 176*220)
S6D1121 (ElecFreaks 2.4 TFT 240*320)
SSD1289 (TFT_320QVT)
ST7735 (ElecFreaks TFT2.2SP Shield)
Pixels pxs;
declaration takes default settings (display dimensions,
pin mapping) from .h file. The settings can be overridden for a particular
hardware with Pixels constructor parameters pxs(width, height)
as well as
pxs.setPpiPins(rs, wr, cs, rst, rd)
and pxs.setSpiPins(scl, sda, cs,
rst, wr)
API calls.
If you need to add a new controller to the list of supported devices, the
easiest way would be to copy-paste any of the controller .h files (or start with Pixels_TEMPLATE.h), to name it
correspondingly and to adjust few hardware-specific methods in the file.
Text output and
TTF font topics are described by
the link (uText library is a
subset of Pixels, adapted for UTFT).
Hardware scrolling technique documentation is coming soon.
Pixels on GitHub
Pixels library documentation