Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
bbbbc263
Verified
Commit
bbbbc263
authored
5 years ago
by
ch3
Committed by
rahix
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add time module
parent
e84673c0
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
ports/card10/Makefile
+4
-2
4 additions, 2 deletions
ports/card10/Makefile
ports/card10/modutime.c
+30
-0
30 additions, 0 deletions
ports/card10/modutime.c
ports/card10/mpconfigport.h
+1
-0
1 addition, 0 deletions
ports/card10/mpconfigport.h
ports/card10/systick.c
+17
-0
17 additions, 0 deletions
ports/card10/systick.c
with
52 additions
and
2 deletions
ports/card10/Makefile
+
4
−
2
View file @
bbbbc263
...
...
@@ -45,6 +45,8 @@ SRC_C = \
main.c
\
uart_core.c
\
buzzer.c
\
modutime.c
\
systick.c
\
lib/utils/printf.c
\
lib/utils/stdout_helpers.c
\
lib/utils/pyexec.c
\
...
...
@@ -53,8 +55,8 @@ SRC_C = \
OBJ
=
$(
PY_O
)
$(
addprefix
$(
BUILD
)
/,
$(
SRC_C:.c
=
.o
))
SRC_QSTR
+=
buzzer.c
USER_C_MODULES
+=
buzzer.c
SRC_QSTR
+=
buzzer.c
modutime.c
USER_C_MODULES
+=
buzzer.c
modutime.c
# SDK compilation hack
...
...
This diff is collapsed.
Click to expand it.
ports/card10/modutime.c
0 → 100644
+
30
−
0
View file @
bbbbc263
#include
<stdio.h>
#include
<string.h>
#include
"py/runtime.h"
#include
"py/smallint.h"
#include
"py/obj.h"
#include
"lib/timeutils/timeutils.h"
#include
"extmod/utime_mphal.h"
STATIC
const
mp_rom_map_elem_t
time_module_globals_table
[]
=
{
{
MP_ROM_QSTR
(
MP_QSTR___name__
),
MP_ROM_QSTR
(
MP_QSTR_utime
)
},
{
MP_ROM_QSTR
(
MP_QSTR_sleep
),
MP_ROM_PTR
(
&
mp_utime_sleep_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_sleep_ms
),
MP_ROM_PTR
(
&
mp_utime_sleep_ms_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_sleep_us
),
MP_ROM_PTR
(
&
mp_utime_sleep_us_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_ticks_ms
),
MP_ROM_PTR
(
&
mp_utime_ticks_ms_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_ticks_us
),
MP_ROM_PTR
(
&
mp_utime_ticks_us_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_ticks_cpu
),
MP_ROM_PTR
(
&
mp_utime_ticks_cpu_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_ticks_add
),
MP_ROM_PTR
(
&
mp_utime_ticks_add_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_ticks_diff
),
MP_ROM_PTR
(
&
mp_utime_ticks_diff_obj
)
},
};
STATIC
MP_DEFINE_CONST_DICT
(
time_module_globals
,
time_module_globals_table
);
const
mp_obj_module_t
mp_module_utime
=
{
.
base
=
{
&
mp_type_module
},
.
globals
=
(
mp_obj_dict_t
*
)
&
time_module_globals
,
};
// Register the module to make it available in Python
MP_REGISTER_MODULE
(
MP_QSTR_utime
,
mp_module_utime
,
MODULE_UTIME_ENABLED
);
This diff is collapsed.
Click to expand it.
ports/card10/mpconfigport.h
+
1
−
0
View file @
bbbbc263
...
...
@@ -60,6 +60,7 @@
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
#define MICROPY_PY_UTIME_MP_HAL (1)
#define MODULE_BUZZER_ENABLED (1)
#define MODULE_UTIME_ENABLED (1)
// type definitions for the specific machine
...
...
This diff is collapsed.
Click to expand it.
ports/card10/systick.c
0 → 100644
+
17
−
0
View file @
bbbbc263
#include
"py/mpconfig.h"
void
mp_hal_delay_ms
(
mp_uint_t
ms
)
{
mxc_delay
(
ms
*
1000
);
// TODO check return value
}
void
mp_hal_delay_us
(
mp_uint_t
us
)
{
mxc_delay
(
us
);
// TODO check return value
}
mp_uint_t
mp_hal_ticks_ms
(
void
)
{}
mp_uint_t
mp_hal_ticks_us
(
void
)
{}
mp_uint_t
mp_hal_ticks_cpu
(
void
)
{}
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