GithubHelp home page GithubHelp logo

chrisdepas / st7735r Goto Github PK

View Code? Open in Web Editor NEW

This project forked from juj/st7735r

0.0 1.0 0.0 2.18 MB

A fast low level Arduino Uno compatible graphics library for the 160x128 pixel 16-bit color TFT LCD display that uses the ST7735R chip.

C 100.00%

st7735r's Introduction

Fork of https://github.com/juj/ST7735R

Changes Overview

  • Shortened function names
  • Allow defining pins etc from arduino, before #include
  • Consolidated into single file
  • Removed SDCard stuff
  • Added Display_Clear(r, g, b) (Sets the entire screen to a single color)
  • Added ST7735R_MIN_X, ST7735R_MIN_Y, ST7735R_MAX_X, ST7735R_MAX_Y (Helper definitions for valid x,y ranges)

Name Changes

Old New
(None) DisplayClear
ST7735R_BEGIN_TRANSACTION DisplayBeginTransaction
ST7735R_END_TRANSACTION DisplayEndTransaction
ST7735R_SendCommandList DisplaySendCommandList
ST7735R_Begin DisplayBegin
ST7735R_Line DisplayLine
ST7735R_DrawMonoSprite DisplayDrawMonoSprite
ST7735R_SendCommandList DisplaySendCommandList
ST7735R_BeginRect DisplayBeginRect
ST7735R_PushPixel DisplayPushPixel
ST7735R_EndDraw DisplayEndDraw
ST7735R_BeginPixels DisplayBeginPixels
ST7735R_Pixel DisplayPixel
ST7735R_PushPixel_U16 DisplayPushPixel_U16
ST7735R_FillRect DisplayFillRect
ST7735R_Circle DisplayCircle
ST7735R_DrawText DisplayDrawText
ST7735R_FilledCircle DisplayFilledCircle
ST7735R_DrawMonoSprite DisplayDrawMonoSprite
SDCard_GetFileStartingBlock Removed
ST7735R_Draw565 Removed
ST7735R_DrawBMP Removed
LoadBMPImage Removed

Original Readme (Without test related info):

This repository contains a fast low level Arduino Uno compatible graphics library for the 160x128 pixel 16-bit color TFT LCD display that uses the ST7735R chip. It was written as a programming exercise after realizing that the built-in "Adafruit" TFT library that Arduino ships with is very slow. I wanted to display some slideshow images on the TFT using an Arduino, but unfortunately the built-in libraries take about 2.9 seconds(!) to draw a single 160x128 image on the screen from the SD card. With this library, it is possible to draw an image in about 188 milliseconds, which is a considerable 15.2x performance increase! The aim of this code is to squeeze every individual clock cycle out of the drawing routines to see how fast it is possible to drive the ST7735R display. If you can improve the code here, please let me know.

Rendering features

This library offers (almost) drop-in replacements for most built-in TFT library methods, and comes with the following functions:

  • Draw batches of individual pixels with a sequence of ST7735R_BeginPixels(), ST7735R_Pixel() and ST7735R_EndDraw() functions.
  • Fill solid rectangles with the ST7735R_FillRect() function.
  • Stream rectangles of custom content with a sequence of ST7735R_BeginRect(), ST7735R_PushPixel() and ST7735R_EndDraw() functions.
  • Draw horizontal lines with the function ST7735R_HLine() and vertical lines with the function ST7735R_VLine().
  • Draw arbitrary sloped lines with the function ST7735R_Line().
  • Draw hollow circles with the function ST7735R_Circle().
  • Draw filled circles with the function ST7735R_FilledCircle().
  • Draw 1-bit monochrome sprites from PROGMEM with the function ST7735R_DrawMonoSprite().
  • Draw text stored in PROGMEM with the function ST7735R_DrawText(). One font file "monaco_font.h" is provided, create more with the ttffont_to_cppheader.py tool.
  • Draw 24-bit bottom-up .bmp images with the functions LoadBMPImage(), SDCard_GetFileStartingBlock() and ST7735R_DrawBMP(). (requires hacking of the built-in SD card library to enable raw FAT32 block streaming).
  • Draw pre-prepared raw 16-bit images (files formatted with suffix .565) with the functions SDCard_GetFileStartingBlock() and ST7735R_Draw565(). (requires hacking of the built-in SD card library to enable raw FAT32 block streaming). Use the python tool image_to_rgb565.py to convert images to this format.

The library has only been used on an Arduino Uno with 8MHz hardware SPI mode, and contains several assumptions that might not hold when transferring the configuration to other setups. Don't use blindly without understanding the internals of the code!

References

License and Usage

Unless otherwise stated in individual files, all code is released to public domain. Do whatever you wish with it. This repository is a result of some recreational hacking activity, rather than a mission to build a stable and maintained library, so expect the maturity to be as such.

st7735r's People

Contributors

juj avatar dirtyspah avatar chrisdepas avatar

Watchers

James Cloos 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.