77import framebufferio
88import adafruit_imageload
99import terminalio
10+ import vectorio
1011from adafruit_display_text import bitmap_label as label
1112import busio
1213import time
@@ -26,8 +27,8 @@ def __init__(self):
2627 # Setup Touch detection
2728 SCL_pin = board .SCL
2829 SDA_pin = board .SDA
29- if 'TOUCH_RES ' in dir (board ):
30- RES_pin = digitalio .DigitalInOut (board .TOUCH_RES )
30+ if 'TOUCH_RESET ' in dir (board ):
31+ RES_pin = digitalio .DigitalInOut (board .TOUCH_RESET )
3132 else :
3233 RES_pin = None
3334
@@ -39,7 +40,10 @@ def __init__(self):
3940 #else:
4041 # IRQ_PIN = None
4142
42- self .i2c = busio .I2C (SCL_pin , SDA_pin )
43+ if 'I2C' in dir (board ):
44+ self .i2c = board .I2C ()
45+ else :
46+ self .i2c = busio .I2C (SCL_pin , SDA_pin )
4347 if RES_pin is not None :
4448 self .ts = Touch_Screen (self .i2c , RES_pin , debug = False )
4549 else :
@@ -155,20 +159,16 @@ def calibrate(self):
155159 calibCount .y = 200
156160 calibCount .scale = 4
157161
158- block = displayio .Shape (10 ,10 )
159- pal = displayio .Palette (2 )
162+ pal = displayio .Palette (1 )
160163 pal [0 ] = 0xFFFFFF
161- pal [1 ] = 0xFFFFFF
162- for y in range (10 ):
163- block .set_boundary (y ,0 ,9 )
164- block_tile = displayio .TileGrid (block ,pixel_shader = pal )
165- block_tile .x = 0
166- block_tile .y = 0
164+ block = vectorio .Rectangle (pixel_shader = pal , width = 10 , height = 10 , x = 0 , y = 0 )
165+ block .x = 0
166+ block .y = 0
167167
168168 calib_scr = displayio .Group ()
169169 calib_scr .append (calibTxt1 )
170170 calib_scr .append (calibTxt2 )
171- calib_scr .append (block_tile )
171+ calib_scr .append (block )
172172 calib_scr .append (calibCount )
173173
174174 self ._display .root_group = calib_scr
@@ -189,8 +189,8 @@ def calibrate(self):
189189 smallest_X -= 5
190190 smallest_Y -= 5
191191
192- block_tile .x = self ._display .width - 10
193- block_tile .y = self ._display .height - 10
192+ block .x = self ._display .width - 10
193+ block .y = self ._display .height - 10
194194
195195 count = 5
196196 calibCount .text = str (count )
0 commit comments