diff --git a/.gitignore b/.gitignore index 89a87e87..e0a67323 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,4 @@ crowdinstats.csv *.iml .vscode/.BROWSE.VC.DB-shm .vscode/.BROWSE.VC.DB-wal -package-lock.json +package-lock.json \ No newline at end of file diff --git a/docs/extensions.md b/docs/extensions.md new file mode 100644 index 00000000..feec0849 --- /dev/null +++ b/docs/extensions.md @@ -0,0 +1,4 @@ +# @extends + + + diff --git a/libs/core/_locales/core-jsdoc-strings.json b/libs/core/_locales/core-jsdoc-strings.json index 3cc86499..b3e2b5e0 100644 --- a/libs/core/_locales/core-jsdoc-strings.json +++ b/libs/core/_locales/core-jsdoc-strings.json @@ -494,14 +494,14 @@ "pins.analogPitch|param|frequency": "frequency to modulate in Hz.", "pins.analogPitch|param|ms": "duration of the pitch in milli seconds.", "pins.analogReadPin": "Read the connector value as analog, that is, as a value comprised between 0 and 1023.", - "pins.analogReadPin|param|name": "pin to write to, eg: AnalogPin.P0", + "pins.analogReadPin|param|name": "pin to write to, eg: AnalogPin.P1", "pins.analogSetPeriod": "Configure the pulse-width modulation (PWM) period of the analog output in microseconds.\nIf this pin is not configured as an analog output (using `analog write pin`), the operation has no effect.", "pins.analogSetPeriod|param|micros": "period in micro seconds. eg:20000", - "pins.analogSetPeriod|param|name": "analog pin to set period to, eg: AnalogPin.P0", + "pins.analogSetPeriod|param|name": "analog pin to set period to, eg: AnalogPin.P1", "pins.analogSetPitchPin": "Set the pin used when using analog pitch or music.", "pins.analogSetPitchPin|param|name": "pin to modulate pitch from", "pins.analogWritePin": "Set the connector value as analog. Value must be comprised between 0 and 1023.", - "pins.analogWritePin|param|name": "pin name to write to, eg: AnalogPin.P0", + "pins.analogWritePin|param|name": "pin name to write to, eg: AnalogPin.P1", "pins.analogWritePin|param|value": "value to write to the pin between ``0`` and ``1023``. eg:1023,0", "pins.createBuffer": "Create a new zero-initialized buffer.", "pins.createBufferFromArray": "Create a new buffer initalized to bytes from given array.", @@ -533,7 +533,7 @@ "pins.servoSetPulse|param|micros": "pulse duration in micro seconds, eg:1500", "pins.servoSetPulse|param|name": "pin name", "pins.servoWritePin": "Write a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).", - "pins.servoWritePin|param|name": "pin to write to, eg: AnalogPin.P0", + "pins.servoWritePin|param|name": "pin to write to, eg: AnalogPin.P1", "pins.servoWritePin|param|value": "angle or rotation speed, eg:180,90,0", "pins.setEvents": "Configure the events emitted by this pin. Events can be subscribed to\nusing ``control.onEvent()``.", "pins.setEvents|param|name": "pin to set the event mode on, eg: DigitalPin.P0", diff --git a/libs/core/codal.cpp b/libs/core/codal.cpp index a5fafe4e..65e757dc 100644 --- a/libs/core/codal.cpp +++ b/libs/core/codal.cpp @@ -222,7 +222,6 @@ void sendSerial(const char *data, int len) { logwriten(data, len); } -#ifdef PXT_GC ThreadContext *getThreadContext() { if (!currentFiber) return NULL; @@ -273,6 +272,5 @@ void gcProcessStacks(int flags) { } xfree(fibers); } -#endif } // namespace pxt diff --git a/libs/core/enums.d.ts b/libs/core/enums.d.ts index a0a8cb14..29693dd7 100644 --- a/libs/core/enums.d.ts +++ b/libs/core/enums.d.ts @@ -512,15 +512,12 @@ declare namespace motors { declare const enum SerialPin { - P0 = 7, // MICROBIT_ID_IO_P0 - P1 = 8, // MICROBIT_ID_IO_P1 - P2 = 9, // MICROBIT_ID_IO_P2 - P8 = 15, // MICROBIT_ID_IO_P8 - P12 = 19, // MICROBIT_ID_IO_P12 - P13 = 20, // MICROBIT_ID_IO_P13 - P14 = 21, // MICROBIT_ID_IO_P14 - P15 = 22, // MICROBIT_ID_IO_P15 - P16 = 23, // MICROBIT_ID_IO_P16 + P0 = 19, // MICROBIT_ID_IO_P12 + P1 = 7, // MICROBIT_ID_IO_P0 + P2 = 8, // MICROBIT_ID_IO_P1 + P3 = 23, // MICROBIT_ID_IO_P16 + C16 = 9, // MICROBIT_ID_IO_P2 + C17 = 15, // MICROBIT_ID_IO_P8 USB_TX = 1001, USB_RX = 1002, } diff --git a/libs/core/pins.cpp b/libs/core/pins.cpp index 3ac64d4b..ebf27d11 100644 --- a/libs/core/pins.cpp +++ b/libs/core/pins.cpp @@ -134,7 +134,7 @@ namespace pins { /** * Read the connector value as analog, that is, as a value comprised between 0 and 1023. - * @param name pin to write to, eg: AnalogPin.P0 + * @param name pin to write to, eg: AnalogPin.P1 */ //% help=pins/analog-read-pin weight=25 //% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8" @@ -146,7 +146,7 @@ namespace pins { /** * Set the connector value as analog. Value must be comprised between 0 and 1023. - * @param name pin name to write to, eg: AnalogPin.P0 + * @param name pin name to write to, eg: AnalogPin.P1 * @param value value to write to the pin between ``0`` and ``1023``. eg:1023,0 */ //% help=pins/analog-write-pin weight=24 @@ -161,7 +161,7 @@ namespace pins { /** * Configure the pulse-width modulation (PWM) period of the analog output in microseconds. * If this pin is not configured as an analog output (using `analog write pin`), the operation has no effect. - * @param name analog pin to set period to, eg: AnalogPin.P0 + * @param name analog pin to set period to, eg: AnalogPin.P1 * @param micros period in micro seconds. eg:20000 */ //% help=pins/analog-set-period weight=23 blockGap=8 @@ -244,7 +244,7 @@ namespace pins { /** * Write a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement). - * @param name pin to write to, eg: AnalogPin.P0 + * @param name pin to write to, eg: AnalogPin.P1 * @param value angle or rotation speed, eg:180,90,0 */ //% help=pins/servo-write-pin weight=20 diff --git a/libs/core/pinscompat.ts b/libs/core/pinscompat.ts index bc84585e..aa20b6e9 100644 --- a/libs/core/pinscompat.ts +++ b/libs/core/pinscompat.ts @@ -137,7 +137,7 @@ namespace pins { * Pin P3 */ //% fixedInstance whenUsed - export const P3: AnalogInPin = new MicrobitPin(DigitalPin.P3); + export const P3: PwmPin = new MicrobitPin(DigitalPin.P3); /** * Pin C4 @@ -149,13 +149,13 @@ namespace pins { * Pin C5 */ //% fixedInstance whenUsed - export const C5: DigitalInOutPin = new MicrobitPin(DigitalPin.C5); + export const C5: AnalogInPin = new MicrobitPin(DigitalPin.C5); /** * Pin C6 */ //% fixedInstance whenUsed - export const C6: DigitalInOutPin = new MicrobitPin(DigitalPin.C6); + export const C6: AnalogInPin = new MicrobitPin(DigitalPin.C6); /** * Pin C7 @@ -179,7 +179,7 @@ namespace pins { * Pin C10 */ //% fixedInstance whenUsed - export const C10: AnalogInPin = new MicrobitPin(DigitalPin.C10); + export const C10: DigitalInOutPin = new MicrobitPin(DigitalPin.C10); /** * Pin C11 @@ -198,13 +198,13 @@ namespace pins { * Pin C16 */ //% fixedInstance whenUsed - export const C16: DigitalInOutPin = new MicrobitPin(DigitalPin.C16); + export const C16: AnalogInPin = new MicrobitPin(DigitalPin.C16); /** * Pin C17 */ //% fixedInstance whenUsed - export const C17: DigitalInOutPin = new MicrobitPin(DigitalPin.C17); + export const C17: AnalogInPin = new MicrobitPin(DigitalPin.C17); /** * Pin C18 diff --git a/libs/core/serial.cpp b/libs/core/serial.cpp index 656213b7..b0219d30 100644 --- a/libs/core/serial.cpp +++ b/libs/core/serial.cpp @@ -4,15 +4,12 @@ // make sure USB_TX and USB_RX don't overlap with other pin ids enum SerialPin { - P0 = MICROBIT_ID_IO_P0, - P1 = MICROBIT_ID_IO_P1, - P2 = MICROBIT_ID_IO_P2, - P8 = MICROBIT_ID_IO_P8, - P12 = MICROBIT_ID_IO_P12, - P13 = MICROBIT_ID_IO_P13, - P14 = MICROBIT_ID_IO_P14, - P15 = MICROBIT_ID_IO_P15, - P16 = MICROBIT_ID_IO_P16, + P0 = MICROBIT_ID_IO_P12, + P1 = MICROBIT_ID_IO_P0, + P2 = MICROBIT_ID_IO_P1, + P3 = MICROBIT_ID_IO_P16, + C16 = MICROBIT_ID_IO_P2, + C17 = MICROBIT_ID_IO_P8, USB_TX = 1001, USB_RX = 1002 }; diff --git a/libs/core/shims.d.ts b/libs/core/shims.d.ts index 7199a1b2..e8172511 100644 --- a/libs/core/shims.d.ts +++ b/libs/core/shims.d.ts @@ -653,7 +653,7 @@ declare namespace pins { /** * Read the connector value as analog, that is, as a value comprised between 0 and 1023. - * @param name pin to write to, eg: AnalogPin.P0 + * @param name pin to write to, eg: AnalogPin.P1 */ //% help=pins/analog-read-pin weight=25 //% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8" @@ -663,7 +663,7 @@ declare namespace pins { /** * Set the connector value as analog. Value must be comprised between 0 and 1023. - * @param name pin name to write to, eg: AnalogPin.P0 + * @param name pin name to write to, eg: AnalogPin.P1 * @param value value to write to the pin between ``0`` and ``1023``. eg:1023,0 */ //% help=pins/analog-write-pin weight=24 @@ -676,7 +676,7 @@ declare namespace pins { /** * Configure the pulse-width modulation (PWM) period of the analog output in microseconds. * If this pin is not configured as an analog output (using `analog write pin`), the operation has no effect. - * @param name analog pin to set period to, eg: AnalogPin.P0 + * @param name analog pin to set period to, eg: AnalogPin.P1 * @param micros period in micro seconds. eg:20000 */ //% help=pins/analog-set-period weight=23 blockGap=8 @@ -719,7 +719,7 @@ declare namespace pins { /** * Write a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement). - * @param name pin to write to, eg: AnalogPin.P0 + * @param name pin to write to, eg: AnalogPin.P1 * @param value angle or rotation speed, eg:180,90,0 */ //% help=pins/servo-write-pin weight=20 diff --git a/package-lock.json b/package-lock.json index 5734df19..033aec4c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -122,17 +122,6 @@ "es6-promisify": "^5.0.0" } }, - "ajv": { - "version": "6.10.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", - "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", - "requires": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, "alphanum-sort": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/alphanum-sort/-/alphanum-sort-1.0.2.tgz", @@ -679,9 +668,9 @@ } }, "caniuse-db": { - "version": "1.0.30001016", - "resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30001016.tgz", - "integrity": "sha512-4G/7ef/NFSAsn9nFIiPvQr+ayoeLJP3wnQH23BPBJKofNdxFild5dokOjUj4tLFA5yd/VHllhzX55IPLwXhRtg==" + "version": "1.0.30001015", + "resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30001015.tgz", + "integrity": "sha512-+Fqdu7tOxSD0HDs922QPxseHlwnUzdjLC1Oq32HZ1/LWrMfYNt8JaUWnoiIAR+G4fRzM3tdgc4Lrqo5Nx76UsQ==" }, "caseless": { "version": "0.12.0", @@ -718,18 +707,18 @@ } }, "chokidar": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.1.tgz", - "integrity": "sha512-4QYCEWOcK3OJrxwvyyAOxFuhpvOVCYkr33LPfFNBjAD/w3sEzWsp2BUOkI4l9bHvWioAd0rc6NlHUOEaWkTeqg==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz", + "integrity": "sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==", "requires": { "anymatch": "~3.1.1", "braces": "~3.0.2", - "fsevents": "~2.1.2", + "fsevents": "~2.1.1", "glob-parent": "~5.1.0", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", - "readdirp": "~3.3.0" + "readdirp": "~3.2.0" } }, "chownr": { @@ -2146,6 +2135,11 @@ "useragent": "2.3.0" }, "dependencies": { + "mime": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz", + "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA==" + }, "rimraf": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", @@ -2355,11 +2349,6 @@ "brorand": "^1.0.1" } }, - "mime": { - "version": "2.4.4", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz", - "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA==" - }, "mime-db": { "version": "1.42.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.42.0.tgz", @@ -2709,11 +2698,6 @@ "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" - }, "picomatch": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.1.1.tgz", @@ -3485,6 +3469,11 @@ "ms": "^2.1.1" } }, + "mime": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz", + "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA==" + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -3509,18 +3498,18 @@ } }, "pxt-common-packages": { - "version": "6.17.1", - "resolved": "https://registry.npmjs.org/pxt-common-packages/-/pxt-common-packages-6.17.1.tgz", - "integrity": "sha512-bcAuVKKmH0JYBYTpk7xNjA+rnZd7JEVULBn8SGDh84WXtvx+fX2Dw7Qhf0WMJQH5g3b0yNdp6ZpRl63dlKj1sQ==", + "version": "6.16.31", + "resolved": "https://registry.npmjs.org/pxt-common-packages/-/pxt-common-packages-6.16.31.tgz", + "integrity": "sha512-mBgAEyPhek0YR9brj6B4pMLXWIALsD8gLvwxu0yBgIRkVkPKwN2zz1ePO9QwIz7sGt2d4zXzibcghKdgJJywjA==", "requires": { "@jacdac/jacdac-ts": "^0.0.9", "pxt-core": "^5.24.8" } }, "pxt-core": { - "version": "5.30.28", - "resolved": "https://registry.npmjs.org/pxt-core/-/pxt-core-5.30.28.tgz", - "integrity": "sha512-d/Aa5TbbqXwDFvPvZ21FGsnEy0DVp0XnbhcGNMKEmeJ+e3QmO53Ib8TVkZgu9JDG7IYByKt+640RqUEKnQuUJA==", + "version": "5.30.17", + "resolved": "https://registry.npmjs.org/pxt-core/-/pxt-core-5.30.17.tgz", + "integrity": "sha512-5lZEauuMnY10N9nxYIWsFmBW9pRv+IHGOybvmpuoVi3VuCKJpP1fjlIvAAQQCmv8L+R0W2MFdFE3nBtWNdU9FA==", "requires": { "applicationinsights-js": "^1.0.20", "bluebird": "3.5.1", @@ -3665,11 +3654,11 @@ } }, "readdirp": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.3.0.tgz", - "integrity": "sha512-zz0pAkSPOXXm1viEwygWIPSPkcBYjW1xU5j/JBh5t9bGCJwa6f9+BJa6VaB2g+b55yVrmXzqkyLf4xaWYM0IkQ==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz", + "integrity": "sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ==", "requires": { - "picomatch": "^2.0.7" + "picomatch": "^2.0.4" } }, "reduce-css-calc": { @@ -3724,6 +3713,17 @@ "uuid": "^3.3.2" }, "dependencies": { + "ajv": { + "version": "6.10.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", + "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, "assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", @@ -3773,6 +3773,11 @@ "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, "qs": { "version": "6.5.2", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",