Giter VIP home page Giter VIP logo

stft's Introduction

STFT

Fast Arduino library for SPI displays Ili9341 and ST7735

Features

  • Low code usage (configurable in config.h to remove unneeded code parts)
    • Minimum sketch size for Ili9341: 2100 bytes
    • Minimum sketch size for ST7735: 2124 bytes
  • Low memory usage
  • hand optimized SPI code for maximum speed
  • Fonts:
    • Font compression to save flash space (4bit packed and RLE encoding)
    • 0, 90, 180, 270 degree rotating (only 0 and 180 bit for RLE fonts)
    • antialiased fonts
    • auto cropping and expanding
    • align left and right or center
  • Ability to drive multiple displays (same type and different types): each additional display only uses one extra pin
  • example sketches to show performance and features
  • hardware scrolling window support for Ili9341

Compatibility

  • Has been tested with ATMega328P @ 16 MHz
  • If the chip is running at a different frequency, disable FASTSPI

Configuration

Wiring of Ili9341 display

Display         Arduino
==================================================================================================
SDO/MISO        12 - fixed
LED             +3.3V or PWM (Attention! Needs more than the max 40mA an Arduino pin can deliver!)
SCK             13 - fixed
SDI/MOSI        11 - fixed
D/C             9 - fourth parameter
RESET           2 - third parameter
CS              10 - second parameter
GND             GND
VCC             +3.3V

Wiring of ST7735 display

Display         Arduino
=====================================
GND             GND
VCC             +3.3V
RESET           2 - third parameter
AO              9 - fourth parameter
SDA             11 - fixed
SCK             13 - fixed
CS              10 - second parameter
LED+            +3.3V or PWM
LED-            GND

Configuration in config.h

#define FASTSPI

Pro:

  • Fast

Contra:

  • Uses a little bit more code space (can be as high as 1kb in big projects)
  • Only works with 16MHz clock
  • Only tested on ATMega328p
#define MODEL_ST7735
#define MODEL_ILI9341

Comment out all models you don't use

#define TEXT_ROTATE_0
#define TEXT_ROTATE_90
#define TEXT_ROTATE_180
#define TEXT_ROTATE_270
#define TEXT_ROTATE_0_RLE
#define TEXT_ROTATE_180_RLE

Comment out all rotations you don't need

Font handling

Fonts are generated with generateFont.py (needs cairo and pango for Python).

Usage:

generateFont.py [-h] [-s SIZE] [-a {packed4,rle,unpacked}]
                [-f FIRSTCHAR] [-l LASTCHAR] [-e EXTRACHARS]
                fontname

Example:

python generateFont.py arlrdbd.ttf -s 12 -a packed4 -e äöüÄÖÜß > font1.h

Will generate a font1.h file with a 12 point font and chars 33-127 and extra chars äöüÄÖÜß (these will be mapped 128..134)

Packed4 fonts

Two pixels are compressed into one byte, usually the best compression for smaller fonts (up to 16-18 points size).

Rotation can be performed 0, 90, 180, 270 degrees

RLE packed fonts

A simple RLE compression is applied. Fonts need to be bigger (18-... points) to be effective

Rotation can only be performed 0 and 180 degrees

Unpacked fonts

These can be generated, but the library cannot use them.

stft's People

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.