boolpalette in ST7735 drivers #73
Replies: 4 comments 1 reply
-
You have me stumped :) |
Beta Was this translation helpful? Give feedback.
-
Thanks, that's what I did and regardless of what color I set in the
palette.bg() and palette.fg() lines I get a black background and a dark
blue (almost impossible to see) image. Any other suggestions? Thanks,
Stu
…On Fri, Nov 29, 2024 at 11:36 AM Peter Hinch ***@***.***> wrote:
I noticed that the driver does not include a "from boolpalette import
BoolPalette" statement as the other drivers do and it also does not have
the "self.palette= " line that others do. When I added them, it didn't seem
to help.
You have me stumped :)
Please see this line
<https://github.com/peterhinch/micropython-nano-gui/blob/8e46a7f5b512debcc56c72b440cbde216c04906b/drivers/st7735r/st7735r.py#L23>
and this one
<https://github.com/peterhinch/micropython-nano-gui/blob/8e46a7f5b512debcc56c72b440cbde216c04906b/drivers/st7735r/st7735r.py#L64>
.
—
Reply to this email directly, view it on GitHub
<#73 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BEVDQTZV6VLKHB5FYWTRPCT2DCX4VAVCNFSM6AAAAABSXNRXOWVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCNBRHAZTGOA>
.
You are receiving this because you authored the thread.Message ID:
<peterhinch/micropython-nano-gui/repo-discussions/73/comments/11418338@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
The GitHub history of $ mpremote mip install "github:peterhinch/micropython-nano-gui/drivers/st7735r" |
Beta Was this translation helpful? Give feedback.
-
Mr. Hinch
That seemed to fix it. One last question if it's not too much, is there a
way to rotate the display? I have a 128x160 screen that displays in
landscape mode. Can it be rotated to be in portrait mode using yor
drivers? Thanks,
Stu
…On Sat, Nov 30, 2024 at 4:50 AM Peter Hinch ***@***.***> wrote:
The GitHub history of st7735r.py shows that the file has been unchanged
for three years. If you had to modify it to add those lines you must have
been using a version older than this, or another driver altogether. I
suggest you install the current code and try again.
$ mpremote mip install "github:peterhinch/micropython-nano-gui/drivers/st7735r"
—
Reply to this email directly, view it on GitHub
<#73 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BEVDQT2IOIPAAORLVUYBPUT2DGRBTAVCNFSM6AAAAABSXNRXOWVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCNBSGE3TCNY>
.
You are receiving this because you authored the thread.Message ID:
<peterhinch/micropython-nano-gui/repo-discussions/73/comments/11421717@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
Do the palette.fg(color) and palette.bg(0) functions work with the ST7735R driver? When I run the following code
#A circle
import gc, math, array, utime
gc.collect()
#Import drivers
from drivers.st7735r.st7735r import ST7735R as SSD
from machine import SPI, Pin
#Define display
screen_h, screen_w = 128, 160
spi = SPI(1, sck=Pin(10), mosi=Pin(11), miso=None)
pcs = Pin(18, Pin.OUT, value=1)
pdc = Pin(16, Pin.OUT, value=0)
prst = Pin(17, Pin.OUT, value=1)
device = SSD(spi, cs=pcs, dc=pdc, rst=prst)
#circle radius and diameter
radius, diamtr = 12, 24
#define framebuffer(s) to be used
import framebuf
fbuf1 = framebuf.FrameBuffer(bytearray(diamtr*diamtr), diamtr, diamtr, framebuf.MONO_HLSB)
x_cent, y_cent = radius, radius #set location
fbuf1.ellipse(x_cent, y_cent, radius, radius, 1, True) #draw filled circle
#define palette and set background color
device.fill(0)
palette = device.palette
palette.bg(0)
palette.fg(SSD.rgb(255,0,0)) #red, circle
device.blit(fbuf1, 32, 68, 0, palette)
device.show()
I get the following error
MPY: soft reboot
Traceback (most recent call last):
File "", line 28, in
AttributeError: 'ST7735R' object has no attribute 'palette'
I noticed that the driver does not include a "from boolpalette import BoolPalette" statement as the other drivers do and it also does not have the "self.palette= " line that others do. When I added them, it didn't seem to help.
Many thanks
Beta Was this translation helpful? Give feedback.
All reactions