@@ -82,24 +82,21 @@ class PyCamera:
82
82
effects = ("Normal" , "Invert" , "B&W" , "Reddish" , "Greenish" , "Bluish" , "Sepia" , "Solarize" )
83
83
modes = ("JPEG" , "GIF" , "STOP" )
84
84
85
+ _AW_MUTE = const (0 )
86
+ _AW_SELECT = const (1 )
87
+ _AW_CARDDET = const (8 )
88
+ _AW_SDPWR = const (9 )
85
89
_AW_DOWN = const (15 )
86
90
_AW_LEFT = const (14 )
87
91
_AW_UP = const (13 )
88
92
_AW_RIGHT = const (12 )
89
93
_AW_OK = const (11 )
90
- _AW_SELECT = const (1 )
91
- _AW_BACKLIGHT = const (2 )
92
- _AW_CARDDET = const (8 )
93
- _AW_MUTE = const (0 )
94
- _AW_SDPWR = const (9 )
95
94
#_SS_ALL_BUTTONS_MASK = const(0b000010000000001011100)
96
95
#_SS_DOWN_MASK = const(0x10000)
97
96
#_SS_LEFT_MASK = const(0x00004)
98
97
#_SS_UP_MASK = const(0x00008)
99
98
#_SS_RIGHT_MASK = const(0x00040)
100
99
#_SS_CARDDET_MASK = const(0x00010)
101
- _AW_CAMRST = const (10 )
102
- _AW_CAMPWDN = const (7 )
103
100
104
101
_NVM_RESOLUTION = const (1 )
105
102
_NVM_EFFECT = const (2 )
@@ -142,10 +139,8 @@ def __init__(self) -> None:
142
139
self ._mode_label = label .Label (terminalio .FONT , text = "MODE" , color = 0xFFFFFF , x = 150 , y = 10 , scale = 2 )
143
140
144
141
# AW9523 GPIO expander
145
- self ._aw = adafruit_aw9523 .AW9523 (self ._i2c , address = 0x5B )
142
+ self ._aw = adafruit_aw9523 .AW9523 (self ._i2c , address = 0x58 )
146
143
print ("Found AW9523" )
147
- self .backlight = self ._aw .get_pin (_AW_BACKLIGHT )
148
- self .backlight .switch_to_output (False )
149
144
150
145
self .carddet_pin = self ._aw .get_pin (_AW_CARDDET )
151
146
self .card_detect = Debouncer (self .carddet_pin )
@@ -172,8 +167,8 @@ def __init__(self) -> None:
172
167
neopix .fill (0 )
173
168
174
169
# camera!
175
- self ._cam_reset = self . _aw . get_pin ( _AW_CAMRST )
176
- self ._cam_pwdn = self . _aw . get_pin ( _AW_CAMPWDN )
170
+ self ._cam_reset = DigitalInOut ( board . CAMERA_RESET )
171
+ self ._cam_pwdn = DigitalInOut ( board . CAMERA_PWDN )
177
172
178
173
self ._cam_reset .switch_to_output (False )
179
174
self ._cam_pwdn .switch_to_output (True )
@@ -184,7 +179,7 @@ def __init__(self) -> None:
184
179
time .sleep (0.01 )
185
180
186
181
print ("pre cam @" , time .monotonic ()- self .t )
187
- # self.i2c_scan()
182
+ self .i2c_scan ()
188
183
189
184
print ("Initializing camera" )
190
185
self .camera = espcamera .Camera (
@@ -206,7 +201,7 @@ def __init__(self) -> None:
206
201
#display.auto_refresh = False
207
202
208
203
self .camera .hmirror = True
209
- self .camera .vflip = False
204
+ self .camera .vflip = True
210
205
211
206
# action!
212
207
if not self .display :
@@ -336,7 +331,7 @@ def init_display(self):
336
331
self .display = displayio .Display (self ._display_bus , self ._INIT_SEQUENCE ,
337
332
width = 240 , height = 240 , colstart = 80 ,
338
333
auto_refresh = False )
339
- self .display .show ( self .splash )
334
+ self .display .root_group = self .splash
340
335
self .display .refresh ()
341
336
342
337
def deinit_display (self ):
@@ -388,7 +383,7 @@ def mount_sd_card(self):
388
383
self ._card_power .value = False
389
384
card_cs .deinit ()
390
385
print ("sdcard init @" , time .monotonic ()- self .t )
391
- self .sdcard = sdcardio .SDCard (self ._spi , board .CARD_CS , baudrate = 60000000 )
386
+ self .sdcard = sdcardio .SDCard (self ._spi , board .CARD_CS , baudrate = 20_000_000 )
392
387
vfs = storage .VfsFat (self .sdcard )
393
388
print ("mount vfs @" , time .monotonic ()- self .t )
394
389
storage .mount (vfs , "/sd" )
0 commit comments