Browse Source

cc3200: time.sleep() now receives seconds, like CPython.

pull/1358/merge
Daniel Campora 9 years ago
parent
commit
5161239c9f
  1. 8
      cc3200/mods/modutime.c
  2. 8
      docs/library/time.rst

8
cc3200/mods/modutime.c

@ -122,10 +122,10 @@ STATIC mp_obj_t time_mktime(mp_obj_t tuple) {
MP_DEFINE_CONST_FUN_OBJ_1(time_mktime_obj, time_mktime); MP_DEFINE_CONST_FUN_OBJ_1(time_mktime_obj, time_mktime);
/// \function sleep(milliseconds) /// \function sleep(seconds)
/// Sleep for the given number of milliseconds. /// Sleep for the given number of seconds.
STATIC mp_obj_t time_sleep(mp_obj_t milliseconds_o) { STATIC mp_obj_t time_sleep(mp_obj_t seconds_o) {
HAL_Delay(mp_obj_get_int(milliseconds_o)); HAL_Delay(mp_obj_get_int(seconds_o) * 1000);
return mp_const_none; return mp_const_none;
} }
MP_DEFINE_CONST_FUN_OBJ_1(time_sleep_obj, time_sleep); MP_DEFINE_CONST_FUN_OBJ_1(time_sleep_obj, time_sleep);

8
docs/library/time.rst

@ -38,18 +38,12 @@ Functions
Sleep for the given number of seconds. Seconds can be a floating-point number to Sleep for the given number of seconds. Seconds can be a floating-point number to
sleep for a fractional number of seconds. sleep for a fractional number of seconds.
.. only:: port_esp8266 .. only:: port_esp8266 or port_wipy
.. function:: sleep(seconds) .. function:: sleep(seconds)
Sleep for the given number of seconds. Sleep for the given number of seconds.
.. only:: port_wipy
.. function:: sleep(milliseconds)
Sleep for the given number of milliseconds.
.. function:: time() .. function:: time()
Returns the number of seconds, as an integer, since 1/1/2000. Returns the number of seconds, as an integer, since 1/1/2000.

Loading…
Cancel
Save