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
aa25b0b5
Commit
aa25b0b5
authored
1 year ago
by
q3k
Browse files
Options
Downloads
Patches
Plain Diff
sim: implement new leds api
parent
7f6cce66
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
sim/fakes/hardware.py
+2
-31
2 additions, 31 deletions
sim/fakes/hardware.py
sim/fakes/leds.py
+34
-0
34 additions, 0 deletions
sim/fakes/leds.py
with
36 additions
and
31 deletions
sim/fakes/hardware.py
+
2
−
31
View file @
aa25b0b5
...
@@ -343,40 +343,11 @@ def display_update(subctx):
...
@@ -343,40 +343,11 @@ def display_update(subctx):
def
display_pipe_full
():
def
display_pipe_full
():
return
False
return
False
def
set_led_rgb
(
ix
,
r
,
g
,
b
):
ix
=
((
39
-
ix
)
+
1
+
32
)
%
40
;
r
=
r
<<
3
g
=
g
<<
2
b
=
b
<<
3
if
r
>
255
:
r
=
255
if
g
>
255
:
g
=
255
if
b
>
255
:
b
=
255
_sim
.
set_led_rgb
(
ix
,
r
,
g
,
b
)
def
set_led_hsv
(
ix
,
h
,
s
,
v
):
color
=
pygame
.
Color
(
0
)
h
/=
255.0
color
.
hsva
=
(
h
,
s
,
v
,
1.0
)
r
,
g
,
b
=
color
.
r
,
color
.
g
,
color
.
b
r
*=
255
g
*=
255
b
*=
255
_sim
.
set_led_rgb
(
ix
,
r
,
g
,
b
)
def
update_leds
():
_sim
.
leds_update
()
_sim
.
render_gui_lazy
()
def
set_global_volume_dB
(
a
):
def
set_global_volume_dB
(
a
):
pass
pass
def
get_button_state
(
left
):
def
get_button_state
(
left
):
_sim
.
process_events
()
_sim
.
process_events
()
_sim
.
render_gui_lazy
()
_sim
.
render_gui_lazy
()
...
...
This diff is collapsed.
Click to expand it.
sim/fakes/leds.py
0 → 100644
+
34
−
0
View file @
aa25b0b5
from
hardware
import
_sim
import
pygame
def
set_rgb
(
ix
,
r
,
g
,
b
):
ix
=
((
39
-
ix
)
+
1
+
32
)
%
40
;
r
=
r
<<
3
g
=
g
<<
2
b
=
b
<<
3
if
r
>
255
:
r
=
255
if
g
>
255
:
g
=
255
if
b
>
255
:
b
=
255
_sim
.
set_led_rgb
(
ix
,
r
,
g
,
b
)
def
set_hsv
(
ix
,
h
,
s
,
v
):
color
=
pygame
.
Color
(
0
)
h
/=
255.0
color
.
hsva
=
(
h
,
s
,
v
,
1.0
)
r
,
g
,
b
=
color
.
r
,
color
.
g
,
color
.
b
r
*=
255
g
*=
255
b
*=
255
_sim
.
set_led_rgb
(
ix
,
r
,
g
,
b
)
def
update
():
_sim
.
leds_update
()
_sim
.
render_gui_lazy
()
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