diff --git a/libs/microbit/basic.cpp b/libs/microbit/basic.cpp index ebfd5dc4..15a4a97d 100644 --- a/libs/microbit/basic.cpp +++ b/libs/microbit/basic.cpp @@ -58,7 +58,7 @@ namespace basic { int l = s.length(); if (l == 0) { uBit.display.clear(); - uBit.sleep(interval * 5); + fiber_sleep(interval * 5); } else if (l > 1) { uBit.display.scroll(s, interval); } else { @@ -98,7 +98,7 @@ namespace basic { void forever_stub(void *a) { while (true) { runAction0((Action)a); - uBit.sleep(20); + fiber_sleep(20); } } @@ -123,6 +123,6 @@ namespace basic { //% async block="pause (ms) %pause" //% blockId=device_pause icon="\uf110" void pause(int ms) { - uBit.sleep(ms); + fiber_sleep(ms); } } diff --git a/libs/microbit/control.cpp b/libs/microbit/control.cpp index 0e838567..f228eb98 100644 --- a/libs/microbit/control.cpp +++ b/libs/microbit/control.cpp @@ -132,7 +132,7 @@ namespace control { //% weight=30 async help=control/reset //% blockId="control_reset" block="reset" void reset() { - uBit.reset(); + microbit_reset(); } /** diff --git a/libs/microbit/core.cpp b/libs/microbit/core.cpp index e9ec6f82..5179f490 100644 --- a/libs/microbit/core.cpp +++ b/libs/microbit/core.cpp @@ -1,6 +1,7 @@ #include "ksbit.h" #include + namespace String_ { //% StringData *charAt(StringData *s, int pos) { @@ -127,13 +128,13 @@ namespace Math_ { //% int random(int max) { if (max == INT_MIN) - return -uBit.random(INT_MAX); + return -microbit_random(INT_MAX); else if (max < 0) - return -uBit.random(-max); + return -microbit_random(-max); else if (max == 0) return 0; else - return uBit.random(max); + return microbit_random(max); } //% @@ -298,6 +299,6 @@ namespace pxtrt { //% void panic(int code) { - uBit.panic(code); + microbit_panic(code); } } diff --git a/libs/microbit/input.cpp b/libs/microbit/input.cpp index 09bf758a..600e3a8b 100644 --- a/libs/microbit/input.cpp +++ b/libs/microbit/input.cpp @@ -247,7 +247,7 @@ namespace input { //% help=input/running-time weight=50 //% blockId=device_get_running_time block="running time (ms)" icon="\uf017" int runningTime() { - return uBit.systemTime(); + return system_timer_current_time(); } /** diff --git a/libs/microbit/pins.cpp b/libs/microbit/pins.cpp index b2e8b629..20023570 100644 --- a/libs/microbit/pins.cpp +++ b/libs/microbit/pins.cpp @@ -180,8 +180,9 @@ namespace pins { } if (ms > 0) { - uBit.sleep(ms); + fiber_sleep(ms); pitchPin->setAnalogValue(0); + // TODO why do we use wait_ms() here? it's a busy wait I think wait_ms(5); } } diff --git a/package.json b/package.json index 480bcb69..0be23132 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-microbit", - "version": "0.2.78", + "version": "0.2.79", "description": "BBC micro:bit target for PXT", "keywords": [ "JavaScript", @@ -29,6 +29,6 @@ "typescript": "^1.8.7" }, "dependencies": { - "pxt-core": "0.2.82" + "pxt-core": "0.2.83" } }