From 24630011b11314864f3a18b7e15481e48597b363 Mon Sep 17 00:00:00 2001 From: Damien Nicolet Date: Sat, 10 Nov 2018 00:00:03 +0100 Subject: [PATCH] [code] keep only CPython equivalent functions in utime module --- apps/apps_container.cpp | 2 +- apps/code/catalog.de.i18n | 9 +--- apps/code/catalog.en.i18n | 9 +--- apps/code/catalog.es.i18n | 9 +--- apps/code/catalog.fr.i18n | 9 +--- apps/code/catalog.pt.i18n | 9 +--- apps/code/catalog.universal.i18n | 8 +-- apps/code/python_toolbox.cpp | 10 ++-- build/toolchain.emscripten.mak | 3 +- ion/include/ion/timing.h | 4 +- ion/src/blackbox/ion.cpp | 4 +- ion/src/device/backlight.cpp | 8 +-- ion/src/device/bench/command/suspend.cpp | 2 +- ion/src/device/console.cpp | 2 +- ion/src/device/device.cpp | 6 +-- ion/src/device/display.cpp | 8 +-- ion/src/device/events.cpp | 4 +- ion/src/device/keyboard.h | 2 +- ion/src/device/power.cpp | 2 +- ion/src/emscripten/main.cpp | 4 +- ion/src/simulator/init.cpp | 4 +- python/port/genhdr/qstrdefs.in.h | 8 +-- python/src/extmod/modutime.c | 68 +++--------------------- quiz/src/runner.cpp | 4 +- 24 files changed, 53 insertions(+), 145 deletions(-) diff --git a/apps/apps_container.cpp b/apps/apps_container.cpp index 162be2380..368818d0c 100644 --- a/apps/apps_container.cpp +++ b/apps/apps_container.cpp @@ -257,7 +257,7 @@ void AppsContainer::displayExamModePopUp(bool activate) { void AppsContainer::shutdownDueToLowBattery() { while (Ion::Battery::level() == Ion::Battery::Charge::EMPTY) { m_emptyBatteryWindow.redraw(true); - Ion::mssleep(3000); + Ion::msleep(3000); Ion::Power::suspend(); } window()->redraw(true); diff --git a/apps/code/catalog.de.i18n b/apps/code/catalog.de.i18n index 0447fe01f..1ca613f5a 100644 --- a/apps/code/catalog.de.i18n +++ b/apps/code/catalog.de.i18n @@ -96,10 +96,5 @@ PythonUniform = "Floating point number in [a,b]" PythonImportFromTime = "Import time module" PythonImportTime = "Import time module" PythonTimeFunction = "time module function prefix" -PythonTimeSleepMs = "Sleep for the given duration" -PythonTimeSleep = "Sleep for the given duration" -PythonTimeSleepUs = "Sleep for the given duration" -PythonTimeTicksAdd = "Offset ticks value" -PythonTimeTicksDiff = "Measure ticks difference" -PythonTimeTicksMs = "Increasing millisecond counter" -PythonTimeTicksUs = "Increasing microsecond counter" +PythonTimeSleep = "Sleep for the given seconds" +PythonTimeClock = "Increasing seconds counter" diff --git a/apps/code/catalog.en.i18n b/apps/code/catalog.en.i18n index 2ced55b3c..ed19f39f5 100644 --- a/apps/code/catalog.en.i18n +++ b/apps/code/catalog.en.i18n @@ -96,10 +96,5 @@ PythonUniform = "Floating point number in [a,b]" PythonImportFromTime = "Import time module" PythonImportTime = "Import time module" PythonTimeFunction = "time module function prefix" -PythonTimeSleepMs = "Sleep for the given duration" -PythonTimeSleep = "Sleep for the given duration" -PythonTimeSleepUs = "Sleep for the given duration" -PythonTimeTicksAdd = "Offset ticks value" -PythonTimeTicksDiff = "Measure ticks difference" -PythonTimeTicksMs = "Increasing millisecond counter" -PythonTimeTicksUs = "Increasing microsecond counter" +PythonTimeSleep = "Sleep for the given seconds" +PythonTimeClock = "Increasing seconds counter" diff --git a/apps/code/catalog.es.i18n b/apps/code/catalog.es.i18n index 2ced55b3c..ed19f39f5 100644 --- a/apps/code/catalog.es.i18n +++ b/apps/code/catalog.es.i18n @@ -96,10 +96,5 @@ PythonUniform = "Floating point number in [a,b]" PythonImportFromTime = "Import time module" PythonImportTime = "Import time module" PythonTimeFunction = "time module function prefix" -PythonTimeSleepMs = "Sleep for the given duration" -PythonTimeSleep = "Sleep for the given duration" -PythonTimeSleepUs = "Sleep for the given duration" -PythonTimeTicksAdd = "Offset ticks value" -PythonTimeTicksDiff = "Measure ticks difference" -PythonTimeTicksMs = "Increasing millisecond counter" -PythonTimeTicksUs = "Increasing microsecond counter" +PythonTimeSleep = "Sleep for the given seconds" +PythonTimeClock = "Increasing seconds counter" diff --git a/apps/code/catalog.fr.i18n b/apps/code/catalog.fr.i18n index 04c3502cf..d8662632f 100644 --- a/apps/code/catalog.fr.i18n +++ b/apps/code/catalog.fr.i18n @@ -96,10 +96,5 @@ PythonUniform = "Nombre décimal dans [a,b]" PythonImportFromTime = "Importation du module time" PythonImportTime = "Importation du module time" PythonTimeFunction = "Prefixe fonction du module time" -PythonTimeSleep = "Effectuer une pause" -PythonTimeSleepMs = "Effectuer une pause" -PythonTimeSleepUs = "Effectuer une pause" -PythonTimeTicksAdd = "Ajouter une valeur à un compteur" -PythonTimeTicksDiff = "Différence entre compteurs" -PythonTimeTicksMs = "Compteur croissant (millisecondes)" -PythonTimeTicksUs = "Compteur croissant (microsecondes)" +PythonTimeSleep = "Effectuer une pause (secondes)" +PythonTimeClock = "Compteur croissant (secondes)" diff --git a/apps/code/catalog.pt.i18n b/apps/code/catalog.pt.i18n index 3e06afd7e..41d399937 100644 --- a/apps/code/catalog.pt.i18n +++ b/apps/code/catalog.pt.i18n @@ -96,10 +96,5 @@ PythonUniform = "Floating point number in [a,b]" PythonImportFromTime = "Import time module" PythonImportTime = "Import time module" PythonTimeFunction = "time module function prefix" -PythonTimeSleepMs = "Sleep for the given duration" -PythonTimeSleep = "Sleep for the given duration" -PythonTimeSleepUs = "Sleep for the given duration" -PythonTimeTicksAdd = "Offset ticks value" -PythonTimeTicksDiff = "Measure ticks difference" -PythonTimeTicksMs = "Increasing millisecond counter" -PythonTimeTicksUs = "Increasing microsecond counter" +PythonTimeSleep = "Sleep for the given seconds" +PythonTimeClock = "Increasing seconds counter" diff --git a/apps/code/catalog.universal.i18n b/apps/code/catalog.universal.i18n index 91d8f15d4..043652fda 100644 --- a/apps/code/catalog.universal.i18n +++ b/apps/code/catalog.universal.i18n @@ -108,11 +108,7 @@ PythonCommandImportFromTime = "from time import *" PythonCommandImportTime = "import time" PythonCommandTimeFunction = "time.function" PythonCommandTimeFunctionWithoutArg = "time.ø" -PythonCommandTimeSleepMs = "sleep_ms(milliseconds)" PythonCommandTimeSleep = "sleep(seconds)" -PythonCommandTimeSleepUs = "sleep_us(microseconds)" -PythonCommandTimeTicksAdd = "ticks_add(ticks,delta)" -PythonCommandTimeTicksDiff = "ticks_diff(end,start)" -PythonCommandTimeTicksMs = "ticks_ms()" -PythonCommandTimeTicksUs = "ticks_us()" +PythonCommandTimeClock = "clock()" +PythonCommandTimeTime = "time()" TimeModule = "time" diff --git a/apps/code/python_toolbox.cpp b/apps/code/python_toolbox.cpp index c628c8b12..6eb88d72a 100644 --- a/apps/code/python_toolbox.cpp +++ b/apps/code/python_toolbox.cpp @@ -21,7 +21,7 @@ static constexpr int loopsAndTestsChildrenCount = 4; static constexpr int menuChildrenCount = 4; static constexpr int modulesChildrenCount = 5; static constexpr int whileLoopChildrenCount = 1; -static constexpr int TimeModuleChildrenCount = 10; +static constexpr int TimeModuleChildrenCount = 6; const ToolboxMessageTree forLoopChildren[forLoopChildrenCount] = { @@ -129,12 +129,8 @@ const ToolboxMessageTree TimeModuleChildren[TimeModuleChildrenCount] = { ToolboxMessageTree(I18n::Message::PythonCommandImportFromTime, I18n::Message::PythonImportFromTime, I18n::Message::PythonCommandImportFromTime), ToolboxMessageTree(I18n::Message::PythonCommandTimeFunction, I18n::Message::PythonTimeFunction, I18n::Message::PythonCommandTimeFunctionWithoutArg), ToolboxMessageTree(I18n::Message::PythonCommandTimeSleep, I18n::Message::PythonTimeSleep, I18n::Message::PythonCommandTimeSleep), - ToolboxMessageTree(I18n::Message::PythonCommandTimeSleepMs, I18n::Message::PythonTimeSleepMs, I18n::Message::PythonCommandTimeSleepMs), - ToolboxMessageTree(I18n::Message::PythonCommandTimeSleepUs, I18n::Message::PythonTimeSleepUs, I18n::Message::PythonCommandTimeSleepUs), - ToolboxMessageTree(I18n::Message::PythonCommandTimeTicksMs, I18n::Message::PythonTimeTicksMs, I18n::Message::PythonCommandTimeTicksMs), - ToolboxMessageTree(I18n::Message::PythonCommandTimeTicksUs, I18n::Message::PythonTimeTicksUs, I18n::Message::PythonCommandTimeTicksUs), - ToolboxMessageTree(I18n::Message::PythonCommandTimeTicksDiff, I18n::Message::PythonTimeTicksDiff, I18n::Message::PythonCommandTimeTicksDiff), - ToolboxMessageTree(I18n::Message::PythonCommandTimeTicksAdd, I18n::Message::PythonTimeTicksAdd, I18n::Message::PythonCommandTimeTicksAdd), + ToolboxMessageTree(I18n::Message::PythonCommandTimeClock, I18n::Message::PythonTimeClock, I18n::Message::PythonCommandTimeClock), + ToolboxMessageTree(I18n::Message::PythonCommandTimeTime, I18n::Message::PythonTimeClock, I18n::Message::PythonCommandTimeTime) }; const ToolboxMessageTree CMathModuleChildren[CMathModuleChildrenCount] = { diff --git a/build/toolchain.emscripten.mak b/build/toolchain.emscripten.mak index de1cc514c..72d1031f5 100644 --- a/build/toolchain.emscripten.mak +++ b/build/toolchain.emscripten.mak @@ -74,8 +74,7 @@ _mp_execute_bytecode \ _mp_hal_input \ _mp_import_name \ _mp_parse_compile_execute \ -_mssleep \ -_ussleep +_msleep EMTERPRETIFY_WHITELIST = $(foreach sym,$(EMSCRIPTEN_ASYNC_SYMBOLS),"$(sym)",)END EMFLAGS = -s PRECISE_F32=1 -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -s EMTERPRETIFY_WHITELIST='[$(EMTERPRETIFY_WHITELIST:,END=)]' diff --git a/ion/include/ion/timing.h b/ion/include/ion/timing.h index a6c6565f0..028d4e588 100644 --- a/ion/include/ion/timing.h +++ b/ion/include/ion/timing.h @@ -4,6 +4,7 @@ #ifdef __cplusplus #define EXTERNC extern "C" namespace Ion { +void usleep(long us); #else #define EXTERNC #endif @@ -11,8 +12,7 @@ namespace Ion { EXTERNC uint32_t millis(); EXTERNC uint32_t micros(); -EXTERNC void mssleep(long ms); -EXTERNC void ussleep(long us); +EXTERNC void msleep(long ms); #ifdef __cplusplus } diff --git a/ion/src/blackbox/ion.cpp b/ion/src/blackbox/ion.cpp index 59c3edb86..1750cdfdb 100644 --- a/ion/src/blackbox/ion.cpp +++ b/ion/src/blackbox/ion.cpp @@ -1,8 +1,8 @@ #include #include -void Ion::mssleep(long ms) { +void Ion::msleep(long ms) { } -void Ion::ussleep(long us) { +void Ion::usleep(long us) { } diff --git a/ion/src/device/backlight.cpp b/ion/src/device/backlight.cpp index 22bb30d39..ad71b85d1 100644 --- a/ion/src/device/backlight.cpp +++ b/ion/src/device/backlight.cpp @@ -45,12 +45,12 @@ void shutdown() { void suspend() { GPIOC.ODR()->set(6, false); - mssleep(3); // Might not need to be blocking + msleep(3); // Might not need to be blocking } void resume() { GPIOC.ODR()->set(6, true); - ussleep(50); + usleep(50); uint8_t level = sLevel; sLevel = 0xF; setLevel(level); @@ -74,9 +74,9 @@ uint8_t level() { void sendPulses(int n) { for (int i=0; iset(6, false); - ussleep(20); + usleep(20); GPIOC.ODR()->set(6, true); - ussleep(20); + usleep(20); } } diff --git a/ion/src/device/bench/command/suspend.cpp b/ion/src/device/bench/command/suspend.cpp index 63dd53543..27666921d 100644 --- a/ion/src/device/bench/command/suspend.cpp +++ b/ion/src/device/bench/command/suspend.cpp @@ -12,7 +12,7 @@ void Suspend(const char * input) { return; } reply(sOK); - Ion::mssleep(100); + Ion::msleep(100); Ion::Power::suspend(); } diff --git a/ion/src/device/console.cpp b/ion/src/device/console.cpp index 05d48e7e9..04d824589 100644 --- a/ion/src/device/console.cpp +++ b/ion/src/device/console.cpp @@ -63,7 +63,7 @@ void shutdown() { bool peerConnected() { RxPin.group().PUPDR()->setPull(RxPin.pin(), GPIO::PUPDR::Pull::Down); RxPin.group().MODER()->setMode(RxPin.pin(), GPIO::MODER::Mode::Input); - mssleep(1); + msleep(1); bool result = RxPin.group().IDR()->get(RxPin.pin()); RxPin.group().PUPDR()->setPull(RxPin.pin(), GPIO::PUPDR::Pull::None); RxPin.group().MODER()->setMode(RxPin.pin(), GPIO::MODER::Mode::AlternateFunction); diff --git a/ion/src/device/device.cpp b/ion/src/device/device.cpp index 0ccdca626..a140a8abc 100644 --- a/ion/src/device/device.cpp +++ b/ion/src/device/device.cpp @@ -24,16 +24,16 @@ extern "C" { // Public Ion methods -/* TODO: The delay methods 'mssleep' and 'ussleep' are currently dependent on the +/* TODO: The delay methods 'msleep' and 'usleep' are currently dependent on the * optimizations chosen by the compiler. To prevent that and to gain in * precision, we could use the controller cycle counter (Systick). */ -void Ion::mssleep(long ms) { +void Ion::msleep(long ms) { for (volatile long i=0; i<8852*ms; i++) { __asm volatile("nop"); } } -void Ion::ussleep(long us) { +void Ion::usleep(long us) { for (volatile long i=0; i<9*us; i++) { __asm volatile("nop"); } diff --git a/ion/src/device/display.cpp b/ion/src/device/display.cpp index 65861a604..717231773 100644 --- a/ion/src/device/display.cpp +++ b/ion/src/device/display.cpp @@ -162,7 +162,7 @@ void initGPIO() { TearingEffectPin.group().MODER()->setMode(TearingEffectPin.pin(), GPIO::MODER::Mode::Input); TearingEffectPin.group().PUPDR()->setPull(TearingEffectPin.pin(), GPIO::PUPDR::Pull::None); - mssleep(120); + msleep(120); } @@ -247,10 +247,10 @@ void shutdownFSMC() { void initPanel() { send_command(Command::Reset); - mssleep(5); + msleep(5); send_command(Command::SleepOut); - mssleep(5); + msleep(5); send_command(Command::PixelFormatSet, 0x05); send_command(Command::TearingEffectLineOn, 0x00); @@ -262,7 +262,7 @@ void initPanel() { void shutdownPanel() { send_command(Command::DisplayOff); send_command(Command::SleepIn); - mssleep(5); + msleep(5); } void setDrawingArea(KDRect r, Orientation o) { diff --git a/ion/src/device/events.cpp b/ion/src/device/events.cpp index 18a63aab1..7f1443566 100644 --- a/ion/src/device/events.cpp +++ b/ion/src/device/events.cpp @@ -6,11 +6,11 @@ namespace Events { static bool sleepWithTimeout(int duration, int * timeout) { if (*timeout >= duration) { - mssleep(duration); + msleep(duration); *timeout -= duration; return false; } else { - mssleep(*timeout); + msleep(*timeout); *timeout = 0; return true; } diff --git a/ion/src/device/keyboard.h b/ion/src/device/keyboard.h index e4495b8fd..9d9aa388a 100644 --- a/ion/src/device/keyboard.h +++ b/ion/src/device/keyboard.h @@ -56,7 +56,7 @@ inline void activateRow(uint8_t row) { Device::RowGPIO.ODR()->setBitRange(9, 0, rowState); // TODO: 100 us seems to work, but wasn't really calculated - ussleep(100); + usleep(100); } inline bool columnIsActive(uint8_t column) { diff --git a/ion/src/device/power.cpp b/ion/src/device/power.cpp index 860b76480..021d75cc6 100644 --- a/ion/src/device/power.cpp +++ b/ion/src/device/power.cpp @@ -29,7 +29,7 @@ void Ion::Power::suspend(bool checkIfPowerKeyReleased) { /* Update LEDS * if the standby mode was stopped due to a "stop charging" event, we wait * a while to be sure that the plug state of the USB is up-to-date. */ - mssleep(200); + msleep(200); //Ion::LED::setCharging(Ion::USB::isPlugged(), Ion::Battery::isCharging()); #endif diff --git a/ion/src/emscripten/main.cpp b/ion/src/emscripten/main.cpp index 09f840e87..0da3ff2ba 100644 --- a/ion/src/emscripten/main.cpp +++ b/ion/src/emscripten/main.cpp @@ -20,10 +20,10 @@ int main(int argc, char * argv[]) { return 0; } -void Ion::mssleep(long ms) { +void Ion::msleep(long ms) { emscripten_sleep(ms); } -void Ion::ussleep(long us) { +void Ion::usleep(long us) { emscripten_sleep(us/1000); } diff --git a/ion/src/simulator/init.cpp b/ion/src/simulator/init.cpp index c09202f95..bcc121229 100644 --- a/ion/src/simulator/init.cpp +++ b/ion/src/simulator/init.cpp @@ -104,7 +104,7 @@ Ion::Events::Event Ion::Events::getEvent(int * timeout) { #include -void Ion::mssleep(long ms) { +void Ion::msleep(long ms) { auto start = std::chrono::high_resolution_clock::now(); while (true) { sDisplay->redraw(); @@ -117,7 +117,7 @@ void Ion::mssleep(long ms) { } } -void Ion::ussleep(long us) { +void Ion::usleep(long us) { auto start = std::chrono::high_resolution_clock::now(); while (true) { sDisplay->redraw(); diff --git a/python/port/genhdr/qstrdefs.in.h b/python/port/genhdr/qstrdefs.in.h index 1d3c835af..6f0e13309 100644 --- a/python/port/genhdr/qstrdefs.in.h +++ b/python/port/genhdr/qstrdefs.in.h @@ -27,12 +27,8 @@ Q(set_pixel) // utime QSTRs Q(time) Q(sleep) -Q(sleep_ms) -Q(sleep_us) -Q(ticks_ms) -Q(ticks_us) -Q(ticks_add) -Q(ticks_diff) +Q(time) +Q(clock) // MicroPython QSTRs Q() diff --git a/python/src/extmod/modutime.c b/python/src/extmod/modutime.c index 254ff3071..51d8a80e7 100644 --- a/python/src/extmod/modutime.c +++ b/python/src/extmod/modutime.c @@ -35,14 +35,7 @@ void delay_ms(mp_uint_t delay) { uint32_t start = millis(); while (millis() - start < delay && !micropython_port_should_interrupt(true)) { - mssleep(1); - } -} - -void delay_us(mp_uint_t delay) { - uint32_t start = micros(); - while (micros() - start < delay && !micropython_port_should_interrupt(false)) { - ussleep(1); + msleep(1); } } @@ -56,64 +49,17 @@ STATIC mp_obj_t time_sleep(mp_obj_t seconds_o) { } MP_DEFINE_CONST_FUN_OBJ_1(mp_utime_sleep_obj, time_sleep); -STATIC mp_obj_t time_sleep_ms(mp_obj_t arg) { - mp_int_t ms = mp_obj_get_int(arg); - if (ms > 0) { - delay_ms(ms); - } - return mp_const_none; +STATIC mp_obj_t time_clock(void) { + return mp_obj_new_float(millis() / 1000.0); } -MP_DEFINE_CONST_FUN_OBJ_1(mp_utime_sleep_ms_obj, time_sleep_ms); - -STATIC mp_obj_t time_sleep_us(mp_obj_t arg) { - mp_int_t us = mp_obj_get_int(arg); - if (us > 0) { - delay_us(us); - } - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(mp_utime_sleep_us_obj, time_sleep_us); - -STATIC mp_obj_t time_ticks_ms(void) { - return MP_OBJ_NEW_SMALL_INT(millis() & (MICROPY_PY_UTIME_TICKS_PERIOD - 1)); -} -MP_DEFINE_CONST_FUN_OBJ_0(mp_utime_ticks_ms_obj, time_ticks_ms); - -STATIC mp_obj_t time_ticks_us(void) { - return MP_OBJ_NEW_SMALL_INT(micros() & (MICROPY_PY_UTIME_TICKS_PERIOD - 1)); -} -MP_DEFINE_CONST_FUN_OBJ_0(mp_utime_ticks_us_obj, time_ticks_us); - -STATIC mp_obj_t time_ticks_diff(mp_obj_t end_in, mp_obj_t start_in) { - // we assume that the arguments come from ticks_xx so are small ints - mp_uint_t start = MP_OBJ_SMALL_INT_VALUE(start_in); - mp_uint_t end = MP_OBJ_SMALL_INT_VALUE(end_in); - // Optimized formula avoiding if conditions. We adjust difference "forward", - // wrap it around and adjust back. - mp_int_t diff = ((end - start + MICROPY_PY_UTIME_TICKS_PERIOD / 2) & (MICROPY_PY_UTIME_TICKS_PERIOD - 1)) - - MICROPY_PY_UTIME_TICKS_PERIOD / 2; - return MP_OBJ_NEW_SMALL_INT(diff); -} -MP_DEFINE_CONST_FUN_OBJ_2(mp_utime_ticks_diff_obj, time_ticks_diff); - -STATIC mp_obj_t time_ticks_add(mp_obj_t ticks_in, mp_obj_t delta_in) { - // we assume that first argument come from ticks_xx so is small int - mp_uint_t ticks = MP_OBJ_SMALL_INT_VALUE(ticks_in); - mp_uint_t delta = mp_obj_get_int(delta_in); - return MP_OBJ_NEW_SMALL_INT((ticks + delta) & (MICROPY_PY_UTIME_TICKS_PERIOD - 1)); -} -MP_DEFINE_CONST_FUN_OBJ_2(mp_utime_ticks_add_obj, time_ticks_add); +MP_DEFINE_CONST_FUN_OBJ_0(mp_utime_time_obj, time_clock); +MP_DEFINE_CONST_FUN_OBJ_0(mp_utime_clock_obj, time_clock); STATIC const mp_rom_map_elem_t time_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_time) }, - { 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_add), MP_ROM_PTR(&mp_utime_ticks_add_obj) }, - { MP_ROM_QSTR(MP_QSTR_ticks_diff), MP_ROM_PTR(&mp_utime_ticks_diff_obj) }, + { MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&mp_utime_time_obj) }, + { MP_ROM_QSTR(MP_QSTR_clock), MP_ROM_PTR(&mp_utime_clock_obj) }, }; STATIC MP_DEFINE_CONST_DICT(time_module_globals, time_module_globals_table); diff --git a/quiz/src/runner.cpp b/quiz/src/runner.cpp index be0a08c59..b3dbd1a32 100644 --- a/quiz/src/runner.cpp +++ b/quiz/src/runner.cpp @@ -39,7 +39,7 @@ static inline void ion_main_inner() { quiz_print("ALL TESTS FINISHED"); #if !QUIZ_USE_CONSOLE while (1) { - Ion::mssleep(1000); + Ion::msleep(1000); } #endif } @@ -59,7 +59,7 @@ void ion_main(int argc, char * argv[]) { quiz_assert(false); #if !QUIZ_USE_CONSOLE while (1) { - Ion::mssleep(1000); + Ion::msleep(1000); } #endif }