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
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Marek
firmware
Commits
0d8be9c3
Verified
Commit
0d8be9c3
authored
5 years ago
by
rahix
Browse files
Options
Downloads
Patches
Plain Diff
feat(pycardium): Add RTC_ALARM interrupt number
Signed-off-by:
Rahix
<
rahix@rahix.de
>
parent
b4246ffd
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Documentation/pycardium/utime.rst
+19
-0
19 additions, 0 deletions
Documentation/pycardium/utime.rst
pycardium/modules/interrupt.c
+6
-1
6 additions, 1 deletion
pycardium/modules/interrupt.c
pycardium/modules/qstrdefs.h
+1
-0
1 addition, 0 deletions
pycardium/modules/qstrdefs.h
with
26 additions
and
1 deletion
Documentation/pycardium/utime.rst
+
19
−
0
View file @
0d8be9c3
...
...
@@ -65,3 +65,22 @@ alarm.
utime.alarm(alarm, minute_timer)
minute_timer(None)
Alternatively, you can register a callback using the interrupt module and
then call :py:func:`utime.alarm` without a ``callback`` parameter:
.. code-block:: python
import interrupt, utime
def 5_second_timer(x):
current = utime.time()
print("Current: " + str(current))
alarm = (current // 10) * 10 + 5
utime.alarm(alarm)
# This time, we need to register and enable the callback manually
interrupt.set_callback(interrupt.RTC_ALARM, 5_second_timer)
interrupt.enable_callback(interrupt.RTC_ALARM)
5_second_timer(None)
This diff is collapsed.
Click to expand it.
pycardium/modules/interrupt.c
+
6
−
1
View file @
0d8be9c3
...
...
@@ -81,7 +81,12 @@ static const mp_rom_map_elem_t interrupt_module_globals_table[] = {
MP_ROM_PTR
(
&
interrupt_enable_callback_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_disable_callback
),
MP_ROM_PTR
(
&
interrupt_disable_callback_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_BHI160
),
MP_OBJ_NEW_SMALL_INT
(
2
)
},
/* Interrupt Numbers */
{
MP_ROM_QSTR
(
MP_QSTR_BHI160
),
MP_OBJ_NEW_SMALL_INT
(
EPIC_INT_BHI160_TEST
)
},
{
MP_ROM_QSTR
(
MP_QSTR_RTC_ALARM
),
MP_OBJ_NEW_SMALL_INT
(
EPIC_INT_RTC_ALARM
)
},
};
static
MP_DEFINE_CONST_DICT
(
interrupt_module_globals
,
interrupt_module_globals_table
...
...
This diff is collapsed.
Click to expand it.
pycardium/modules/qstrdefs.h
+
1
−
0
View file @
0d8be9c3
...
...
@@ -34,6 +34,7 @@ Q(set_callback)
Q
(
enable_callback
)
Q
(
disable_callback
)
Q
(
BHI160
)
Q
(
RTC_ALARM
)
/* display */
Q
(
sys_display
)
...
...
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