Skip to content

Commit

Permalink
Update st7789py_parallel.py
Browse files Browse the repository at this point in the history
  • Loading branch information
PauloCardosoC authored Feb 1, 2023
1 parent 172d8bb commit 241e161
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions lib/st7789py_parallel.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Extended Class to use TFT ST7789 in parallel bus
#Example of use:

# import st7789py_parallel
# s=st7789py_parallel.ST7789_PARALLEL(320,240,0,None,None,4,22,5,12)
# s.fill(0xff)


from micropython import const
from utime import sleep_ms, sleep_us
Expand All @@ -7,21 +13,21 @@
## Pins (wiring) example and description
#ST7789 STM32F407VGT6
#LCD_RST <---> 3.3V #LCD reset control pin, active low, used to force a hardware reset of the board, if unused need be plug on 3.3V
#LCD_CS <---> GND #LCD chip select control pin, active low, if used only one LCD can be plug on GND
#LCD_RS <---> PD13 #LCD register command / data selection control pin, comand active low, data active high
#LCD_WR <---> PD5 #LCD write control pin, active low
#LCD_RD <---> PD4 #LCD read control pin, active low
#LCD_CS <---> GND #LCD chip select control pin, active low, if unused only one LCD can be used, plug on GND
#LCD_RS <---> PD22 #LCD register command / data selection control pin, comand active low, data active high
#LCD_WR <---> PD4 #LCD write control pin, active low
#LCD_RD <---> PD5 #LCD read control pin, active low, if unused plug on 3.3V
#GND <---> GND
#5V <---> 5V

#LCD_D2 <---> PD0
#LCD_D3 <---> PD1
#LCD_D4 <---> PE7
#LCD_D5 <---> PE8
#LCD_D6 <---> PE9
#LCD_D7 <---> PE10
#LCD_D0 <---> PD14
#LCD_D1 <---> PD15
#LCD_D2 <---> pin-14
#LCD_D3 <---> pin-15
#LCD_D4 <---> pin-16
#LCD_D5 <---> pin-17
#LCD_D6 <---> pin-18
#LCD_D7 <---> pin-19
#LCD_D0 <---> pin-12
#LCD_D1 <---> pin-13

## DEFINE PINS CONST
_LCD_RST = const(None) #LCD reset control pin, active low
Expand Down Expand Up @@ -66,6 +72,8 @@ def _encode_pixel(color):
"""Encode a pixel color into bytes."""
return struct.pack(_ENCODE_PIXEL, color)



class ST7789_PARALLEL(ST7789):
def __init__(self, width:(int) = 320, height:(int) = 240, rotation=0,
rst_pin:(int,None) = _LCD_RST, # LCD reset control pin
Expand Down

1 comment on commit 241e161

@PauloCardosoC
Copy link
Author

Choose a reason for hiding this comment

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

New class extended from st7789py to support 8 bits parallel bus (I8080) with viper on write the gpios for speed.

Please sign in to comment.