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
039066d8
Commit
039066d8
authored
5 years ago
by
zenox
Browse files
Options
Downloads
Patches
Plain Diff
for annoyatron
parent
0f67e1d3
No related branches found
No related tags found
1 merge request
!325
flash_rocket
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
epicardium/modules/leds.c
+17
-17
17 additions, 17 deletions
epicardium/modules/leds.c
pycardium/modules/py/leds.py
+1
-0
1 addition, 0 deletions
pycardium/modules/py/leds.py
pycardium/modules/sys_leds.c
+5
-3
5 additions, 3 deletions
pycardium/modules/sys_leds.c
with
23 additions
and
20 deletions
epicardium/modules/leds.c
+
17
−
17
View file @
039066d8
...
...
@@ -145,30 +145,30 @@ int epic_leds_get_rocket(int led)
return
ret
;
}
static
TimerHandle_t
blink_timer
[]
=
{
NULL
,
NULL
,
NULL
};
static
TimerHandle_t
blink_timer
[]
=
{
NULL
,
NULL
,
NULL
};
void
bTimerCallback
(
TimerHandle_t
blink_timer
)
{
uint32_t
id
=
(
uint32_t
)
pvTimerGetTimerID
(
blink_timer
);
epic_leds_set_rocket
(
id
,
0
);
uint32_t
id
=
(
uint32_t
)
pvTimerGetTimerID
(
blink_timer
);
epic_leds_set_rocket
(
id
,
0
);
}
void
epic_leds_blink_rocket
(
int
led
,
uint8_t
value
,
int
millis
)
{
int
ticks
=
millis
*
(
configTICK_RATE_HZ
/
1000
);
int32_t
id
=
led
;
if
(
blink_timer
[
id
]
==
NULL
)
{
blink_timer
[
id
]
=
xTimerCreate
(
"blinktimer"
,
ticks
,
pdFALSE
,
(
void
*
)
id
,
bTimerCallback
);
epic_leds_set_rocket
(
led
,
value
);
}
epic_leds_set_rocket
(
led
,
value
);
xTimerChangePeriod
(
blink_timer
[
id
],
ticks
,
0
);
int
ticks
=
millis
*
(
configTICK_RATE_HZ
/
1000
);
int32_t
id
=
led
;
if
(
blink_timer
[
id
]
==
NULL
)
{
blink_timer
[
id
]
=
xTimerCreate
(
"blinktimer"
,
ticks
,
pdFALSE
,
(
void
*
)
id
,
bTimerCallback
);
epic_leds_set_rocket
(
led
,
value
);
}
epic_leds_set_rocket
(
led
,
value
);
xTimerChangePeriod
(
blink_timer
[
id
],
ticks
,
0
);
}
void
epic_set_flashlight
(
bool
power
)
{
...
...
This diff is collapsed.
Click to expand it.
pycardium/modules/py/leds.py
+
1
−
0
View file @
039066d8
...
...
@@ -94,6 +94,7 @@ def get_rocket(led):
"""
return
sys_leds
.
get_rocket
(
led
)
def
blink_rocket
(
led
,
value
,
millis
):
"""
Let one of the rockets blink for a certain time without
...
...
This diff is collapsed.
Click to expand it.
pycardium/modules/sys_leds.c
+
5
−
3
View file @
039066d8
...
...
@@ -213,11 +213,12 @@ static mp_obj_t mp_leds_get_rocket(mp_obj_t led_in)
}
static
MP_DEFINE_CONST_FUN_OBJ_1
(
leds_get_rocket_obj
,
mp_leds_get_rocket
);
static
mp_obj_t
mp_leds_blink_rocket
(
mp_obj_t
led_in
,
mp_obj_t
value_in
,
mp_obj_t
time_in
)
static
mp_obj_t
mp_leds_blink_rocket
(
mp_obj_t
led_in
,
mp_obj_t
value_in
,
mp_obj_t
time_in
)
{
int
led
=
mp_obj_get_int
(
led_in
);
int
value
=
mp_obj_get_int
(
value_in
);
int
time
=
mp_obj_get_int
(
time_in
);
int
time
=
mp_obj_get_int
(
time_in
);
if
(
value
>
31
)
{
mp_raise_ValueError
(
"brightness must by < 32"
);
...
...
@@ -298,7 +299,8 @@ static const mp_rom_map_elem_t leds_module_globals_table[] = {
{
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_blink_rocket
),
MP_ROM_PTR
(
&
leds_blink_rocket_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_blink_rocket
),
MP_ROM_PTR
(
&
leds_blink_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