Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
flow3r firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
toerb
flow3r firmware
Commits
4e3027d2
Commit
4e3027d2
authored
1 year ago
by
moon2
Browse files
Options
Downloads
Patches
Plain Diff
refactored payload adjusted to new api
parent
44edae10
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
python_payload/harmonic_demo.py
+0
-0
0 additions, 0 deletions
python_payload/harmonic_demo.py
python_payload/main.py
+14
-25
14 additions, 25 deletions
python_payload/main.py
python_payload/utils.py
+2
-2
2 additions, 2 deletions
python_payload/utils.py
with
16 additions
and
27 deletions
python_payload/
cap_touch
_demo.py
→
python_payload/
harmonic
_demo.py
+
0
−
0
View file @
4e3027d2
File moved
This diff is collapsed.
Click to expand it.
python_payload/main.py
+
14
−
25
View file @
4e3027d2
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
()
This diff is collapsed.
Click to expand it.
python_payload/utils.py
+
2
−
2
View file @
4e3027d2
...
...
@@ -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
==
'
#
'
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment