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
402fa11e
Commit
402fa11e
authored
5 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
fix(api): keep list of python callbacks
parent
85ce625a
No related branches found
No related tags found
No related merge requests found
Pipeline
#1309
passed
5 years ago
Stage: build
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pycardium/modules/interrupt.c
+12
-10
12 additions, 10 deletions
pycardium/modules/interrupt.c
with
12 additions
and
10 deletions
pycardium/modules/interrupt.c
+
12
−
10
View file @
402fa11e
...
...
@@ -5,23 +5,23 @@
#include
"api/common.h"
#include
"mphalport.h"
mp_obj_t
bhi160_callback
=
NULL
;
mp_obj_t
callbacks
[
API_INT_MAX
+
1
]
=
{
0
,
};
static
void
interrupt_set
(
api_int_id_t
id
,
mp_obj_t
func
)
{
// TODO: maintain list of interrupts callbacks
if
(
id
==
API_INT_BHI160
)
{
bhi160_callback
=
func
;
if
(
id
<=
API_INT_MAX
)
{
callbacks
[
id
]
=
func
;
}
}
void
api_interrupt_handler_catch_all
(
api_int_id_t
id
)
{
// TODO: iterate over registered callbacks
if
(
id
==
API_INT_BHI160
)
{
if
(
bhi160_callback
)
{
if
(
id
<=
API_INT_MAX
)
{
if
(
callbacks
[
id
])
{
mp_sched_schedule
(
bhi160_
callback
,
MP_OBJ_NEW_SMALL_INT
(
0
)
callback
s
[
id
]
,
MP_OBJ_NEW_SMALL_INT
(
id
)
);
}
}
...
...
@@ -52,8 +52,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(
STATIC
const
mp_rom_map_elem_t
interrupt_module_globals_table
[]
=
{
{
MP_ROM_QSTR
(
MP_QSTR___name__
),
MP_ROM_QSTR
(
MP_QSTR_interrupt
)
},
{
MP_ROM_QSTR
(
MP_QSTR_set_callback
),
MP_ROM_PTR
(
&
interrupt_set_callback_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_enable_callback
),
MP_ROM_PTR
(
&
interrupt_enable_callback_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_set_callback
),
MP_ROM_PTR
(
&
interrupt_set_callback_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_enable_callback
),
MP_ROM_PTR
(
&
interrupt_enable_callback_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_BHI160
),
MP_OBJ_NEW_SMALL_INT
(
2
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
...
...
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