Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
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
Container registry
Model registry
Operate
Environments
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dos
firmware
Commits
4318fa5c
Verified
Commit
4318fa5c
authored
Aug 23, 2019
by
genofire
Browse files
Options
Downloads
Patches
Plain Diff
py: get rocket state
parent
0f600f98
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
pycardium/modules/py/leds.py
+20
-0
20 additions, 0 deletions
pycardium/modules/py/leds.py
pycardium/modules/qstrdefs.h
+1
-0
1 addition, 0 deletions
pycardium/modules/qstrdefs.h
pycardium/modules/sys_leds.c
+9
-1
9 additions, 1 deletion
pycardium/modules/sys_leds.c
with
30 additions
and
1 deletion
pycardium/modules/py/leds.py
+
20
−
0
View file @
4318fa5c
...
...
@@ -72,6 +72,26 @@ def set_rocket(led, value):
sys_leds
.
set_rocket
(
led
,
value
)
def
get_rocket
(
led
):
"""
Get brightness of one of the rocket LEDs.
:param int led: Choose your rocket!
+-------+--------+----------+
| ID | Color | Location |
+=======+========+==========+
| ``0`` | Blue | Left |
+-------+--------+----------+
| ``1`` | Yellow | Top |
+-------+--------+----------+
| ``2`` | Green | Right |
+-------+--------+----------+
:return int: Brightness of LED (value between 0 and 31).
"""
return
sys_leds
.
get_rocket
(
led
)
def
dim_top
(
value
):
"""
Set global brightness for top RGB LEDs.
...
...
This diff is collapsed.
Click to expand it.
pycardium/modules/qstrdefs.h
+
1
−
0
View file @
4318fa5c
...
...
@@ -15,6 +15,7 @@ Q(set_all)
Q
(
set_all_hsv
)
Q
(
set_flashlight
)
Q
(
set_rocket
)
Q
(
get_rocket
)
Q
(
set_powersave
)
Q
(
set_gamma
)
Q
(
dim_top
)
...
...
This diff is collapsed.
Click to expand it.
pycardium/modules/sys_leds.c
+
9
−
1
View file @
4318fa5c
...
...
@@ -6,7 +6,6 @@
#include
<stdio.h>
static
mp_obj_t
mp_leds_set
(
mp_obj_t
led_in
,
mp_obj_t
color_in
)
{
int
led
=
mp_obj_get_int
(
led_in
);
...
...
@@ -174,6 +173,14 @@ static mp_obj_t mp_leds_set_rocket(mp_obj_t led_in, mp_obj_t value_in)
}
static
MP_DEFINE_CONST_FUN_OBJ_2
(
leds_set_rocket_obj
,
mp_leds_set_rocket
);
static
mp_obj_t
mp_leds_get_rocket
(
mp_obj_t
led_in
)
{
int
led
=
mp_obj_get_int
(
led_in
);
uint8_t
ret
=
epic_leds_get_rocket
(
led
);
return
MP_OBJ_NEW_SMALL_INT
(
ret
);
}
static
MP_DEFINE_CONST_FUN_OBJ_1
(
leds_get_rocket_obj
,
mp_leds_get_rocket
);
static
mp_obj_t
mp_leds_dim_top
(
mp_obj_t
dim_in
)
{
int
dim
=
mp_obj_get_int
(
dim_in
);
...
...
@@ -242,6 +249,7 @@ static const mp_rom_map_elem_t leds_module_globals_table[] = {
{
MP_ROM_QSTR
(
MP_QSTR_set_all
),
MP_ROM_PTR
(
&
leds_set_all_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_set_all_hsv
),
MP_ROM_PTR
(
&
leds_set_all_hsv_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_set_rocket
),
MP_ROM_PTR
(
&
leds_set_rocket_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_get_rocket
),
MP_ROM_PTR
(
&
leds_get_rocket_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_set_flashlight
),
MP_ROM_PTR
(
&
leds_set_flashlight_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_update
),
MP_ROM_PTR
(
&
leds_update_obj
)
},
...
...
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