8000 Update and rename ugame22 to version 2.2 · python-ugame/circuitpython-stage@25e35a8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 25e35a8

Browse files
committed
Update and rename ugame22 to version 2.2
1 parent d3c1b93 commit 25e35a8

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed
File renamed without changes.
File renamed without changes.

pewpew_pi/ugame.py renamed to ugame22/ugame.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
import audiobusio
2+
import audiocore
13
import board
4+
import busio
5+
import digitalio
6+
import displayio
7+
import keypad
8+
import os
29
import supervisor
310
import time
4-
import keypad
5-
import audiocore
6-
import audiopwmio
7-
import displayio
8-
import busio
911

1012

1113
K_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:

0 commit comments

Comments
 (0)
0