Skip to content
Snippets Groups Projects
Commit 4e3027d2 authored by moon2's avatar moon2 :speech_balloon:
Browse files

refactored payload adjusted to new api

parent 44edae10
No related branches found
No related tags found
No related merge requests found
File moved
from machine import Pin
from hardware import *
import utils
import time
import cap_touch_demo
import harmonic_demo
import melodic_demo
MODULES = [
cap_touch_demo,
harmonic_demo,
melodic_demo,
]
BOOTSEL_PIN = Pin(0, Pin.IN)
VOL_UP_PIN = Pin(35, Pin.IN, Pin.PULL_UP)
VOL_DOWN_PIN = Pin(37, Pin.IN, Pin.PULL_UP)
CURRENT_APP_RUN = None
VOLUME = 0
SELECT_TEXT = [
" ## #### # #### ## ##### #",
"# # # # # # # # #",
"# # # # # # #",
" ## #### # #### # # #",
" # # # # # # #",
"# # # # # # # # ",
" ## #### #### #### ## # #",
" ## #### # #### ## ##### ",
"# # # # # # # # ##" ,
"# # # # # # # #",
" ## #### # #### # # #" ,
" # # # # # # # #",
"# # # # # # # # ## ",
" ## #### #### #### ## # ",
]
BACKGROUND_COLOR = 0
# pin numbers
# right side: left 37, down 0, right 35
# left side: left 7, down 6, right 5
# NOTE: All except for 0 should be initialized with Pin.PULL_UP
# 0 (bootsel) probably not but idk? never tried
def run_menu():
global CURRENT_APP_RUN
display_fill(BACKGROUND_COLOR)
......@@ -95,16 +84,16 @@ def main():
set_global_volume_dB(VOLUME)
while True:
if(BOOTSEL_PIN.value() == 0):
if(get_button(0) == 2):
if CURRENT_APP_RUN == run_menu:
captouch_autocalib()
else:
CURRENT_APP_RUN = run_menu
foreground_menu()
if(VOL_UP_PIN.value() == 0):
set_rel_volume(+3)
if(VOL_DOWN_PIN.value() == 0):
set_rel_volume(-3)
if(get_button(0) == 1):
set_rel_volume(+1)
if(get_button(0) == -1):
set_rel_volume(-1)
CURRENT_APP_RUN()
main()
......@@ -11,8 +11,8 @@ def clear_all_leds():
update_leds()
def draw_text_big(text, x, y):
ypos = 120+int(len(text)/2) + int(y)
xpos = 120+int(len(text[0])/2) + int(x)
ypos = 120+int(len(text)) + int(y)
xpos = 120+int(len(text[0])) + int(x)
for l, line in enumerate(text):
for p, pixel in enumerate(line):
if(pixel == '#'):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment