Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
François Revol
firmware
Commits
3527b3e9
Commit
3527b3e9
authored
Apr 26, 2020
by
zenox
Browse files
rename: blink→flash
parent
9d9a1c57
Changes
5
Hide whitespace changes
Inline
Side-by-side
epicardium/epicardium.h
View file @
3527b3e9
...
...
@@ -100,7 +100,7 @@ typedef _Bool bool;
#define API_LEDS_CLEAR_ALL 0x6d
#define API_LEDS_GET_ROCKET 0x6e
#define API_LEDS_GET 0x6f
#define API_LEDS_
BLINK
_ROCKET 0x72
#define API_LEDS_
FLASH
_ROCKET 0x72
#define API_VIBRA_SET 0x70
#define API_VIBRA_VIBRATE 0x71
...
...
@@ -620,17 +620,17 @@ API(API_LEDS_SET, void epic_leds_set(int led, uint8_t r, uint8_t g, uint8_t b));
API
(
API_LEDS_GET
,
int
epic_leds_get_rgb
(
int
led
,
uint8_t
*
rgb
));
/**
* Set one of the rockets to
blink
for a certain time.
* Set one of the rockets to
flash
for a certain time.
*
* :c:func:`epic_leds_
blink
_rocket` will set a timer for
blinking
of
the
rocket.
* :c:func:`epic_leds_
flash
_rocket` will set a timer for
the flash
of
a
rocket.
*
* :param int led: Number of rocket t
o let blink
* :param int led: Number of
the
rocket t
hat sould flash
* :param uint8_t value: brightness of the 'on'-state of this rocket ( 0 < value < 32)
* :param int millis: time in milliseconds the rocket
should be
'on'
* :param int millis: time in milliseconds
defining the duration of the flash (i.e. how long is
the rocket 'on'
)
*
* .. versionadded:: 1.
??
* .. versionadded:: 1.
16
*/
API
(
API_LEDS_
BLINK
_ROCKET
,
void
epic_leds_
blink
_rocket
(
int
led
,
uint8_t
valiue
,
int
millis
));
API
(
API_LEDS_
FLASH
_ROCKET
,
void
epic_leds_
flash
_rocket
(
int
led
,
uint8_t
valiue
,
int
millis
));
/**
* Set one of card10's RGB LEDs to a certain color in HSV format.
...
...
epicardium/modules/leds.c
View file @
3527b3e9
...
...
@@ -129,32 +129,32 @@ int epic_leds_get_rocket(int led)
return
ret
;
}
static
StaticTimer_t
blink
_timer_data
[
3
];
static
TimerHandle_t
blink
_timer
[]
=
{
NULL
,
NULL
,
NULL
};
static
StaticTimer_t
flash
_timer_data
[
3
];
static
TimerHandle_t
flash
_timer
[]
=
{
NULL
,
NULL
,
NULL
};
static
void
rocket_timer_callback
(
TimerHandle_t
blink
_timer
)
static
void
rocket_timer_callback
(
TimerHandle_t
flash
_timer
)
{
uint32_t
id
=
(
uint32_t
)
pvTimerGetTimerID
(
blink
_timer
);
uint32_t
id
=
(
uint32_t
)
pvTimerGetTimerID
(
flash
_timer
);
epic_leds_set_rocket
(
id
,
0
);
}
void
epic_leds_
blink
_rocket
(
int
led
,
uint8_t
value
,
int
millis
)
void
epic_leds_
flash
_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
]
=
xTimerCreateStatic
(
"
blink
timer"
,
if
(
flash
_timer
[
id
]
==
NULL
)
{
flash
_timer
[
id
]
=
xTimerCreateStatic
(
"
flash
timer"
,
ticks
,
pdFALSE
,
(
void
*
)
id
,
rocket_timer_callback
,
&
blink
_timer_data
[
id
]
&
flash
_timer_data
[
id
]
);
epic_leds_set_rocket
(
led
,
value
);
}
epic_leds_set_rocket
(
led
,
value
);
xTimerChangePeriod
(
blink
_timer
[
id
],
ticks
,
0
);
xTimerChangePeriod
(
flash
_timer
[
id
],
ticks
,
0
);
}
void
epic_set_flashlight
(
bool
power
)
{
...
...
pycardium/modules/py/leds.py
View file @
3527b3e9
...
...
@@ -95,9 +95,9 @@ def get_rocket(led):
return
sys_leds
.
get_rocket
(
led
)
def
blink
_rocket
(
led
,
value
,
millis
):
def
flash
_rocket
(
led
,
value
,
millis
):
"""
Let one of the rockets
blink
for a certain time without
Let one of the rockets
flash
for a certain time without
blocking the python interpreter.
:param int led: Choose your rocket!
...
...
@@ -106,7 +106,7 @@ def blink_rocket(led, value, millis):
.. versionadded:: 1.??
"""
return
sys_leds
.
blink
_rocket
(
led
,
value
,
millis
)
return
sys_leds
.
flash
_rocket
(
led
,
value
,
millis
)
def
dim_top
(
value
):
...
...
pycardium/modules/qstrdefs.h
View file @
3527b3e9
...
...
@@ -17,7 +17,7 @@ Q(set_all_hsv)
Q
(
set_flashlight
)
Q
(
set_rocket
)
Q
(
get_rocket
)
Q
(
blink
_rocket
)
Q
(
flash
_rocket
)
Q
(
set_powersave
)
Q
(
set_gamma
)
Q
(
dim_top
)
...
...
pycardium/modules/sys_leds.c
View file @
3527b3e9
...
...
@@ -214,7 +214,7 @@ 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
)
mp_leds_
flash
_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
);
...
...
@@ -224,10 +224,10 @@ mp_leds_blink_rocket(mp_obj_t led_in, mp_obj_t value_in, mp_obj_t time_in)
mp_raise_ValueError
(
"brightness must be < 32"
);
}
epic_leds_
blink
_rocket
(
led
,
value
,
time
);
epic_leds_
flash
_rocket
(
led
,
value
,
time
);
return
mp_const_none
;
}
static
MP_DEFINE_CONST_FUN_OBJ_3
(
leds_
blink
_rocket_obj
,
mp_leds_
blink
_rocket
);
static
MP_DEFINE_CONST_FUN_OBJ_3
(
leds_
flash
_rocket_obj
,
mp_leds_
flash
_rocket
);
static
mp_obj_t
mp_leds_dim_top
(
mp_obj_t
dim_in
)
{
...
...
@@ -299,8 +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_
flash
_rocket
),
MP_ROM_PTR
(
&
leds_
flash
_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
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment