mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 08:47:28 +01:00
- Export micropython_port_should_interrupt and micropython_port_interruptible_msleep in Emscripten - Make micropython_port_interruptible_msleep available in a helper
21 lines
498 B
C++
21 lines
498 B
C++
extern "C" {
|
|
#include "modtime.h"
|
|
}
|
|
#include <ion/timing.h>
|
|
#include "../../helpers.h"
|
|
#include <py/smallint.h>
|
|
#include <py/runtime.h>
|
|
|
|
mp_obj_t modtime_sleep(mp_obj_t seconds_o) {
|
|
#if MICROPY_PY_BUILTINS_FLOAT
|
|
micropython_port_interruptible_msleep(1000 * mp_obj_get_float(seconds_o));
|
|
#else
|
|
micropython_port_interruptible_msleep(1000 * mp_obj_get_int(seconds_o));
|
|
#endif
|
|
return mp_const_none;
|
|
}
|
|
|
|
mp_obj_t modtime_monotonic() {
|
|
return mp_obj_new_float(Ion::Timing::millis() / 1000.0);
|
|
}
|