First Upload
0.6 Alpha offers minimal core functionality.
This commit is contained in:
parent
a66ee57176
commit
769c1cbc05
1
Save/current.json
Normal file
1
Save/current.json
Normal file
@ -0,0 +1 @@
|
||||
TestTestTake 2Take 2Take 2Take 2
|
||||
BIN
Sprites/Backgrounds/bg1.bmp
Normal file
BIN
Sprites/Backgrounds/bg1.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
BIN
Sprites/Characters/BOTORU/ADULT/body.bmp
Normal file
BIN
Sprites/Characters/BOTORU/ADULT/body.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
BIN
Sprites/Characters/MUSH/ADULT/body.bmp
Normal file
BIN
Sprites/Characters/MUSH/ADULT/body.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
BIN
Sprites/Characters/ZAHKC/ADULT/body.bmp
Normal file
BIN
Sprites/Characters/ZAHKC/ADULT/body.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
3
boot_out.txt
Normal file
3
boot_out.txt
Normal file
@ -0,0 +1,3 @@
|
||||
Adafruit CircuitPython 8.1.0 on 2023-05-22; Adafruit Feather ESP32-S2 Reverse TFT with ESP32S2
|
||||
Board ID:adafruit_feather_esp32s2_reverse_tft
|
||||
UID:0740D17FA749
|
||||
76
code.py
Normal file
76
code.py
Normal file
@ -0,0 +1,76 @@
|
||||
import time
|
||||
import alarm
|
||||
import board
|
||||
import displayio
|
||||
import digitalio
|
||||
import bitmaptools
|
||||
import adafruit_imageload
|
||||
|
||||
import menu
|
||||
import selector
|
||||
import buttonBus
|
||||
|
||||
#screen /dev/ttyACM0 115200
|
||||
|
||||
#setup
|
||||
board.DISPLAY.root_group.hidden = False
|
||||
board.DISPLAY.rotation = 90
|
||||
splash = displayio.Group()
|
||||
board.DISPLAY.show(splash)
|
||||
|
||||
bg, bgPallette = adafruit_imageload.load("/Sprites/Backgrounds/bg1.bmp", bitmap=displayio.Bitmap, palette=displayio.Palette)
|
||||
bgTile = displayio.TileGrid(bg, pixel_shader=bgPallette)
|
||||
|
||||
tama, tamaPallette = adafruit_imageload.load("/Sprites/Characters/MUSH/ADULT/BODY.BMP", bitmap=displayio.Bitmap, palette=displayio.Palette)
|
||||
tamaPallette.make_transparent(3)
|
||||
tamaTile = displayio.TileGrid(tama, pixel_shader=tamaPallette, x=20, y=100)
|
||||
|
||||
|
||||
splash.append(bgTile)
|
||||
splash.append(tamaTile)
|
||||
|
||||
bounce = False
|
||||
bounceAmount = -10
|
||||
selector.showSelector(splash)
|
||||
|
||||
#Menu Activites
|
||||
def do(x):
|
||||
if x == 0:
|
||||
pass
|
||||
elif x == 1:
|
||||
pass
|
||||
elif x == 2:
|
||||
pass
|
||||
elif x == 3:
|
||||
pass
|
||||
elif x == 4:
|
||||
menu.toggleMenu(splash)
|
||||
elif x == 5:
|
||||
buttonBus.button1.deinit()
|
||||
pin_alarm = alarm.pin.PinAlarm(pin=board.D1, value=True, pull=True)
|
||||
time.sleep(0.5)
|
||||
alarm.exit_and_deep_sleep_until_alarms(pin_alarm)
|
||||
|
||||
|
||||
#System Loop
|
||||
while True:
|
||||
|
||||
if(round(time.monotonic()%0.5, 1) == 0.5):
|
||||
if bounce == False:
|
||||
bounce = True
|
||||
bounceAmount = bounceAmount * -1
|
||||
tamaTile.y += bounceAmount
|
||||
else:
|
||||
if bounce == True:
|
||||
bounce = False
|
||||
|
||||
|
||||
if buttonBus.getSelectedButton() == 0:
|
||||
selector.lastPos()
|
||||
time.sleep(0.2)
|
||||
elif buttonBus.getSelectedButton() == 1:
|
||||
do(selector.spos)
|
||||
time.sleep(0.2)
|
||||
elif buttonBus.getSelectedButton() == 2:
|
||||
selector.nextPos()
|
||||
time.sleep(0.2)
|
||||
0
lib/adafruit_display_shapes/__init__.py
Normal file
0
lib/adafruit_display_shapes/__init__.py
Normal file
BIN
lib/adafruit_display_shapes/circle.mpy
Normal file
BIN
lib/adafruit_display_shapes/circle.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_display_shapes/line.mpy
Normal file
BIN
lib/adafruit_display_shapes/line.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_display_shapes/multisparkline.mpy
Normal file
BIN
lib/adafruit_display_shapes/multisparkline.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_display_shapes/polygon.mpy
Normal file
BIN
lib/adafruit_display_shapes/polygon.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_display_shapes/rect.mpy
Normal file
BIN
lib/adafruit_display_shapes/rect.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_display_shapes/roundrect.mpy
Normal file
BIN
lib/adafruit_display_shapes/roundrect.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_display_shapes/sparkline.mpy
Normal file
BIN
lib/adafruit_display_shapes/sparkline.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_display_shapes/triangle.mpy
Normal file
BIN
lib/adafruit_display_shapes/triangle.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_display_text/__init__.mpy
Normal file
BIN
lib/adafruit_display_text/__init__.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_display_text/bitmap_label.mpy
Normal file
BIN
lib/adafruit_display_text/bitmap_label.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_display_text/label.mpy
Normal file
BIN
lib/adafruit_display_text/label.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_display_text/scrolling_label.mpy
Normal file
BIN
lib/adafruit_display_text/scrolling_label.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_esp32s2tft/__init__.mpy
Normal file
BIN
lib/adafruit_esp32s2tft/__init__.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_esp32s2tft/graphics.mpy
Normal file
BIN
lib/adafruit_esp32s2tft/graphics.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_esp32s2tft/network.mpy
Normal file
BIN
lib/adafruit_esp32s2tft/network.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_esp32s2tft/peripherals.mpy
Normal file
BIN
lib/adafruit_esp32s2tft/peripherals.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_imageload/__init__.mpy
Normal file
BIN
lib/adafruit_imageload/__init__.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_imageload/bmp/__init__.mpy
Normal file
BIN
lib/adafruit_imageload/bmp/__init__.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_imageload/bmp/indexed.mpy
Normal file
BIN
lib/adafruit_imageload/bmp/indexed.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_imageload/bmp/negative_height_check.mpy
Normal file
BIN
lib/adafruit_imageload/bmp/negative_height_check.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_imageload/displayio_types.mpy
Normal file
BIN
lib/adafruit_imageload/displayio_types.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_imageload/gif.mpy
Normal file
BIN
lib/adafruit_imageload/gif.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_imageload/png.mpy
Normal file
BIN
lib/adafruit_imageload/png.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_imageload/pnm/__init__.mpy
Normal file
BIN
lib/adafruit_imageload/pnm/__init__.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_imageload/pnm/pbm_ascii.mpy
Normal file
BIN
lib/adafruit_imageload/pnm/pbm_ascii.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_imageload/pnm/pbm_binary.mpy
Normal file
BIN
lib/adafruit_imageload/pnm/pbm_binary.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_imageload/pnm/pgm/__init__.mpy
Normal file
BIN
lib/adafruit_imageload/pnm/pgm/__init__.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_imageload/pnm/pgm/ascii.mpy
Normal file
BIN
lib/adafruit_imageload/pnm/pgm/ascii.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_imageload/pnm/pgm/binary.mpy
Normal file
BIN
lib/adafruit_imageload/pnm/pgm/binary.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_imageload/pnm/ppm_ascii.mpy
Normal file
BIN
lib/adafruit_imageload/pnm/ppm_ascii.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_imageload/pnm/ppm_binary.mpy
Normal file
BIN
lib/adafruit_imageload/pnm/ppm_binary.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_imageload/tilegrid_inflator.mpy
Normal file
BIN
lib/adafruit_imageload/tilegrid_inflator.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_max1704x.mpy
Normal file
BIN
lib/adafruit_max1704x.mpy
Normal file
Binary file not shown.
0
lib/adafruit_register/__init__.py
Normal file
0
lib/adafruit_register/__init__.py
Normal file
BIN
lib/adafruit_register/i2c_bcd_alarm.mpy
Normal file
BIN
lib/adafruit_register/i2c_bcd_alarm.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_register/i2c_bcd_datetime.mpy
Normal file
BIN
lib/adafruit_register/i2c_bcd_datetime.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_register/i2c_bit.mpy
Normal file
BIN
lib/adafruit_register/i2c_bit.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_register/i2c_bits.mpy
Normal file
BIN
lib/adafruit_register/i2c_bits.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_register/i2c_struct.mpy
Normal file
BIN
lib/adafruit_register/i2c_struct.mpy
Normal file
Binary file not shown.
BIN
lib/adafruit_register/i2c_struct_array.mpy
Normal file
BIN
lib/adafruit_register/i2c_struct_array.mpy
Normal file
Binary file not shown.
21
lib/buttonBus.py
Normal file
21
lib/buttonBus.py
Normal file
@ -0,0 +1,21 @@
|
||||
import digitalio
|
||||
import board
|
||||
import time
|
||||
|
||||
button0 = digitalio.DigitalInOut(board.D0)
|
||||
button0.direction = digitalio.Direction.INPUT
|
||||
button0.pull = digitalio.Pull.UP
|
||||
button1 = digitalio.DigitalInOut(board.D1)
|
||||
button1.direction = digitalio.Direction.INPUT
|
||||
button1.pull = digitalio.Pull.DOWN
|
||||
button2 = digitalio.DigitalInOut(board.D2)
|
||||
button2.direction = digitalio.Direction.INPUT
|
||||
button2.pull = digitalio.Pull.DOWN
|
||||
|
||||
def getSelectedButton():
|
||||
if not button0.value:
|
||||
return 0
|
||||
elif button1.value:
|
||||
return 1
|
||||
elif button2.value:
|
||||
return 2
|
||||
28
lib/menu.py
Normal file
28
lib/menu.py
Normal file
@ -0,0 +1,28 @@
|
||||
import board
|
||||
import adafruit_max1704x
|
||||
import time
|
||||
import terminalio
|
||||
import displayio
|
||||
from adafruit_display_shapes.rect import Rect
|
||||
from adafruit_display_text import bitmap_label, wrap_text_to_lines
|
||||
|
||||
menuToggle = True
|
||||
battery = adafruit_max1704x.MAX17048(board.I2C())
|
||||
|
||||
def toggleMenu(splash):
|
||||
global menuToggle
|
||||
global battery
|
||||
if menuToggle:
|
||||
battery.reset()
|
||||
time.sleep(0.05)
|
||||
timeText = bitmap_label.Label(terminalio.FONT, text="Time: " + str(time.time() - 946684800), scale=1, color=0x000000, x=25, y=60)
|
||||
batText = bitmap_label.Label(terminalio.FONT, text="Battery: " + str(round(battery.cell_percent)) + "%", scale=1, color=0x000000, x=25, y=80)
|
||||
menuGroup = displayio.Group()
|
||||
menuGroup.append(Rect(10, 10, 115, 220, fill=0xFFFFFF, outline=0x000000, stroke=2))
|
||||
menuGroup.append(bitmap_label.Label(terminalio.FONT, text="Menu", scale=2, color=0x000000, x=30, y=30))
|
||||
menuGroup.append(timeText)
|
||||
menuGroup.append(batText)
|
||||
splash.append(menuGroup)
|
||||
else:
|
||||
splash.pop()
|
||||
menuToggle ^= True
|
||||
16
lib/save.py
Normal file
16
lib/save.py
Normal file
@ -0,0 +1,16 @@
|
||||
import storage
|
||||
import supervisor
|
||||
import microcontroller
|
||||
|
||||
try:
|
||||
storage.remount("/", supervisor.runtime.usb_connected)
|
||||
except RuntimeError as E:
|
||||
print("PC Mode")
|
||||
microcontroller.reset()
|
||||
try:
|
||||
with open("/Save/current.json", "a") as save:
|
||||
save.write("Take 2")
|
||||
save.flush()
|
||||
except OSError as E:
|
||||
print("READ ONLY")
|
||||
print(E)
|
||||
47
lib/selector.py
Normal file
47
lib/selector.py
Normal file
@ -0,0 +1,47 @@
|
||||
from adafruit_display_shapes.circle import Circle
|
||||
|
||||
spos = -1
|
||||
select = Circle(15, 10, 10, outline=0x000000, stroke=2)
|
||||
|
||||
def showSelector(splash):
|
||||
global spos
|
||||
if spos == -1:
|
||||
splash.append(select)
|
||||
spos += 1
|
||||
print("added")
|
||||
|
||||
def hideSelector(splash):
|
||||
global spos
|
||||
if spos != -1:
|
||||
splash.pop()
|
||||
|
||||
def nextPos():
|
||||
global spos
|
||||
spos = (spos + 1) % 6
|
||||
updatePos()
|
||||
|
||||
def lastPos():
|
||||
global spos
|
||||
spos = (spos - 1) % 6
|
||||
updatePos()
|
||||
|
||||
def updatePos():
|
||||
global select
|
||||
if spos == 0:
|
||||
select.x = 5
|
||||
select.y = 0
|
||||
elif spos == 1:
|
||||
select.x = 40
|
||||
select.y = 0
|
||||
elif spos == 2:
|
||||
select.x = 70
|
||||
select.y = 0
|
||||
elif spos == 3:
|
||||
select.x = 90
|
||||
select.y = 0
|
||||
elif spos == 4:
|
||||
select.x = 0
|
||||
select.y = 220
|
||||
elif spos == 5:
|
||||
select.x = 110
|
||||
select.y = 220
|
||||
0
settings.toml
Normal file
0
settings.toml
Normal file
Loading…
x
Reference in New Issue
Block a user