|
1 | 1 | # Extended Class to use TFT ST7789 in parallel bus |
| 2 | +#Example of use: |
| 3 | + |
| 4 | +# import st7789py_parallel |
| 5 | +# s=st7789py_parallel.ST7789_PARALLEL(320,240,0,None,None,4,22,5,12) |
| 6 | +# s.fill(0xff) |
| 7 | + |
2 | 8 |
|
3 | 9 | from micropython import const |
4 | 10 | from utime import sleep_ms, sleep_us |
|
7 | 13 | ## Pins (wiring) example and description |
8 | 14 | #ST7789 STM32F407VGT6 |
9 | 15 | #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 |
10 | | -#LCD_CS <---> GND #LCD chip select control pin, active low, if used only one LCD can be plug on GND |
11 | | -#LCD_RS <---> PD13 #LCD register command / data selection control pin, comand active low, data active high |
12 | | -#LCD_WR <---> PD5 #LCD write control pin, active low |
13 | | -#LCD_RD <---> PD4 #LCD read control pin, active low |
| 16 | +#LCD_CS <---> GND #LCD chip select control pin, active low, if unused only one LCD can be used, plug on GND |
| 17 | +#LCD_RS <---> PD22 #LCD register command / data selection control pin, comand active low, data active high |
| 18 | +#LCD_WR <---> PD4 #LCD write control pin, active low |
| 19 | +#LCD_RD <---> PD5 #LCD read control pin, active low, if unused plug on 3.3V |
14 | 20 | #GND <---> GND |
15 | 21 | #5V <---> 5V |
16 | 22 |
|
17 | | -#LCD_D2 <---> PD0 |
18 | | -#LCD_D3 <---> PD1 |
19 | | -#LCD_D4 <---> PE7 |
20 | | -#LCD_D5 <---> PE8 |
21 | | -#LCD_D6 <---> PE9 |
22 | | -#LCD_D7 <---> PE10 |
23 | | -#LCD_D0 <---> PD14 |
24 | | -#LCD_D1 <---> PD15 |
| 23 | +#LCD_D2 <---> pin-14 |
| 24 | +#LCD_D3 <---> pin-15 |
| 25 | +#LCD_D4 <---> pin-16 |
| 26 | +#LCD_D5 <---> pin-17 |
| 27 | +#LCD_D6 <---> pin-18 |
| 28 | +#LCD_D7 <---> pin-19 |
| 29 | +#LCD_D0 <---> pin-12 |
| 30 | +#LCD_D1 <---> pin-13 |
25 | 31 |
|
26 | 32 | ## DEFINE PINS CONST |
27 | 33 | _LCD_RST = const(None) #LCD reset control pin, active low |
@@ -66,6 +72,8 @@ def _encode_pixel(color): |
66 | 72 | """Encode a pixel color into bytes.""" |
67 | 73 | return struct.pack(_ENCODE_PIXEL, color) |
68 | 74 |
|
| 75 | + |
| 76 | + |
69 | 77 | class ST7789_PARALLEL(ST7789): |
70 | 78 | def __init__(self, width:(int) = 320, height:(int) = 240, rotation=0, |
71 | 79 | rst_pin:(int,None) = _LCD_RST, # LCD reset control pin |
|
0 commit comments