Skip to content
GitLab
Menu
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
d739f593
Verified
Commit
d739f593
authored
Jun 19, 2019
by
Rahix
Browse files
feat(pycardium): Add leds module
Signed-off-by:
Rahix
<
rahix@rahix.de
>
parent
0acc3fe5
Changes
4
Hide whitespace changes
Inline
Side-by-side
pycardium/meson.build
View file @
d739f593
...
...
@@ -2,6 +2,7 @@ name = 'pycardium'
modsrc = files(
'modules/utime.c',
'modules/leds.c',
)
#################################
...
...
pycardium/modules/leds.c
0 → 100644
View file @
d739f593
#include
"py/obj.h"
#include
"epicardium.h"
static
mp_obj_t
mp_leds_set
(
size_t
n_args
,
const
mp_obj_t
*
args
)
{
int
led
=
mp_obj_get_int
(
args
[
0
]);
uint8_t
r
=
mp_obj_get_int
(
args
[
1
]);
uint8_t
g
=
mp_obj_get_int
(
args
[
2
]);
uint8_t
b
=
mp_obj_get_int
(
args
[
3
]);
epic_leds_set
(
led
,
r
,
g
,
b
);
return
mp_const_none
;
}
static
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
leds_set_obj
,
4
,
4
,
mp_leds_set
);
static
const
mp_rom_map_elem_t
leds_module_globals_table
[]
=
{
{
MP_ROM_QSTR
(
MP_QSTR___name__
),
MP_ROM_QSTR
(
MP_QSTR_leds
)},
{
MP_ROM_QSTR
(
MP_QSTR_set
),
MP_ROM_PTR
(
&
leds_set_obj
)},
};
static
MP_DEFINE_CONST_DICT
(
leds_module_globals
,
leds_module_globals_table
);
const
mp_obj_module_t
leds_module
=
{
.
base
=
{
&
mp_type_module
},
.
globals
=
(
mp_obj_dict_t
*
)
&
leds_module_globals
,
};
/* Register the module to make it available in Python */
MP_REGISTER_MODULE
(
MP_QSTR_leds
,
leds_module
,
MODULE_LEDS_ENABLED
);
pycardium/modules/qstrdefs.h
View file @
d739f593
#include
"py/mpconfig.h"
/* leds */
Q
(
leds
)
/* utime */
Q
(
utime
)
Q
(
sleep
)
...
...
pycardium/mpconfigport.h
View file @
d739f593
...
...
@@ -21,6 +21,7 @@
/* Modules */
#define MODULE_UTIME_ENABLED (1)
#define MODULE_LEDS_ENABLED (1)
/*
* This port is intended to be 32-bit, but unfortunately, int32_t for
...
...
Write
Preview
Supports
Markdown
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