Modify driver for ST7735? #72
Replies: 2 comments
-
Did you install my driver using The directory structure should be Please see drivers doc. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks, that did it. Thanks again,
Stu
…On Tue, Nov 26, 2024 at 1:06 PM Peter Hinch ***@***.***> wrote:
Did you install my driver using mip or mpremote mip? This creates the
correct directory structure. The error you're seeing arises if the correct
driver is not being imported.
The directory structure should be /drivers/st7735r/st7735r.py and there
should be a file /drivers/boolpalette.py.
—
Reply to this email directly, view it on GitHub
<#72 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BEVDQT2C2TBL24JW3TEGDFL2CTIGDAVCNFSM6AAAAABSOTBP2OVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCMZYG43TENY>
.
You are receiving this because you authored the thread.Message ID:
<peterhinch/micropython-nano-gui/repo-discussions/72/comments/11387727@
github.com>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a (128x160) display that I got to work using the ST7735 driver from
https://github.com/alastairhm/micropython-st7735/blob/main/st7735/__init__.py
Here is the code for my demo program using the ST7735 driver from Montgomery:
#Just text demo
from st7735_Montgomery import TFT
from Fonts.petme128 import petme128 as my_font
Now import other modules
import gc
from machine import SPI, Pin
gc.collect() # Precaution
#define display
spi = SPI(1, baudrate=20000000, polarity=0, phase=0,
sck=Pin(10), mosi=Pin(11), miso=None)
tft = TFT(spi, aDC=16, aReset=17, aCS=18, ScreenSize=(128,160))
tft.rotation(3) #pins are at the "left" of the display
#set screen to black
tft.fill(TFT.BLACK)
#print "Hello" in different sizes
my_text = 'Hello' #text to be printed
text_color = tft.color(255,204,0) #set color of text
tft.text((1, 10), my_text, text_color, my_font, 1, nowrap=True)
tft.text((1, 20), my_text, text_color, my_font, 2, nowrap=True)
tft.text((1, 40), my_text, text_color, my_font, 3, nowrap=True)
tft.text((1, 65), my_text, text_color, my_font, 3.5, nowrap=True)
I can't get the display to work with your ST7735R, however. Here is the code I used with your driver:
from machine import SPI, Pin
import gc
gc.collect() # Precaution
color_setup.py pasted to here for ease of editing
from peterhinch.drivers.st7735r.st7735r import ST7735R as SSD
spi = SPI(1, baudrate=20000000, polarity=0, phase=0,
sck=Pin(10), mosi=Pin(11), miso=None)
pcs = Pin(18, Pin.OUT)
pdc = Pin(16, Pin.OUT)
prst = Pin(17, Pin.OUT)
ssd = SSD(spi, pcs, pdc, prst) # Create a display instance
#Imports for text
from peterhinch.writer import CWriter
from Fonts import RM_12x as my_font # 12 pt font created using font_to_py
#print text using CWriter
wrimem = CWriter(ssd, my_font) #set font
CWriter.set_textpos(ssd, 10, 0) #set text output position
wrimem.printstring('Hello') #send text to display
device.show() #turn display on
When I run this I get the error "OSError: Incompatible device driver." when wrimem = CWriter(ssd, my_font) is executed.
Can you give guidance on how to adapt your driver (which I really like for its ability to handle fonts thru CWriter) to run this display or maybe what I'm doing wrong with your driver? Many, many thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions