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
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
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
card10
firmware
Commits
2433b2f0
Verified
Commit
2433b2f0
authored
5 years ago
by
rahix
Browse files
Options
Downloads
Patches
Plain Diff
fix(pycardium): Make leds module work with colors
Signed-off-by:
Rahix
<
rahix@rahix.de
>
parent
d407658a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Pipeline
#983
passed
5 years ago
Stage: build
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pycardium/modules/leds.c
+12
-12
12 additions, 12 deletions
pycardium/modules/leds.c
with
12 additions
and
12 deletions
pycardium/modules/leds.c
+
12
−
12
View file @
2433b2f0
...
...
@@ -8,21 +8,21 @@ 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
);
if
(
!
mp_obj_
is_type
(
color_in
,
&
mp_type_list
)
)
{
mp_raise_
Typ
eError
(
"color must
be a list
"
);
if
(
mp_obj_
get_int
(
mp_obj_len
(
color_in
))
<
3
)
{
mp_raise_
Valu
eError
(
"color must
have 3 elements
"
);
}
mp_obj_list_t
*
color
=
MP_OBJ_TO_PTR
(
color_in
);
if
(
color
->
len
<
3
)
{
mp_raise_ValueError
(
"color list must have 3 elements"
);
}
epic_leds_set
(
led
,
mp_obj_get_int
(
color
->
items
[
0
]),
mp_obj_get_int
(
color
->
items
[
1
]),
mp_obj_get_int
(
color
->
items
[
2
])
uint8_t
red
=
mp_obj_get_int
(
mp_obj_subscr
(
color_in
,
mp_obj_new_int
(
0
),
MP_OBJ_SENTINEL
)
);
uint8_t
green
=
mp_obj_get_int
(
mp_obj_subscr
(
color_in
,
mp_obj_new_int
(
1
),
MP_OBJ_SENTINEL
)
);
uint8_t
blue
=
mp_obj_get_int
(
mp_obj_subscr
(
color_in
,
mp_obj_new_int
(
2
),
MP_OBJ_SENTINEL
)
);
epic_leds_set
(
led
,
red
,
green
,
blue
);
return
mp_const_none
;
}
...
...
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