|
3 | 3 | # |
4 | 4 | # SPDX-License-Identifier: MIT |
5 | 5 |
|
6 | | -'''Raspberry Pi Graphics example for the 240x240 Round TFT''' |
| 6 | +'''Raspberry Pi Graphics example for the Vertical Newxie TFT''' |
7 | 7 |
|
8 | 8 | import time |
9 | 9 | import digitalio |
|
18 | 18 | dc_pin = digitalio.DigitalInOut(board.D25) |
19 | 19 | reset_pin = digitalio.DigitalInOut(board.D27) |
20 | 20 |
|
21 | | -BAUDRATE = 24000000 |
| 21 | +BAUDRATE=24000000 |
| 22 | + |
22 | 23 |
|
23 | 24 | spi = board.SPI() |
24 | 25 |
|
25 | | -disp = gc9a01a.GC9A01A(spi, rotation=180, |
26 | | - width=135, height=240, |
27 | | - x_offset=53, y_offset=40, |
| 26 | +disp = gc9a01a.GC9A01A(spi, rotation=0, |
| 27 | + width=240, height=240, |
| 28 | + x_offset=0, y_offset=0, |
28 | 29 | cs=cs_pin, |
29 | 30 | dc=dc_pin, |
30 | 31 | rst=reset_pin, |
|
37 | 38 | # -------TEXT AND SHAPES--------- |
38 | 39 | image1 = Image.new("RGB", (width, height)) |
39 | 40 | draw1 = ImageDraw.Draw(image1) |
40 | | -draw1.rectangle((0, 0, width, height), fill=(0, 255, 0)) # Green background |
| 41 | +draw1.ellipse((0, 0, width, height), fill=(0, 255, 0)) # Green background |
41 | 42 |
|
42 | | -draw1.rectangle( |
| 43 | +draw1.ellipse( |
43 | 44 | (BORDER, BORDER, width - BORDER - 1, height - BORDER - 1), fill=(170, 0, 136) |
44 | 45 | ) |
45 | 46 | font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", FONTSIZE) |
46 | | -text = "Hello\nWorld!" |
| 47 | +text = "Hello World!" |
47 | 48 | (font_width, font_height) = font.getsize(text) |
48 | 49 | draw1.text( |
49 | | - (30, height // 2 - font_height // 2-12), |
| 50 | + (width // 2 - font_width // 2, height // 2 - font_height // 2), |
50 | 51 | text, |
51 | 52 | font=font, |
52 | 53 | fill=(255, 255, 0), |
53 | 54 | ) |
54 | 55 |
|
55 | | -# ------BLINKA JPEG DISPLAY---------- |
| 56 | +# ------ADABOT JPEG DISPLAY---------- |
56 | 57 | image2 = Image.open("blinka_round.jpg") |
57 | 58 | image_ratio = image2.width / image2.height |
58 | 59 | screen_ratio = width / height |
|
66 | 67 | while True: |
67 | 68 | disp.image(image1) # show text |
68 | 69 | time.sleep(2) |
69 | | - disp.image(image2) # show blinka |
| 70 | + disp.image(image2) # show adabot |
70 | 71 | time.sleep(2) |
0 commit comments