8000 Initial Working Driver by makermelissa · Pull Request #1 · adafruit/Adafruit_CircuitPython_ST7789 · GitHub
[go: up one dir, main page]

Skip to content

Initial Working Driver #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you 8000 agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 21, 2019
Merged

Initial Working Driver #1

merged 9 commits into from
Apr 21, 2019

Conversation

makermelissa
Copy link
Collaborator

Here's the driver for the ST7789. However, it is dependent on a new feature in CircuitPython provided by adafruit/circuitpython#1685.

@makermelissa makermelissa requested a review from a team March 24, 2019 03:25
@makermelissa
Copy link
Collaborator Author
makermelissa commented Mar 30, 2019

Ok, now that my changes were merged into CP, this driver is ready to be merged (after review of course). :)

@deshipu
Copy link
Contributor
deshipu commented Apr 1, 2019

I tested this initially with a random breakout from Aliexpress, and couldn't get it to work. Today I found the official Adafruit module, but no joy either. The display remains completely black (which is different from the ST7735, which is white when not initialized).
IMG_20190401_203604

import board
import displayio
from adafruit_st7789 import ST7789

spi = board.SPI()
tft_cs = board.D11
tft_dc = board.D9

displayio.release_displays()
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs,
                                 reset=board.D10)

display = ST7789(display_bus, width=240, height=240, rowstart=80)

# Make the display context
splash = displayio.Group(max_size=10)
display.show(splash)

color_bitmap = displayio.Bitmap(240, 240, 1)
color_palette = displayio.Palette(1)
color_palette[0] = 0xFF0000

bg_sprite = displayio.TileGrid(color_bitmap,
                               pixel_shader=color_palette,
                               x=0, y=0)
splash.append(bg_sprite)

while True:
    pass

@makermelissa
Copy link
Collaborator Author

Thanks for testing @deshipu, I'll take another look at this tonight.

@makermelissa
Copy link
Collaborator Author
makermelissa commented Apr 2, 2019

@deshipu, I just tested on Beta 6 and it worked fine. I don't have an ItsyBitsy M0 Express, but I hooked up my ItsyBitsy M4 Express the same way you did. Here's the code I used (with the IO pins adjusted)

import board
import displayio
from adafruit_st7789 import ST7789

spi = board.SPI()
tft_cs = board.D10
tft_dc = board.D7

displayio.release_displays()
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=board.D9)

display = ST7789(display_bus, width=240, height=240, rowstart=80)

# Make the display context
splash = displayio.Group(max_size=10)
display.show(splash)

color_bitmap = displayio.Bitmap(240, 240, 1)
color_palette = displayio.Palette(1)
color_palette[0] = 0xFF0000

try:
    bg_sprite = displayio.TileGrid(color_bitmap,
                                   pixel_shader=color_palette,
                                   position=(0, 0))
except TypeError:
    bg_sprite = displayio.TileGrid(color_bitmap,
                                   pixel_shader=color_palette,
                                   x=0, y=0)
splash.append(bg_sprite)

while True:
    pass

@makermelissa
Copy link
Collaborator Author

I just noticed this has been stale for almost 3 weeks. @deshipu, could I please get you to take another look at this? Thanks

@deshipu
Copy link
Contributor
deshipu commented Apr 20, 2019

I tried again with your pin assignment, and this time it worked.

import displayio
from adafruit_st7789 import ST7789

spi = board.SPI()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you configure the SPI to higher speed than the default? It's painfully slow. I think it would be best to configure it to display's maximum.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. It looks like that's been added since I made this. Could you remind me of the syntax to change it and the speed you think would work better? Were you thinking 24MHz?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found something on discord and used that to set it to 24MHz.

Melissa LeBlanc-Williams added 2 commits April 20, 2019 16:47
@makermelissa makermelissa requested a review from deshipu April 20, 2019 23:58
@deshipu deshipu merged commit eb3d170 into adafruit:master Apr 21, 2019
@deshipu
Copy link
Contributor
deshipu commented Apr 21, 2019

Looks and works great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0