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
1
3
import board
4
+ import busio
5
+ import digitalio
6
+ import displayio
7
+ import keypad
8
+ import os
2
9
import supervisor
3
10
import time
4
- import keypad
5
- import audiocore
6
- import audiopwmio
7
- import displayio
8
- import busio
9
11
10
12
11
13
K_X = 0x01
@@ -44,6 +46,7 @@ def get_pressed(self):
44
46
now = time .monotonic ()
45
47
if self .last_z_press :
46
48
if now - self .last_z_press > 2 :
49
+ os .chdir ('/' )
47
50
supervisor .set_next_code_file (None )
48
51
supervisor .reload ()
49
52
else :
@@ -59,7 +62,14 @@ class _Audio:
59
62
def __init__ (self ):
60
63
self .muted = True
61
64
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
63
73
64
74
def play (self , audio_file , loop = False ):
65
75
if self .muted :
You can’t perform that action at this time.
0 commit comments