File tree Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Expand file tree Collapse file tree 3 files changed +16
-6
lines changed File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 1+ import audiobusio
2+ import audiocore
13import board
4+ import busio
5+ import digitalio
6+ import displayio
7+ import keypad
8+ import os
29import supervisor
310import time
4- import keypad
5- import audiocore
6- import audiopwmio
7- import displayio
8- import busio
911
1012
1113K_X = 0x01
@@ -44,6 +46,7 @@ def get_pressed(self):
4446 now = time .monotonic ()
4547 if self .last_z_press :
4648 if now - self .last_z_press > 2 :
49+ os .chdir ('/' )
4750 supervisor .set_next_code_file (None )
4851 supervisor .reload ()
4952 else :
@@ -59,7 +62,14 @@ class _Audio:
5962 def __init__ (self ):
6063 self .muted = True
6164 self .buffer = bytearray (128 )
62- self .audio = audiopwmio .PWMAudioOut (board .BUZZER )
65+ self .audio = audiobusio .I2SOut (
66+ board .I2S_BCLK ,
67+ board .I2S_LRCLK ,
68+ board .I2S_DIN ,
69+ )
70+ self .gain_pin = digitalio .DigitalInOut (board .GAIN )
71+ self .gain_pin .pull = digitalio .Pull .UP # 2dB gain
72+ #self.gain_pin.switch_to_output(value=True) # 6dB gain
6373
6474 def play (self , audio_file , loop = False ):
6575 if self .muted :
You can’t perform that action at this time.
0 commit comments