Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
zenox
firmware
Commits
039066d8
Commit
039066d8
authored
Oct 04, 2019
by
zenox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
for annoyatron
parent
0f67e1d3
Pipeline
#4082
passed with stages
in 1 minute and 3 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
20 deletions
+23
-20
epicardium/modules/leds.c
epicardium/modules/leds.c
+17
-17
pycardium/modules/py/leds.py
pycardium/modules/py/leds.py
+1
-0
pycardium/modules/sys_leds.c
pycardium/modules/sys_leds.c
+5
-3
No files found.
epicardium/modules/leds.c
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
)
{
...
...
pycardium/modules/py/leds.py
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
...
...
pycardium/modules/sys_leds.c
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
)
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment