Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
fd379db2
Commit
fd379db2
authored
Oct 04, 2015
by
Paul Sokolovsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unix/modtime: Implement sleep_ms(), sleep_us().
parent
096d1e45
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
unix/modtime.c
unix/modtime.c
+14
-0
unix/qstrdefsport.h
unix/qstrdefsport.h
+2
-0
No files found.
unix/modtime.c
View file @
fd379db2
...
...
@@ -97,10 +97,24 @@ STATIC mp_obj_t mod_time_sleep(mp_obj_t arg) {
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
mod_time_sleep_obj
,
mod_time_sleep
);
STATIC
mp_obj_t
mod_time_sleep_ms
(
mp_obj_t
arg
)
{
usleep
(
mp_obj_get_int
(
arg
)
*
1000
);
return
mp_const_none
;
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
mod_time_sleep_ms_obj
,
mod_time_sleep_ms
);
STATIC
mp_obj_t
mod_time_sleep_us
(
mp_obj_t
arg
)
{
usleep
(
mp_obj_get_int
(
arg
));
return
mp_const_none
;
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
mod_time_sleep_us_obj
,
mod_time_sleep_us
);
STATIC
const
mp_map_elem_t
mp_module_time_globals_table
[]
=
{
{
MP_OBJ_NEW_QSTR
(
MP_QSTR___name__
),
MP_OBJ_NEW_QSTR
(
MP_QSTR_utime
)
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_clock
),
(
mp_obj_t
)
&
mod_time_clock_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_sleep
),
(
mp_obj_t
)
&
mod_time_sleep_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_sleep_ms
),
(
mp_obj_t
)
&
mod_time_sleep_ms_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_sleep_us
),
(
mp_obj_t
)
&
mod_time_sleep_us_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_time
),
(
mp_obj_t
)
&
mod_time_time_obj
},
};
...
...
unix/qstrdefsport.h
View file @
fd379db2
...
...
@@ -60,6 +60,8 @@ Q(utime)
Q
(
time
)
Q
(
clock
)
Q
(
sleep
)
Q
(
sleep_ms
)
Q
(
sleep_us
)
Q
(
socket
)
Q
(
sockaddr_in
)
...
...
Write
Preview
Markdown
is supported
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