This commit is contained in:
Peli de Halleux 2016-04-19 13:25:46 -07:00
commit 1dd70100d6
6 changed files with 14 additions and 12 deletions

View File

@ -58,7 +58,7 @@ namespace basic {
int l = s.length(); int l = s.length();
if (l == 0) { if (l == 0) {
uBit.display.clear(); uBit.display.clear();
uBit.sleep(interval * 5); fiber_sleep(interval * 5);
} else if (l > 1) { } else if (l > 1) {
uBit.display.scroll(s, interval); uBit.display.scroll(s, interval);
} else { } else {
@ -98,7 +98,7 @@ namespace basic {
void forever_stub(void *a) { void forever_stub(void *a) {
while (true) { while (true) {
runAction0((Action)a); runAction0((Action)a);
uBit.sleep(20); fiber_sleep(20);
} }
} }
@ -123,6 +123,6 @@ namespace basic {
//% async block="pause (ms) %pause" //% async block="pause (ms) %pause"
//% blockId=device_pause icon="\uf110" //% blockId=device_pause icon="\uf110"
void pause(int ms) { void pause(int ms) {
uBit.sleep(ms); fiber_sleep(ms);
} }
} }

View File

@ -132,7 +132,7 @@ namespace control {
//% weight=30 async help=control/reset //% weight=30 async help=control/reset
//% blockId="control_reset" block="reset" //% blockId="control_reset" block="reset"
void reset() { void reset() {
uBit.reset(); microbit_reset();
} }
/** /**

View File

@ -1,6 +1,7 @@
#include "ksbit.h" #include "ksbit.h"
#include <limits.h> #include <limits.h>
namespace String_ { namespace String_ {
//% //%
StringData *charAt(StringData *s, int pos) { StringData *charAt(StringData *s, int pos) {
@ -127,13 +128,13 @@ namespace Math_ {
//% //%
int random(int max) { int random(int max) {
if (max == INT_MIN) if (max == INT_MIN)
return -uBit.random(INT_MAX); return -microbit_random(INT_MAX);
else if (max < 0) else if (max < 0)
return -uBit.random(-max); return -microbit_random(-max);
else if (max == 0) else if (max == 0)
return 0; return 0;
else else
return uBit.random(max); return microbit_random(max);
} }
//% //%
@ -298,6 +299,6 @@ namespace pxtrt {
//% //%
void panic(int code) void panic(int code)
{ {
uBit.panic(code); microbit_panic(code);
} }
} }

View File

@ -247,7 +247,7 @@ namespace input {
//% help=input/running-time weight=50 //% help=input/running-time weight=50
//% blockId=device_get_running_time block="running time (ms)" icon="\uf017" //% blockId=device_get_running_time block="running time (ms)" icon="\uf017"
int runningTime() { int runningTime() {
return uBit.systemTime(); return system_timer_current_time();
} }
/** /**

View File

@ -180,8 +180,9 @@ namespace pins {
} }
if (ms > 0) { if (ms > 0) {
uBit.sleep(ms); fiber_sleep(ms);
pitchPin->setAnalogValue(0); pitchPin->setAnalogValue(0);
// TODO why do we use wait_ms() here? it's a busy wait I think
wait_ms(5); wait_ms(5);
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "pxt-microbit", "name": "pxt-microbit",
"version": "0.2.78", "version": "0.2.79",
"description": "BBC micro:bit target for PXT", "description": "BBC micro:bit target for PXT",
"keywords": [ "keywords": [
"JavaScript", "JavaScript",
@ -29,6 +29,6 @@
"typescript": "^1.8.7" "typescript": "^1.8.7"
}, },
"dependencies": { "dependencies": {
"pxt-core": "0.2.82" "pxt-core": "0.2.83"
} }
} }