Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
19b671c5
Commit
19b671c5
authored
Oct 29, 2015
by
Paul Sokolovsky
Browse files
stmhal/moduselect: Use mp_hal_ticks_ms().
parent
f4decdc4
Changes
1
Hide whitespace changes
Inline
Side-by-side
stmhal/moduselect.c
View file @
19b671c5
...
...
@@ -138,13 +138,13 @@ STATIC mp_obj_t select_select(uint n_args, const mp_obj_t *args) {
poll_map_add
(
&
poll_map
,
w_array
,
rwx_len
[
1
],
MP_IOCTL_POLL_WR
,
true
);
poll_map_add
(
&
poll_map
,
x_array
,
rwx_len
[
2
],
MP_IOCTL_POLL_ERR
|
MP_IOCTL_POLL_HUP
,
true
);
mp_uint_t
start_tick
=
HAL_GetTick
();
mp_uint_t
start_tick
=
mp_hal_ticks_ms
();
rwx_len
[
0
]
=
rwx_len
[
1
]
=
rwx_len
[
2
]
=
0
;
for
(;;)
{
// poll the objects
mp_uint_t
n_ready
=
poll_map_poll
(
&
poll_map
,
rwx_len
);
if
(
n_ready
>
0
||
(
timeout
!=
-
1
&&
HAL_GetTick
()
-
start_tick
>=
timeout
))
{
if
(
n_ready
>
0
||
(
timeout
!=
-
1
&&
mp_hal_ticks_ms
()
-
start_tick
>=
timeout
))
{
// one or more objects are ready, or we had a timeout
mp_obj_t
list_array
[
3
];
list_array
[
0
]
=
mp_obj_new_list
(
rwx_len
[
0
],
NULL
);
...
...
@@ -232,12 +232,12 @@ STATIC mp_obj_t poll_poll(uint n_args, const mp_obj_t *args) {
}
}
mp_uint_t
start_tick
=
HAL_GetTick
();
mp_uint_t
start_tick
=
mp_hal_ticks_ms
();
for
(;;)
{
// poll the objects
mp_uint_t
n_ready
=
poll_map_poll
(
&
self
->
poll_map
,
NULL
);
if
(
n_ready
>
0
||
(
timeout
!=
-
1
&&
HAL_GetTick
()
-
start_tick
>=
timeout
))
{
if
(
n_ready
>
0
||
(
timeout
!=
-
1
&&
mp_hal_ticks_ms
()
-
start_tick
>=
timeout
))
{
// one or more objects are ready, or we had a timeout
mp_obj_list_t
*
ret_list
=
mp_obj_new_list
(
n_ready
,
NULL
);
n_ready
=
0
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment