Giter Site home page Giter Site logo

micropython-st7735's Introduction

MicroPython-ST7735

This is a modified version of GuyCarver's ST7735.py ST7735 TFT LCD driver for MicroPython.

A font file is necessary for displaying text (some font files are in GuyCarver's repo).

Text nowrap option added(default: nowrap=False).

graphicstest.py is a sample code. I wrote this to make it similar to Adafruit's graphicstest sketch for Arduino.

If graphicstest.py doesn't work correctly, try replaceing initr() at line 8 to initg() or initb() or initb2(). You can also change rgb(True) to rgb(False) to switch red and blue pixels if your LCD module shows incorrect colors.

Pin connections for ESP32:

LCD ESP32-DevKitC
VLED 3V3
RST IO17
A0 IO16(DC)
SDA IO13(MOSI)
SCK IO14(CLK)
VCC 3V3
CS IO18
GND GND

YouTube image here

tftbmp.py is another sample similar to Adafruit's tftbmp sketch for Arduino.

Place bmp file named test128x160.bmp in the file system of MicroPython using file uploading tool such as ampy, etc.

offscreen-buffer.py shows how you can use an offscreen frame buffer which is an instance of FrameBuffer class. I tested this on Raspberry Pi Pico. See #9 for the pin connections.

micropython-st7735's People

Contributors

boochow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

micropython-st7735's Issues

License

Hello, I wish to use your driver code for a project I'm working on. However, I can't distribute it without a license! Would you mind adding one to your repository?

Framebuffer support

Thanks for this great library!

I'm using this library to display some terminal text on the
small TFT display. Unfortunately the speed for printing
text is rather low. Therefore updating the whole text
screen takes several seconds.

I tried solving this problem by implementing the
hardware scroll features of the chip (functions 0x33
and 0x37) but these function don't provide a real
scroll functionality but a vertical shift of the screen
content. The data of the screen buffer remain
unchanged.

For me the core problem is less the slow text()
function - it's rather charming to see the text
appear on the screen character by character.
It's the problem that I can't move parts of the
screen around, i.e. fast copy the screen buffer.

Here the use of the framebuffer would
help imensensly since the fill() function
is rather quick. Text() (more char()) would
write to the framebuf allowing it to be shifted
or moved at will.

Plus: This would allow the use of your
fine FBConsole (1) on a screen larger
than OLED as well.,,

So: Do you see a chance to implement
a framebuffer support for the ST7735?

1: https://github.com/boochow/FBConsole

black on white text?

When trying to use black text on white background, it shows up only as black rectangles. Is there a way to use black text?

Image does not display

Your sample bmp displays fine, but swapping it out for my own resized image does not show anything nor does it print the image size to the console. Does it need a specific encoding or color depth?

Font

Hi!
I have some problems when suing tft.char() or tft.text() , because i don't have the suitable resource for the font, could you share the resource with us?

placing a small image somewhere on the screen

hello im trying to make a little wether and notifications display but cant figure out how to place a small bmp image say for clouds or the sun i haven noticed there is an image() function but cant get it to work

Flashing updates, no buffer

Hello, I'm using this with the intent of creating a game that utilizes the screen. However, there's no update method or anything to utilize a buffer, so every operation is immediately applied. This causes the screen to flicker and show things loading in, which is not ideal. Is there a way to fix this?

landscape mode

hi!

First of all, I can't thank you enough! This library is the only solution I've found to get the TFT to work on my M5StickC with the latest MicroPython code release and ESP-IDF!

My issue is I can't find a way to use the screen in landscape mode, meaning printing text horizontally. I've messed around a lot with the rotation/offset but I could only achieve "portrait" mode which on the StickC is not feasible given the 80x160 size and the position on the wrist when used in combo with the armband.

I have set ScreenSize = (80, 160) and this is my initialization code (AXP192 setup is already handled):

from ST7735 import TFT
from sysfont import sysfont
import machine
from machine import SPI
tft = TFT(SPI(1, baudrate=27000000, polarity=0, phase=0, bits=8, firstbit=SPI.MSB, sck=machine.Pin(13), mosi=machine.Pin(15), miso=machine.Pin(36)), 23, 18, 5)
tft.initb2()
tft._offset = 25, 0
# un-invert colors
tft.rgb(False)
tft.invertcolor(True)
tft.rotation(2) # anything else results in only parts of the screen being used

Thanks in advance :)

Regarding the freeze issue when initializing the LCD on ESP32-S3

My development board is ESP32 S3. During the initialization process, it froze and could not stop, so I had to burn the firmware again.

The code is stuck here:
LCD=ST7735 (130, 161, spi, dc=Pin (15), cs=Pin (16), rst=Pin (18), rot=0, bgr=0)

The development board model is ESP32-S3-WROOM-1 N16R8, with 8MB of SPRAM and 16MB of Flash

pixel offsets

Hi, could you please patch the driver to allow screen x and y offset? I got a display which leaves some artefacts because of wrong (possibly ) memory mapping. Thank you.

Buffer example has wrong orientation

Hello again. There seems to be an issue regarding the FrameBuffer example, where it's rendered in portrait as opposed to landscape, which is how most screens are oriented. Is there a way to get around this problem?

Error "'module' object is not subscriptable" when using tft.print()

Hi!
I am running this on an esp32 and every time I use the tft.print() function. I'm not that python savvy to identify the problem on my own, so here's the complete error log:
`

tftprinttest()
Traceback (most recent call last):
File "", line 1, in
File "", line 103, in tftprinttest
File "ST7735.py", line 174, in text
TypeError: 'module' object is not subscriptable
`
Thanks!

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.