Git Product home page Git Product logo

pico-displaydrivs's Introduction

pico-displayDrivs

Display driver library for RP2040 pico-sdk
Example code here

Supported display controllers:

ST7735 and ST7739 in SPI mode
ILI9341 in SPI mode

Library usage

Add the pico-displayDrivs subdirectory to the CMakeLists.txt of your project and include the needed libraries.

Display driver usage:

Check the readme of each driver in its corresponding folder.

GFX Library usage:

This package includes a graphics library, based on Adafruit-GFX-Library. It supports drawing basic shapes, characters and using custom fonts.

Note that the gfx.h header contains a convenience macro GFX_RGB565(R, G, B) to create a 16-bit 'rgb565' colour value from individual 8-bit components.

GFX Framebuffer

By default, the GFX library writes pixels directly to the screen. If desired, an internal framebuffer can be used (which is recomended in cases where speed is desired). The framebuffer is created using GFX_createFramebuf(), which automatically tells the library to write to the framebuffer. The buffer can then be pushed to the screen by calling GFX_flush(). If needed, the buffer can be destroyed by calling GFX_destroyFramebuf(). Doing so will revert to writing pixels directly to the screen.

GFX Library Reference

GFX_drawPixel(int16_t x, int16_t y, uint16_t color); draws a single pixel

GFX_drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size_x, uint8_t size_y); puts a single character on screen
GFX_write(uint8_t c); writes a character to the screen, handling the cursor position and text wrapping automatically
GFX_setCursor(int16_t x, int16_t y); places the text cursor at the specified coordinates
GFX_setTextColor(uint16_t color); sets the text color
GFX_setTextBack(uint16_t color); sets the text background color
GFX_setFont(const GFXfont *f); sets the used font, using the same format as Adafruit-GFX-Library
GFX_printf prints formatted text

GFX_fillScreen(uint16_t color); fills the screen with a specified color
GFX_setClearColor(uint16_t color); sets the color the screen should be cleared with
GFX_clearScreen(); clears the screen, filling it with the color specified using the function above

GFX_drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color); draws a line from (x0,y0) to (x1,y1)
GFX_drawFastHLine(int16_t x, int16_t y, int16_t l, uint16_t color); draws a horizontal line
GFX_drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color); draws a vertical line

GFX_drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); draws a rectangle
GFX_drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color) draws a circle
GFX_fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); draws a filled rectangle
GFX_fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color); draws a filled circle

pico-displaydrivs's People

Contributors

mjcross avatar tvlad1234 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pico-displaydrivs's Issues

Incorrect colors.

Hi!

I have been using this for a project of mine, but it looks like on the green tab display, colors "ST77XX_RED" and "ST77XX_BLUE" are swaped. I haven't tested the other colors, but these are definatly swaped. I double checked the code too.

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.