Compare commits

..

93 Commits

Author SHA1 Message Date
cf1b85f85b 0.8.14 2017-02-06 22:48:37 +01:00
1f7ad1f114 add correct serial pins 2017-02-06 22:48:27 +01:00
b1d8ab0206 0.8.13 2017-02-06 22:07:56 +01:00
8bfa79fd15 update dependency on dal 2017-02-06 22:07:40 +01:00
991aa40f19 0.8.12 2017-02-06 12:10:43 -08:00
279f72c800 Bump pxt-core to 0.11.14 2017-02-06 12:10:41 -08:00
2420a7c781 0.8.11 2017-02-06 11:53:35 -08:00
7f134f330d updated translations 2017-02-06 11:52:50 -08:00
a91c28bd56 0.8.10 2017-02-06 10:17:39 -08:00
a5aca0dfcf merged master 2017-02-06 10:17:02 -08:00
b1fd48882c merged from microbit 2017-02-06 10:12:34 -08:00
a34004c14a using calliope compile service 2017-02-06 10:10:42 -08:00
9db0335844 0.8.9 2017-02-05 20:49:54 +01:00
ae8cb2dc53 update dependency for new calliope target 2017-02-05 20:49:09 +01:00
3fb21e590c 0.8.8 2017-02-04 14:26:41 +01:00
4376d3cefe fix typos, fix accelerometer 2017-02-04 14:26:21 +01:00
b31d6188f9 added jenkins 2017-02-03 16:19:22 -08:00
7a741622a9 0.8.7 2017-02-03 16:04:35 -08:00
a1104010e4 Bump pxt-core to 0.11.13 2017-02-03 16:04:32 -08:00
a39067a0f4 enable sharing 2017-02-03 16:03:17 -08:00
f2ccad6c26 0.8.6 2017-02-03 17:26:29 +01:00
8fe328b2e8 add some safety test codes to the production test 2017-02-03 17:26:04 +01:00
b984af2130 0.8.5 2017-02-02 23:23:55 -08:00
fcfcf901aa Bump pxt-core to 0.11.11 2017-02-02 23:23:52 -08:00
969ecee5b5 0.8.4 2017-02-02 23:16:33 -08:00
cd5e5d55bc Bump pxt-core to 0.11.10 2017-02-02 23:16:28 -08:00
254a979086 0.8.3 2017-02-02 17:33:12 +01:00
a846685d26 update sim to match updates in dal
(cherry picked from commit 62848ed)
2017-02-02 17:29:58 +01:00
1a7667724d update fixed dal reference 2017-02-02 15:57:02 +01:00
1d49ba4cf0 refreshed dal definitions 2017-02-02 03:18:18 -08:00
70dd486320 fixed typo in json 2017-02-01 09:58:49 +01:00
9e60666b66 fix naming in image 2017-01-31 22:40:52 +01:00
0de9102f96 pin updates 2017-01-31 22:36:32 +01:00
53dd4206a0 Cleaning up styles 2017-01-26 14:45:39 -08:00
3af4d8cf18 updated to 0.8.2 2017-01-22 18:01:14 -08:00
9f2368b59e 0.8.2 2017-01-22 17:49:06 -08:00
08f79ee743 updated web manifest 2017-01-22 17:48:50 -08:00
5ec4a3118a 0.8.1 2017-01-22 17:16:05 -08:00
352e59bfad updated version number 2017-01-22 17:15:54 -08:00
143c703bf2 0.7.18 2017-01-22 17:14:45 -08:00
37eb855df6 0.7.17 2017-01-22 17:13:27 -08:00
47dac2a175 Bump pxt-core to 0.10.15 2017-01-22 17:13:22 -08:00
211ec7a65d added audio flag 2017-01-22 17:13:12 -08:00
d4220593b0 Serial events (#337)
* added "serial->on data received"

* updated info

* updated docs

* added readline to read entire buffer

* lazy initialize of serial buffers

* init async on event

* updated docs
2017-01-22 17:08:59 -08:00
5d861e1e6d negative scroll fix
fix for Microsoft/pxt#813
2017-01-22 17:07:45 -08:00
64aa0fd6f5 One letter showString shouldn't disappear (#338)
* Fix for "One letter showString shouldn't disappear", fixes #798

* miss semicolon
2017-01-22 17:06:35 -08:00
5be188d6e7 0.7.16 2017-01-19 21:08:24 -08:00
502cca6cc0 Bump pxt-core to 0.10.11 2017-01-19 21:08:21 -08:00
703a876a84 updates style 2017-01-19 21:08:14 -08:00
ca1e3e7231 applying icons to namespaces 2017-01-19 20:55:31 -08:00
a0e971d49f 0.7.15 2017-01-19 11:31:22 -08:00
750faf42e4 Bump pxt-core to 0.10.10 2017-01-19 11:31:14 -08:00
b359411058 Merging array changes from pxt-microbit 2017-01-19 11:30:06 -08:00
9c140a5e6f 0.7.14 2017-01-17 14:12:28 -08:00
fad68499e5 0.7.13 2017-01-17 11:45:59 -08:00
c861fd6c65 Bump pxt-core to 0.10.8 2017-01-17 11:45:56 -08:00
db961f78a5 added avatar /loader 2017-01-12 23:06:19 -08:00
975b995f09 fixing dal board 2017-01-12 23:05:29 -08:00
167ba57d2b Bump pxt-core to 0.10.1 2017-01-12 22:58:52 -08:00
d40c0763f1 fixing indentation 2017-01-12 16:15:15 -08:00
8c2ecdd42e fix"string compare works differently in simulator/on target" 2017-01-12 16:14:15 -08:00
9d58ea8b1c 0.7.12 2017-01-12 15:31:31 -08:00
22864af73d Bump pxt-core to 0.9.4 2017-01-12 15:31:28 -08:00
53bb4ec7e9 USB serial receive fix 2017-01-06 08:15:53 +01:00
8e3694661a 0.7.11 2017-01-06 08:12:05 +01:00
2ba1b0c262 Merge branch 'master' of github.com:microsoft/pxt-calliope 2017-01-06 08:10:06 +01:00
a61e6f539e updated DAL (rev 0.3 resistor fix) 2017-01-06 08:10:01 +01:00
cc3c966427 fixing typings 2017-01-02 19:02:05 -08:00
ef5bee5a21 Bump pxt-core to 0.8.1 2017-01-02 18:59:39 -08:00
800682e8cc 0.7.10 2016-12-31 06:50:07 -08:00
291ea7169f Bump pxt-core to 0.7.13 2016-12-31 06:50:05 -08:00
ef6c3a6617 ui changes accompanying changes in pxt, converging where possible 2016-12-31 02:15:21 -08:00
734e81f4be 0.7.9 2016-12-30 15:07:06 -08:00
8e1acfc7df Bump pxt-core to 0.7.12 2016-12-30 15:07:04 -08:00
01c56e1111 0.7.8 2016-12-30 13:50:40 -08:00
dfbf06fc0e Bump pxt-core to 0.7.10 2016-12-30 13:50:38 -08:00
d1902a83ca bumped to v0.7.7 2016-12-23 00:22:32 -08:00
aeff3d9f45 0.7.7 2016-12-22 23:25:06 -08:00
6530bc26ae fixing menu active css 2016-12-22 23:24:53 -08:00
8ea9f1fb26 0.7.6 2016-12-22 23:18:00 -08:00
1e94e04104 setting up "on start" 2016-12-22 23:17:39 -08:00
e95d29286a 0.7.5 2016-12-22 23:12:46 -08:00
14d50810cb Bump pxt-core to 0.7.9 2016-12-22 23:12:43 -08:00
250e21b5c9 fixed toolbox color 2016-12-22 22:41:13 -08:00
98eab3672f updated css breakpoints 2016-12-22 22:36:06 -08:00
360e2b7ba6 0.7.4 2016-12-22 21:14:29 -08:00
f255e1a903 Bump pxt-core to 0.7.8 2016-12-22 21:14:27 -08:00
d4762cc5b5 deploy 0.7.3 to web 2016-12-22 10:05:52 +01:00
749b5266cb 0.7.3 2016-12-20 16:30:40 -08:00
bbd23f6d26 Bump pxt-core to 0.7.5 2016-12-20 16:30:38 -08:00
4bef7d50bd 0.7.2 2016-12-16 15:01:13 -08:00
bf423ca037 Bump pxt-core to 0.6.4 2016-12-16 15:01:05 -08:00
7556796eb6 merging more memory fixes 2016-12-16 14:57:16 -08:00
56 changed files with 1301 additions and 758 deletions

View File

@ -1,4 +1,4 @@
/// <reference path="../node_modules/pxt-core/typings/node/node.d.ts"/> /// <reference path="../node_modules/pxt-core/typings/globals/node/index.d.ts"/>
/// <reference path="../node_modules/pxt-core/built/pxtlib.d.ts" /> /// <reference path="../node_modules/pxt-core/built/pxtlib.d.ts" />
import * as path from "path"; import * as path from "path";

View File

@ -1,3 +1,3 @@
{ {
"appref": "v0.5.89" "appref": "v0.8.2"
} }

View File

@ -0,0 +1,30 @@
# Set Events
Configure the type of events emitted by a given pin.
```sig
pins.setEvents(DigitalPin.P0, PinEventType.Edge);
```
### Parameters
* ``name``: The @boardname@ hardware pin to configure (``P0`` through ``P20``)
* ``type``: The type of events this pin should emit
### Example
The following example configures pin ``P0`` and then
subscribes to the rise and fall events.
```blocks
control.onEvent(control.eventSourceId(EventBusSource.MICROBIT_ID_IO_P0), control.eventValueId(EventBusValue.MICROBIT_PIN_EVT_RISE), () => {
basic.showString("Rise")
})
control.onEvent(control.eventSourceId(EventBusSource.MICROBIT_ID_IO_P0), control.eventValueId(EventBusValue.MICROBIT_PIN_EVT_FALL), () => {
basic.showString("Fall")
})
pins.setEvents(DigitalPin.P0, PinEventType.Edge)
```
**This is an advanced API.** For more information, see the
[@boardname@ runtime messageBus documentation](https://lancaster-university.github.io/microbit-docs/ubit/messageBus/)

View File

@ -7,8 +7,11 @@ serial.writeLine("");
serial.writeNumber(0); serial.writeNumber(0);
serial.writeValue("x", 0); serial.writeValue("x", 0);
serial.writeString(""); serial.writeString("");
serial.readUntil(",");
serial.readLine(); serial.readLine();
serial.readString();
serial.redirect(SerialPin.P0, SerialPin.P0, BaudRate.BaudRate115200); serial.redirect(SerialPin.P0, SerialPin.P0, BaudRate.BaudRate115200);
serial.onDataReceived(",", () => {})
``` ```
### See Also ### See Also

View File

@ -0,0 +1,29 @@
# Serial On Data Received
Registers an event to be fired when one of the delimiter is matched.
```sig
serial.onDataReceived(",", () => {})
```
### Parameters
* `delimiters` is a [string](/reference/types/string) containing any of the character to match
### Example
Read values separated by `,`:
```blocks
serial.onDataReceived(serial.delimiters(Delimiters.Comma), () => {
basic.showString(serial.readUntil(serial.delimiters(Delimiters.Comma)))
})
```
### See also
[serial](/device/serial),
[serial write line](/reference/serial/write-line),
[serial write value](/reference/serial/write-value)

View File

@ -0,0 +1,27 @@
# Serial Read String
Read the buffered serial data as a string
```sig
serial.readString();
```
### Returns
* a [string](/reference/types/string) containing input from the serial port. Empty if no data available.
### Example
The following program scrolls text on the screen as it arrives from serial.
```blocks
basic.forever(() => {
basic.showString(serial.readString());
});
```
### See also
[serial](/device/serial),
[serial write line](/reference/serial/write-line),
[serial write value](/reference/serial/write-value)

145
docs/static/avatar.svg vendored Normal file
View File

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Ebene_1"
x="0px"
y="0px"
viewBox="0 0 175.49999 172.4"
enable-background="new 0 0 841.9 595.3"
xml:space="preserve"
inkscape:version="0.91 r13725"
sodipodi:docname="Logo_Calliope_Woman.svg"
width="175.5"
height="172.39999"><metadata
id="metadata5011"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs5009" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1137"
id="namedview5007"
showgrid="false"
inkscape:zoom="0.34208337"
inkscape:cx="420.95001"
inkscape:cy="297.64999"
inkscape:window-x="-8"
inkscape:window-y="156"
inkscape:window-maximized="1"
inkscape:current-layer="Ebene_1" /><g
id="g4955"
transform="translate(-260.90025,-204.1)"><g
id="g4957"><defs
id="defs4959"><rect
id="SVGID_7_"
x="193.10001"
y="204.10001"
width="318.29999"
height="256.29999" /></defs><clipPath
id="SVGID_1_"><use
xlink:href="#SVGID_7_"
overflow="visible"
id="use4963"
style="overflow:visible"
x="0"
y="0"
width="100%"
height="100%" /></clipPath></g><g
id="g4965"><defs
id="defs4967"><rect
id="SVGID_9_"
x="193.10001"
y="204.10001"
width="318.29999"
height="256.29999" /></defs><clipPath
id="SVGID_2_"><use
xlink:href="#SVGID_9_"
overflow="visible"
id="use4971"
style="overflow:visible"
x="0"
y="0"
width="100%"
height="100%" /></clipPath></g><g
id="g4973"><defs
id="defs4975"><rect
id="SVGID_11_"
x="193.10001"
y="204.10001"
width="318.29999"
height="256.29999" /></defs><clipPath
id="SVGID_3_"><use
xlink:href="#SVGID_11_"
overflow="visible"
id="use4979"
style="overflow:visible"
x="0"
y="0"
width="100%"
height="100%" /></clipPath><path
clip-path="url(#SVGID_3_)"
d="m 436.4,262 -47.9,0 0,-46 c 0,-4.7 3.8,-8.4 8.4,-8.4 l 31,0 c 4.7,0 8.4,3.8 8.4,8.4 l 0,46 z"
id="path4981"
inkscape:connector-curvature="0"
style="fill:#4a5261" /></g><rect
x="394.79999"
y="218.7"
width="35.099998"
height="43.200001"
id="rect4983"
style="fill:#8096a1" /><path
d="m 317.6,239.5 0,61 71,0.2 c 0,0 0,-57.3 0,-61 0,-19.5 -16.1,-35.6 -35.6,-35.6 -19.6,0 -35.4,15.8 -35.4,35.4"
id="path4985"
inkscape:connector-curvature="0"
style="fill:#855c33" /><path
d="m 412.4,376.5 -114.2,0 c -35.6,0 -50.9,-45.2 -22.6,-66.8 l 63.8,-47.8 96.9,0 0,90.7 c 0.1,13.2 -10.6,23.9 -23.9,23.9"
id="path4987"
inkscape:connector-curvature="0"
style="fill:#26a6ab" /><polygon
points="345.7,257.3 334.8,298.8 285.1,302.5 "
id="polygon4989"
style="fill:#42c9c9" /><polygon
points="354,283.8 332.5,283.8 345.7,257.3 "
id="polygon4991"
style="fill:#f7f5e8" /><polygon
points="375.4,283.8 354,283.8 362.2,257.3 "
id="polygon4993"
style="fill:#f7f5e8" /><polygon
points="373.1,298.8 334.8,298.8 332.5,283.8 375.4,283.8 "
id="polygon4995"
style="fill:#bdd1cf" /><path
d="m 400.6,376.5 c -3.5,-26.2 -10.6,-58 -27.3,-77.7 l -0.2,0 -19,0 -19,0 -0.2,0 c -16.7,19.8 -23.8,51.5 -27.3,77.7 l 93,0 z"
id="path4997"
inkscape:connector-curvature="0"
style="fill:#f7f5e8" /><path
d="m 357,258 -6.1,0 c -6.4,0 -11.5,-5.2 -11.5,-11.5 l 0,-19.7 29.2,0 0,19.7 c -0.1,6.3 -5.3,11.5 -11.6,11.5"
id="path4999"
inkscape:connector-curvature="0"
style="fill:#ffcc99" /><path
d="m 335.8,376.5 0,-77.7 c 12.4,29.1 27.7,64.3 46.5,77.7 l -46.5,0 z"
id="path5001"
inkscape:connector-curvature="0"
style="fill:#bdd1cf" /><polygon
points="362.2,257.3 345.7,257.3 354,283.8 "
id="polygon5003"
style="fill:#ffcc99" /><polygon
points="436.4,315.3 394.8,262 436.4,262 "
id="polygon5005"
style="fill:#42c9c9" /></g></svg>

After

Width:  |  Height:  |  Size: 5.2 KiB

145
docs/static/loader.svg vendored Normal file
View File

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Ebene_1"
x="0px"
y="0px"
viewBox="0 0 175.49999 172.4"
enable-background="new 0 0 841.9 595.3"
xml:space="preserve"
inkscape:version="0.91 r13725"
sodipodi:docname="Logo_Calliope_Woman.svg"
width="175.5"
height="172.39999"><metadata
id="metadata5011"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs5009" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1137"
id="namedview5007"
showgrid="false"
inkscape:zoom="0.34208337"
inkscape:cx="420.95001"
inkscape:cy="297.64999"
inkscape:window-x="-8"
inkscape:window-y="156"
inkscape:window-maximized="1"
inkscape:current-layer="Ebene_1" /><g
id="g4955"
transform="translate(-260.90025,-204.1)"><g
id="g4957"><defs
id="defs4959"><rect
id="SVGID_7_"
x="193.10001"
y="204.10001"
width="318.29999"
height="256.29999" /></defs><clipPath
id="SVGID_1_"><use
xlink:href="#SVGID_7_"
overflow="visible"
id="use4963"
style="overflow:visible"
x="0"
y="0"
width="100%"
height="100%" /></clipPath></g><g
id="g4965"><defs
id="defs4967"><rect
id="SVGID_9_"
x="193.10001"
y="204.10001"
width="318.29999"
height="256.29999" /></defs><clipPath
id="SVGID_2_"><use
xlink:href="#SVGID_9_"
overflow="visible"
id="use4971"
style="overflow:visible"
x="0"
y="0"
width="100%"
height="100%" /></clipPath></g><g
id="g4973"><defs
id="defs4975"><rect
id="SVGID_11_"
x="193.10001"
y="204.10001"
width="318.29999"
height="256.29999" /></defs><clipPath
id="SVGID_3_"><use
xlink:href="#SVGID_11_"
overflow="visible"
id="use4979"
style="overflow:visible"
x="0"
y="0"
width="100%"
height="100%" /></clipPath><path
clip-path="url(#SVGID_3_)"
d="m 436.4,262 -47.9,0 0,-46 c 0,-4.7 3.8,-8.4 8.4,-8.4 l 31,0 c 4.7,0 8.4,3.8 8.4,8.4 l 0,46 z"
id="path4981"
inkscape:connector-curvature="0"
style="fill:#4a5261" /></g><rect
x="394.79999"
y="218.7"
width="35.099998"
height="43.200001"
id="rect4983"
style="fill:#8096a1" /><path
d="m 317.6,239.5 0,61 71,0.2 c 0,0 0,-57.3 0,-61 0,-19.5 -16.1,-35.6 -35.6,-35.6 -19.6,0 -35.4,15.8 -35.4,35.4"
id="path4985"
inkscape:connector-curvature="0"
style="fill:#855c33" /><path
d="m 412.4,376.5 -114.2,0 c -35.6,0 -50.9,-45.2 -22.6,-66.8 l 63.8,-47.8 96.9,0 0,90.7 c 0.1,13.2 -10.6,23.9 -23.9,23.9"
id="path4987"
inkscape:connector-curvature="0"
style="fill:#26a6ab" /><polygon
points="345.7,257.3 334.8,298.8 285.1,302.5 "
id="polygon4989"
style="fill:#42c9c9" /><polygon
points="354,283.8 332.5,283.8 345.7,257.3 "
id="polygon4991"
style="fill:#f7f5e8" /><polygon
points="375.4,283.8 354,283.8 362.2,257.3 "
id="polygon4993"
style="fill:#f7f5e8" /><polygon
points="373.1,298.8 334.8,298.8 332.5,283.8 375.4,283.8 "
id="polygon4995"
style="fill:#bdd1cf" /><path
d="m 400.6,376.5 c -3.5,-26.2 -10.6,-58 -27.3,-77.7 l -0.2,0 -19,0 -19,0 -0.2,0 c -16.7,19.8 -23.8,51.5 -27.3,77.7 l 93,0 z"
id="path4997"
inkscape:connector-curvature="0"
style="fill:#f7f5e8" /><path
d="m 357,258 -6.1,0 c -6.4,0 -11.5,-5.2 -11.5,-11.5 l 0,-19.7 29.2,0 0,19.7 c -0.1,6.3 -5.3,11.5 -11.6,11.5"
id="path4999"
inkscape:connector-curvature="0"
style="fill:#ffcc99" /><path
d="m 335.8,376.5 0,-77.7 c 12.4,29.1 27.7,64.3 46.5,77.7 l -46.5,0 z"
id="path5001"
inkscape:connector-curvature="0"
style="fill:#bdd1cf" /><polygon
points="362.2,257.3 345.7,257.3 354,283.8 "
id="polygon5003"
style="fill:#ffcc99" /><polygon
points="436.4,315.3 394.8,262 436.4,262 "
id="polygon5005"
style="fill:#42c9c9" /></g></svg>

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -1,61 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
role="img"
aria-labelledby="title desc"
xml:space="preserve"
enable-background="new 0 0 280 32.755"
height="34.210526104448945"
width="195.47368473887764"
version="1.1"
id="svg2"
inkscape:version="0.91 r13725"
sodipodi:docname="logo.portrait.black.svg"><sodipodi:namedview
pagecolor="#ff00ff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1536"
inkscape:window-height="801"
id="namedview14"
showgrid="false"
inkscape:zoom="3.6367355"
inkscape:cx="106.22094"
inkscape:cy="5.7691884"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" /><rect
id="backgroundrect"
width="100%"
height="100%"
x="0"
y="0"
fill="none"
stroke="none"
class="" /><title
id="title"
lang="en-GB">BBC micro:bit</title><desc
id="desc"
lang="en-GB">BBC micro:bit logo</desc><metadata
id="metadata37"><rdf:rdf><cc:work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:work></rdf:rdf><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>BBC micro:bit</dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs35" /><path
inkscape:connector-curvature="0"
class=""
d="m 38.349339,21.473763 c -1.677,0 -3.035,-1.364 -3.035,-3.042 0,-1.678 1.357,-3.038 3.035,-3.038 1.684,0 3.039,1.36 3.039,3.038 0,1.678 -1.355,3.042 -3.039,3.042 m -22.311,-6.077 c -1.677,0 -3.042,1.357 -3.042,3.035 0,1.678 1.363,3.042 3.042,3.042 1.674,0 3.036,-1.364 3.036,-3.042 0,-1.678 -1.363,-3.035 -3.036,-3.035 m -0.003,-5.9900001 22.576,0 c 4.979,0 9.027,4.0470001 9.027,9.0270001 0,4.979 -4.049,9.031 -9.027,9.031 l -22.576,0 c -4.977,0 -9.0299997,-4.053 -9.0299997,-9.031 -0.001,-4.98 4.0529997,-9.0270001 9.0299997,-9.0270001 m 22.576,24.0760001 c 8.299,0 15.047,-6.75 15.047,-15.049 0,-8.299 -6.748,-15.0510001 -15.047,-15.0510001 l -22.576,0 c -8.2989997,0 -15.04899969,6.7520001 -15.04899969,15.0510001 0,8.299 6.74999999,15.049 15.04899969,15.049 l 22.576,0 m 112.098991,-21.953 c 0,-1.453 -1.195,-2.6330001 -2.662,-2.6330001 -1.455,0 -2.639,1.1800001 -2.639,2.6330001 0,1.471 1.184,2.672 2.639,2.672 1.466,0 2.662,-1.202 2.662,-2.672 z m -66.785991,5.445 c 0,-4.764 -2.893,-8.0930001 -7.031,-8.0930001 -2.027,0 -3.814,0.851 -5.223,2.4700001 -1.467,-1.6610001 -3.152,-2.4700001 -5.127,-2.4700001 -4.162,0 -7.066,3.3290001 -7.066,8.0930001 l 0,10.466 3.812,0 0,-10.644 c 0,-2.416 1.336,-4.104 3.254,-4.104 1.617,0 3.25,1.409 3.25,4.104 l 0,10.645 3.848,0 0,-10.645 c 0,-2.416 1.338,-4.104 3.252,-4.104 1.863,0 3.217,1.727 3.217,4.104 l 0,10.645 3.814,0 0,-10.467 z m 6.953,-7.6320001 -3.846,0 0,18.0990001 3.846,0 0,-18.0990001 z m 0.569,-5.128 c 0,-1.377 -1.096,-2.454 -2.492,-2.454 -1.4,0 -2.453,1.054 -2.453,2.454 0,1.398 1.078,2.494 2.453,2.494 1.375,0 2.492,-1.117 2.492,-2.494 z m 18.327991,20.9140001 0.576,-0.521 -2.828,-2.658 -0.488,0.455 c -1.252,1.149 -2.504,1.686 -3.945,1.686 -3.064,0 -5.556991,-2.557 -5.556991,-5.699 0,-3.121 2.491991,-5.66 5.556991,-5.66 1.432,0 2.646,0.521 3.949,1.693 l 0.512,0.46 2.748,-2.802 -0.49,-0.502 c -1.754,-1.7930001 -4.016,-2.6960001 -6.719,-2.6960001 -2.459,0 -4.868991,1.022 -6.604991,2.7980001 -1.738,1.734 -2.691,4.119 -2.691,6.709 0,2.596 0.953,4.979 2.684,6.705 1.771,1.811 4.116991,2.811 6.614991,2.811 2.401,-0.003 4.647,-0.937 6.682,-2.779 z m 7.25,-6.947 c 0,-3.322 1.145,-4.686 4.217,-5.029 l 0.641,-0.07 0,-3.7970001 -0.777,0.058 c -5.629,0.458 -8.143,3.2470001 -8.143,9.0480001 l 0,9.051 4.062,0 0,-9.261 0,0 z m 21.998,6.923 c 1.762,-1.756 2.729,-4.146 2.729,-6.715 0,-2.565 -0.967,-4.951 -2.723,-6.702 -1.77,-1.8090001 -4.105,-2.8060001 -6.576,-2.8060001 -2.492,0 -4.84,0.997 -6.613,2.8060001 -1.752,1.792 -2.721,4.174 -2.721,6.702 0,2.53 0.969,4.916 2.721,6.707 1.771,1.81 4.121,2.808 6.613,2.808 2.472,0 4.808,-0.998 6.57,-2.8 z m -1.229,-6.714 c 0,3.18 -2.361,5.665 -5.377,5.665 -2.945,0 -5.346,-2.541 -5.346,-5.665 0,-3.137 2.398,-5.695 5.346,-5.695 2.963,-0.002 5.377,2.558 5.377,5.695 z m 12.917,6.418 c 0,-1.468 -1.195,-2.667 -2.662,-2.667 -1.455,0 -2.639,1.199 -2.639,2.667 0,1.453 1.184,2.632 2.639,2.632 1.466,0 2.662,-1.179 2.662,-2.632 z m 19.507,0.296 c 1.76,-1.756 2.73,-4.146 2.73,-6.715 0,-2.528 -0.973,-4.911 -2.729,-6.702 -1.746,-1.7870001 -4.08,-2.7700001 -6.574,-2.7700001 -2.035,0 -3.84,0.572 -5.484,1.7440001 l 0,-9.93400015 -3.816,0 0.008,15.58200015 c -0.037,0.411 -0.037,0.821 -0.037,1.198 0,6.119 3.836,10.396 9.33,10.396 2.475,10e-4 4.807,-0.997 6.572,-2.799 z m -1.013,-6.677 c 0,3.123 -2.494,5.66 -5.559,5.66 -3.115,0 -5.557,-2.484 -5.557,-5.66 0,-3.143 2.494,-5.698 5.557,-5.698 3.065,0 5.559,2.556 5.559,5.698 z m 10.881,-9.0850001 -3.846,0 0,18.0990001 3.846,0 0,-18.0990001 z m 0.572,-5.128 c 0,-1.377 -1.098,-2.454 -2.492,-2.454 -1.4,0 -2.457,1.054 -2.457,2.454 0,1.398 1.076,2.494 2.457,2.494 1.373,0 2.492,-1.117 2.492,-2.494 z m 13.83,19.7590001 -0.619,-0.089 c -2.855,-0.409 -4.133,-2.104 -4.133,-5.495 l 0,-5.126 4.752,0 0,-3.6740001 -4.752,0 0,-4.006 -3.887,0 0,4.006 -1.662,0 0,3.6740001 1.662,0 0,4.525 c 0,6.215 2.113,8.932 7.783,10.029 l 0.855,0.164 0,-4.008 10e-4,0 z"
id="path21"
style="fill:#000000" /></svg>

Before

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -1,65 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
role="img"
aria-labelledby="title desc"
xml:space="preserve"
enable-background="new 0 0 280 32.755"
height="34.210526104448945"
width="195.47368473887764"
version="1.1"
id="svg2"
inkscape:version="0.91 r13725"
sodipodi:docname="logo.portrait.white.svg"><sodipodi:namedview
pagecolor="#ff00ff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1536"
inkscape:window-height="801"
id="namedview14"
showgrid="false"
inkscape:zoom="3.6367355"
inkscape:cx="106.22094"
inkscape:cy="5.7691884"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" /><rect
id="backgroundrect"
width="100%"
height="100%"
x="0"
y="0"
fill="none"
stroke="none"
class="" /><title
id="title"
lang="en-GB">BBC micro:bit</title><desc
id="desc"
lang="en-GB">BBC micro:bit logo</desc><metadata
id="metadata37"><rdf:rdf><cc:work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:work></rdf:rdf><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>BBC micro:bit</dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs35" /><g
class="currentLayer"
id="g9"
transform="translate(-0.35013519,1.2540786)"><title
id="title11">Layer 1</title><path
style="fill:#ffffff"
id="path21"
d="m 38.699474,20.219684 c -1.677,0 -3.035,-1.364 -3.035,-3.042 0,-1.678 1.357,-3.038 3.035,-3.038 1.684,0 3.039,1.36 3.039,3.038 0,1.678 -1.355,3.042 -3.039,3.042 m -22.311,-6.077 c -1.677,0 -3.042,1.357 -3.042,3.035 0,1.678 1.363,3.042 3.042,3.042 1.674,0 3.036,-1.364 3.036,-3.042 0,-1.678 -1.363,-3.035 -3.036,-3.035 m -0.003,-5.9899997 22.576,0 c 4.979,0 9.027,4.0469997 9.027,9.0269997 0,4.979 -4.049,9.031 -9.027,9.031 l -22.576,0 c -4.977,0 -9.0299995,-4.053 -9.0299995,-9.031 -10e-4,-4.98 4.0529995,-9.0269997 9.0299995,-9.0269997 m 22.576,24.0759997 c 8.299,0 15.047,-6.75 15.047,-15.049 0,-8.2989997 -6.748,-15.0509997 -15.047,-15.0509997 l -22.576,0 c -8.2989995,0 -15.0489995,6.752 -15.0489995,15.0509997 0,8.299 6.75,15.049 15.0489995,15.049 l 22.576,0 m 112.098996,-21.953 c 0,-1.4529997 -1.195,-2.6329997 -2.662,-2.6329997 -1.455,0 -2.639,1.18 -2.639,2.6329997 0,1.471 1.184,2.672 2.639,2.672 1.466,0 2.662,-1.202 2.662,-2.672 z m -66.785996,5.445 c 0,-4.764 -2.893,-8.0929997 -7.031,-8.0929997 -2.027,0 -3.814,0.851 -5.223,2.4699997 -1.467,-1.6609997 -3.152,-2.4699997 -5.127,-2.4699997 -4.162,0 -7.066,3.3289997 -7.066,8.0929997 l 0,10.466 3.812,0 0,-10.644 c 0,-2.416 1.336,-4.104 3.254,-4.104 1.617,0 3.25,1.409 3.25,4.104 l 0,10.645 3.848,0 0,-10.645 c 0,-2.416 1.338,-4.104 3.252,-4.104 1.863,0 3.217,1.727 3.217,4.104 l 0,10.645 3.814,0 0,-10.467 z m 6.953,-7.6319997 -3.846,0 0,18.0989997 3.846,0 0,-18.0989997 z m 0.569,-5.128 c 0,-1.377 -1.096,-2.45400005 -2.492,-2.45400005 -1.4,0 -2.453,1.05400005 -2.453,2.45400005 0,1.398 1.078,2.494 2.453,2.494 1.375,0 2.492,-1.117 2.492,-2.494 z m 18.327996,20.9139997 0.576,-0.521 -2.828,-2.658 -0.488,0.455 c -1.252,1.149 -2.504,1.686 -3.945,1.686 -3.064,0 -5.556996,-2.557 -5.556996,-5.699 0,-3.121 2.491996,-5.66 5.556996,-5.66 1.432,0 2.646,0.521 3.949,1.693 l 0.512,0.46 2.748,-2.802 -0.49,-0.502 c -1.754,-1.7929997 -4.016,-2.6959997 -6.719,-2.6959997 -2.459,0 -4.868996,1.022 -6.604996,2.7979997 -1.738,1.734 -2.691,4.119 -2.691,6.709 0,2.596 0.953,4.979 2.684,6.705 1.771,1.811 4.116996,2.811 6.614996,2.811 2.401,-0.003 4.647,-0.937 6.682,-2.779 z m 7.25,-6.947 c 0,-3.322 1.145,-4.686 4.217,-5.029 l 0.641,-0.07 0,-3.7969997 -0.777,0.058 c -5.629,0.458 -8.143,3.2469997 -8.143,9.0479997 l 0,9.051 4.062,0 0,-9.261 0,0 z m 21.998,6.923 c 1.762,-1.756 2.729,-4.146 2.729,-6.715 0,-2.565 -0.967,-4.951 -2.723,-6.702 -1.77,-1.8089997 -4.105,-2.8059997 -6.576,-2.8059997 -2.492,0 -4.84,0.997 -6.613,2.8059997 -1.752,1.792 -2.721,4.174 -2.721,6.702 0,2.53 0.969,4.916 2.721,6.707 1.771,1.81 4.121,2.808 6.613,2.808 2.472,0 4.808,-0.998 6.57,-2.8 z m -1.229,-6.714 c 0,3.18 -2.361,5.665 -5.377,5.665 -2.945,0 -5.346,-2.541 -5.346,-5.665 0,-3.137 2.398,-5.695 5.346,-5.695 2.963,-0.002 5.377,2.558 5.377,5.695 z m 12.917,6.418 c 0,-1.468 -1.195,-2.667 -2.662,-2.667 -1.455,0 -2.639,1.199 -2.639,2.667 0,1.453 1.184,2.632 2.639,2.632 1.466,0 2.662,-1.179 2.662,-2.632 z m 19.507,0.296 c 1.76,-1.756 2.73,-4.146 2.73,-6.715 0,-2.528 -0.973,-4.911 -2.729,-6.702 -1.746,-1.7869997 -4.08,-2.7699997 -6.574,-2.7699997 -2.035,0 -3.84,0.572 -5.484,1.744 l 0,-9.93400005 -3.816,0 0.008,15.58199975 c -0.037,0.411 -0.037,0.821 -0.037,1.198 0,6.119 3.836,10.396 9.33,10.396 2.475,10e-4 4.807,-0.997 6.572,-2.799 z m -1.013,-6.677 c 0,3.123 -2.494,5.66 -5.559,5.66 -3.115,0 -5.557,-2.484 -5.557,-5.66 0,-3.143 2.494,-5.698 5.557,-5.698 3.065,0 5.559,2.556 5.559,5.698 z m 10.881,-9.0849997 -3.846,0 0,18.0989997 3.846,0 0,-18.0989997 z m 0.572,-5.128 c 0,-1.377 -1.098,-2.45400005 -2.492,-2.45400005 -1.4,0 -2.457,1.05400005 -2.457,2.45400005 0,1.398 1.076,2.494 2.457,2.494 1.373,0 2.492,-1.117 2.492,-2.494 z m 13.83,19.7589997 -0.619,-0.089 c -2.855,-0.409 -4.133,-2.104 -4.133,-5.495 l 0,-5.126 4.752,0 0,-3.6739997 -4.752,0 0,-4.006 -3.887,0 0,4.006 -1.662,0 0,3.6739997 1.662,0 0,4.525 c 0,6.215 2.113,8.932 7.783,10.029 l 0.855,0.164 0,-4.008 0.001,0 z"
class=""
inkscape:connector-curvature="0" /></g></svg>

Before

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -1,61 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
role="img"
aria-labelledby="title desc"
xml:space="preserve"
enable-background="new 0 0 280 32.755"
height="52.672001"
width="52.672001"
version="1.1"
id="svg2"
inkscape:version="0.91 r13725"
sodipodi:docname="logo.square.black.svg"><sodipodi:namedview
pagecolor="#ff00ff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1536"
inkscape:window-height="801"
id="namedview14"
showgrid="false"
inkscape:zoom="2.0836233"
inkscape:cx="83.390493"
inkscape:cy="16.071144"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" /><rect
id="backgroundrect"
width="195.47368"
height="34.210526"
x="0"
y="18.461473"
class=""
style="fill:none;stroke:none" /><title
id="title"
lang="en-GB">BBC micro:bit</title><desc
id="desc"
lang="en-GB">BBC micro:bit logo</desc><metadata
id="metadata37"><rdf:rdf><cc:work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:work></rdf:rdf><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>BBC micro:bit</dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs35" /><path
inkscape:connector-curvature="0"
class=""
d="m 37.363,29.377 c -1.677,0 -3.035,-1.364 -3.035,-3.042 0,-1.678 1.357,-3.038 3.035,-3.038 1.684,0 3.039,1.36 3.039,3.038 0,1.678 -1.355,3.042 -3.039,3.042 M 15.052,23.3 c -1.677,0 -3.042,1.357 -3.042,3.035 0,1.678 1.363,3.042 3.042,3.042 1.674,0 3.036,-1.364 3.036,-3.042 0,-1.678 -1.363,-3.035 -3.036,-3.035 m -0.003,-5.99 22.576,0 c 4.979,0 9.027,4.047 9.027,9.027 0,4.979 -4.049,9.031 -9.027,9.031 l -22.576,0 c -4.977,0 -9.0299993,-4.053 -9.0299993,-9.031 C 6.0180007,21.357 10.072,17.31 15.049,17.31 m 22.576,24.076 c 8.299,0 15.047,-6.75 15.047,-15.049 0,-8.299 -6.748,-15.051 -15.047,-15.051 l -22.576,0 C 6.7500007,11.286 6.9250488e-7,18.038 6.9250488e-7,26.337 6.9250488e-7,34.636 6.7500007,41.386 15.049,41.386 l 22.576,0"
id="path21"
style="fill:#000000"
sodipodi:nodetypes="csssccsssccsssscccsssssc" /></svg>

Before

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -1,61 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
role="img"
aria-labelledby="title desc"
xml:space="preserve"
enable-background="new 0 0 280 32.755"
height="52.672001"
width="52.672001"
version="1.1"
id="svg2"
inkscape:version="0.91 r13725"
sodipodi:docname="logo.square.white.svg"><sodipodi:namedview
pagecolor="#ff00ff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1536"
inkscape:window-height="801"
id="namedview14"
showgrid="false"
inkscape:zoom="2.0836233"
inkscape:cx="83.390493"
inkscape:cy="16.071144"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" /><rect
id="backgroundrect"
width="195.47368"
height="34.210526"
x="0"
y="18.461473"
class=""
style="fill:none;stroke:none" /><title
id="title"
lang="en-GB">BBC micro:bit</title><desc
id="desc"
lang="en-GB">BBC micro:bit logo</desc><metadata
id="metadata37"><rdf:rdf><cc:work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:work></rdf:rdf><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>BBC micro:bit</dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs35" /><path
inkscape:connector-curvature="0"
class=""
d="m 37.363,29.377 c -1.677,0 -3.035,-1.364 -3.035,-3.042 0,-1.678 1.357,-3.038 3.035,-3.038 1.684,0 3.039,1.36 3.039,3.038 0,1.678 -1.355,3.042 -3.039,3.042 M 15.052,23.3 c -1.677,0 -3.042,1.357 -3.042,3.035 0,1.678 1.363,3.042 3.042,3.042 1.674,0 3.036,-1.364 3.036,-3.042 0,-1.678 -1.363,-3.035 -3.036,-3.035 m -0.003,-5.99 22.576,0 c 4.979,0 9.027,4.047 9.027,9.027 0,4.979 -4.049,9.031 -9.027,9.031 l -22.576,0 c -4.977,0 -9.0299993,-4.053 -9.0299993,-9.031 C 6.0180007,21.357 10.072,17.31 15.049,17.31 m 22.576,24.076 c 8.299,0 15.047,-6.75 15.047,-15.049 0,-8.299 -6.748,-15.051 -15.047,-15.051 l -22.576,0 C 6.7500007,11.286 6.9250488e-7,18.038 6.9250488e-7,26.337 6.9250488e-7,34.636 6.7500007,41.386 15.049,41.386 l 22.576,0"
id="path21"
style="fill:#ffffff"
sodipodi:nodetypes="csssccsssccsssscccsssssc" /></svg>

Before

Width:  |  Height:  |  Size: 2.8 KiB

32
jenkins.groovy Normal file
View File

@ -0,0 +1,32 @@
import jobs.generation.Utilities;
import jobs.generation.InternalUtilities;
def project = GithubProject
def branch = GithubBranchName
[true, false].each { isPR ->
def newJobName = InternalUtilities.getFullJobName(project, "Default", isPR)
def newJob = job(newJobName) {
steps {
shell("./jenkins.sh ${isPR}")
}
if (!isPR) {
wrappers {
credentialsBinding {
string('PXT_ACCESS_TOKEN', 'pxt_access_token')
string('PXT_RELEASE_REPO', 'pxt_release_repo_calliope')
}
}
}
}
Utilities.setMachineAffinity(newJob, 'Ubuntu', '20161020')
InternalUtilities.standardJobSetup(newJob, project, isPR, "*/*")
if (isPR) {
Utilities.addGithubPRTrigger(newJob, "Default Testing")
} else {
Utilities.addGithubPushTrigger(newJob)
}
}

55
jenkins.sh Normal file
View File

@ -0,0 +1,55 @@
#!/usr/bin/env bash
# Set up NVM
export NVM_DIR="/home/dotnet-bot/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
nvm install 5
# Set up build environment variables
echo ---------- Setting build environment variables
echo Git branch: $GIT_BRANCH
echo isPR: $1
originRegex="^origin/.*"
branchRegex="^origin/\K.*(?=$)"
if [[ "$GIT_BRANCH" =~ $originRegex ]]; then
branchName=$(echo ${GIT_BRANCH} | grep -oP $branchRegex)
echo Setting TRAVIS_BRANCH to ${branchName}
export TRAVIS_BRANCH=${branchName}
else
echo Setting TRAVIS_BRANCH to $GIT_BRANCH
export TRAVIS_BRANCH=$GIT_BRANCH
fi
if [ "$1" == "false" ]; then
echo Setting TRAVIS_PULL_REQUEST to false
export TRAVIS_PULL_REQUEST=false
if [ $TRAVIS_BRANCH == "master" ]; then
if [[ -z $PXT_RELEASE_REPO ]]; then
echo Cannot find release repo; skipping tag checks
else
gitTag=$(git describe --tags --exact-match 2> /dev/null)
builtTag=$(git ls-remote --tags $PXT_RELEASE_REPO | grep -o "refs/tags/$gitTag$")
echo Current tag: $gitTag
echo Built tag: $builtTag
if [[ ! -z $gitTag && -z $builtTag ]]; then
echo Built tag not found; building tag
echo Setting TRAVIS_BRANCH to $gitTag
export TRAVIS_BRANCH=$gitTag
echo Setting TRAVIS_TAG to $gitTag
export TRAVIS_TAG=$gitTag
else
echo Not a tag build
fi
fi
fi
fi
# Perform build
npm install
npm test

View File

@ -1,5 +1,5 @@
{ {
"bluetooth": "Support for additional Bluetooth services.", "bluetooth": "Support for additional Bluetooth services.\n\nSupport for additional Bluetooth services.",
"bluetooth.onBluetoothConnected": "Register code to run when the micro:bit is connected to over Bluetooth", "bluetooth.onBluetoothConnected": "Register code to run when the micro:bit is connected to over Bluetooth",
"bluetooth.onBluetoothConnected|param|body": "Code to run when a Bluetooth connection is established", "bluetooth.onBluetoothConnected|param|body": "Code to run when a Bluetooth connection is established",
"bluetooth.onBluetoothDisconnected": "Register code to run when a bluetooth connection to the micro:bit is lost", "bluetooth.onBluetoothDisconnected": "Register code to run when a bluetooth connection to the micro:bit is lost",

View File

@ -1,4 +1,6 @@
{ {
"bluetooth": "Unterstützung für zusätzliche Bluetooth-Dienste.",
"bluetooth.onBluetoothConnected|param|body": "Code, der ausgeführt wird, wenn eine Bluetooth-Verbindung aufgebaut wurde",
"bluetooth.uartWriteNumber": "Gibt einen numerischen Wert an die serielle", "bluetooth.uartWriteNumber": "Gibt einen numerischen Wert an die serielle",
"bluetooth.uartWriteValue": "Schreibt ein ``Namen: Wert`` Wertepaar auf die serielle Schnittstelle.", "bluetooth.uartWriteValue": "Schreibt ein ``Namen: Wert`` Wertepaar auf die serielle Schnittstelle.",
"bluetooth.uartWriteValue|param|name": "Name des Wertestreams, z.B.: x", "bluetooth.uartWriteValue|param|name": "Name des Wertestreams, z.B.: x",

View File

@ -1,7 +1,7 @@
/** /**
* Support for additional Bluetooth services. * Support for additional Bluetooth services.
*/ */
//% color=#0082FB weight=20 //% color=#0082FB weight=20 icon="\uf294"
namespace bluetooth { namespace bluetooth {
/** /**
* Writes to the Bluetooth UART service buffer. From there the data is transmitted over Bluetooth to a connected device. * Writes to the Bluetooth UART service buffer. From there the data is transmitted over Bluetooth to a connected device.

View File

@ -138,7 +138,7 @@ function getNoteName(frequency: number): string {
} }
} }
var notes = [ let notes = [
note(Note.E, BeatFraction.Quarter), note(Note.E, BeatFraction.Quarter), note(Note.F, BeatFraction.Quarter), note(Note.E, BeatFraction.Quarter), note(Note.E, BeatFraction.Quarter), note(Note.F, BeatFraction.Quarter),
note(Note.G, BeatFraction.Quarter), note(Note.G, BeatFraction.Quarter), note(Note.F, BeatFraction.Quarter), note(Note.G, BeatFraction.Quarter), note(Note.G, BeatFraction.Quarter), note(Note.F, BeatFraction.Quarter),
note(Note.E, BeatFraction.Quarter), note(Note.D, BeatFraction.Quarter), note(Note.C, BeatFraction.Quarter), note(Note.E, BeatFraction.Quarter), note(Note.D, BeatFraction.Quarter), note(Note.C, BeatFraction.Quarter),
@ -166,8 +166,8 @@ var notes = [
note(Note.C, BeatFraction.Eighth), note(Note.C, BeatFraction.Half) note(Note.C, BeatFraction.Eighth), note(Note.C, BeatFraction.Half)
]; ];
for (var t = 0; t < notes.length; t++) { for (let t = 0; t < notes.length; t++) {
music.playTone(notes[t][0], notes[t][1]); music.playTone(notes[t][0], notes[t][1]);
basic.showString(getNoteName(notes[t][0])); basic.showString(getNoteName(notes[t][0]));
music.rest(whole - notes[t][1]); music.rest(whole - notes[t][1]);
} }

View File

@ -26,7 +26,7 @@
"String.substr": "Return substring of the current string.", "String.substr": "Return substring of the current string.",
"String.substr|param|length": "number of characters to extract", "String.substr|param|length": "number of characters to extract",
"String.substr|param|start": "first character index; can be negative from counting from the end, eg:0", "String.substr|param|start": "first character index; can be negative from counting from the end, eg:0",
"basic": "Provides access to basic micro:bit functionality.", "basic": "Provides access to basic micro:bit functionality.\n\nProvides access to basic micro:bit functionality.",
"basic.clearScreen": "Turn off all LEDs", "basic.clearScreen": "Turn off all LEDs",
"basic.color": "Converts the color name to a number", "basic.color": "Converts the color name to a number",
"basic.forever": "Repeats the code forever in the background. On each iteration, allows other codes to run.", "basic.forever": "Repeats the code forever in the background. On each iteration, allows other codes to run.",
@ -230,6 +230,9 @@
"pins.servoWritePin": "Writes 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": "Writes 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", "pins.servoWritePin|param|name": "pin to write to",
"pins.servoWritePin|param|value": "angle or rotation speed, eg:180,90,0", "pins.servoWritePin|param|value": "angle or rotation speed, eg:180,90,0",
"pins.setEvents": "Configures 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",
"pins.setEvents|param|type": "the type of events for this pin to emit, eg: PinEventType.Edge",
"pins.setPull": "Configures the pull of this pin.", "pins.setPull": "Configures the pull of this pin.",
"pins.setPull|param|name": "pin to set the pull mode on", "pins.setPull|param|name": "pin to set the pull mode on",
"pins.setPull|param|pull": "one of the mbed pull configurations: PullUp, PullDown, PullNone ", "pins.setPull|param|pull": "one of the mbed pull configurations: PullUp, PullDown, PullNone ",
@ -238,8 +241,10 @@
"pins.spiWrite|param|value": "Data to be sent to the SPI slave", "pins.spiWrite|param|value": "Data to be sent to the SPI slave",
"serial": "Reading and writing data over a serial connection.", "serial": "Reading and writing data over a serial connection.",
"serial.delimiters": "Returns the delimiter corresponding string", "serial.delimiters": "Returns the delimiter corresponding string",
"serial.onLineReceived": "Registers an event to be fired when a line has been received", "serial.onDataReceived": "Registers an event to be fired when one of the delimiter is matched.",
"serial.onDataReceived|param|delimiters": "the characters to match received characters against.",
"serial.readLine": "Reads a line of text from the serial port.", "serial.readLine": "Reads a line of text from the serial port.",
"serial.readString": "Reads the buffered received data as a string",
"serial.readUntil": "Reads a line of text from the serial port and returns the buffer when the delimiter is met.", "serial.readUntil": "Reads a line of text from the serial port and returns the buffer when the delimiter is met.",
"serial.readUntil|param|delimiter": "text delimiter that separates each text chunk", "serial.readUntil|param|delimiter": "text delimiter that separates each text chunk",
"serial.redirect": "Dynamically configuring the serial instance to use pins other than USBTX and USBRX.", "serial.redirect": "Dynamically configuring the serial instance to use pins other than USBTX and USBRX.",

View File

@ -83,18 +83,22 @@
"Note.GSharp4|block": "G#4", "Note.GSharp4|block": "G#4",
"Note.GSharp5|block": "G#5", "Note.GSharp5|block": "G#5",
"Note.GSharp|block": "G#", "Note.GSharp|block": "G#",
"PinEventType.Edge|block": "edge",
"PinEventType.None|block": "none",
"PinEventType.Pulse|block": "pulse",
"PinEventType.Touch|block": "touch",
"PinPullMode.PullDown|block": "down", "PinPullMode.PullDown|block": "down",
"PinPullMode.PullNone|block": "none", "PinPullMode.PullNone|block": "none",
"PinPullMode.PullUp|block": "up", "PinPullMode.PullUp|block": "up",
"Rotation.Pitch|block": "pitch", "Rotation.Pitch|block": "pitch",
"Rotation.Roll|block": "roll", "Rotation.Roll|block": "roll",
"String.charAt|block": "char from %this|at %pos", "String.charAt|block": "char from %this=text|at %pos",
"String.compare|block": "compare %this| to %that", "String.compare|block": "compare %this=text| to %that",
"String.concat|block": "join %this|%other", "String.concat|block": "join %this=text|%other",
"String.fromCharCode|block": "text from char code %code", "String.fromCharCode|block": "text from char code %code",
"String.isEmpty|block": "%this| is empty", "String.isEmpty|block": "%this=text| is empty",
"String.length|block": "length of %VALUE", "String.length|block": "length of %VALUE",
"String.substr|block": "substring of %this|from %start|of length %length", "String.substr|block": "substring of %this=text|from %start|of length %length",
"String|block": "String", "String|block": "String",
"basic.clearScreen|block": "clear screen", "basic.clearScreen|block": "clear screen",
"basic.color|block": "%c", "basic.color|block": "%c",
@ -164,8 +168,10 @@
"music.setTempo|block": "set tempo to (bpm)|%value", "music.setTempo|block": "set tempo to (bpm)|%value",
"music.tempo|block": "tempo (bpm)", "music.tempo|block": "tempo (bpm)",
"music|block": "music", "music|block": "music",
"pins.analogPitch|block": "analog pitch %frequency|for (ms) %ms",
"pins.analogReadPin|block": "analog read|pin %name", "pins.analogReadPin|block": "analog read|pin %name",
"pins.analogSetPeriod|block": "analog set period|pin %pin|to (µs)%micros", "pins.analogSetPeriod|block": "analog set period|pin %pin|to (µs)%micros",
"pins.analogSetPitchPin|block": "analog set pitch pin %name",
"pins.analogWritePin|block": "analog write|pin %name|to %value", "pins.analogWritePin|block": "analog write|pin %name|to %value",
"pins.digitalReadPin|block": "digital read|pin %name", "pins.digitalReadPin|block": "digital read|pin %name",
"pins.digitalWritePin|block": "digital write|pin %name|to %value", "pins.digitalWritePin|block": "digital write|pin %name|to %value",
@ -177,11 +183,14 @@
"pins.pulseIn|block": "pulse in (µs)|pin %name|pulsed %value", "pins.pulseIn|block": "pulse in (µs)|pin %name|pulsed %value",
"pins.servoSetPulse|block": "servo set pulse|pin %value|to (µs) %micros", "pins.servoSetPulse|block": "servo set pulse|pin %value|to (µs) %micros",
"pins.servoWritePin|block": "servo write|pin %name|to %value", "pins.servoWritePin|block": "servo write|pin %name|to %value",
"pins.setEvents|block": "set pin %pin|to emit %type|events",
"pins.setPull|block": "set pull|pin %pin|to %pull", "pins.setPull|block": "set pull|pin %pin|to %pull",
"pins.spiWrite|block": "spi write %value", "pins.spiWrite|block": "spi write %value",
"pins|block": "pins", "pins|block": "pins",
"serial.delimiters|block": "%del", "serial.delimiters|block": "%del",
"serial.onDataReceived|block": "serial|on data received %delimiters=serial_delimiter_conv",
"serial.readLine|block": "serial|read line", "serial.readLine|block": "serial|read line",
"serial.readString|block": "serial|read string",
"serial.readUntil|block": "serial|read until %delimiter=serial_delimiter_conv", "serial.readUntil|block": "serial|read until %delimiter=serial_delimiter_conv",
"serial.redirect|block": "serial|redirect to|TX %tx|RX %rx|at baud rate %rate", "serial.redirect|block": "serial|redirect to|TX %tx|RX %rx|at baud rate %rate",
"serial.writeLine|block": "serial|write line %text", "serial.writeLine|block": "serial|write line %text",

View File

@ -71,7 +71,6 @@
"control.waitMicros|param|micros": "Anzahl der Mikrosekunden, die gewartet werden soll, z.B.: 4", "control.waitMicros|param|micros": "Anzahl der Mikrosekunden, die gewartet werden soll, z.B.: 4",
"game": "Eine Einzel-LED-Sprite-Spielumgebung", "game": "Eine Einzel-LED-Sprite-Spielumgebung",
"game.addLife": "Fügt Leben zum aktuellen Spielstand hinzu", "game.addLife": "Fügt Leben zum aktuellen Spielstand hinzu",
"game.addLife|param|lives": "TODO",
"game.addScore": "Fügt zum aktuellen Spielstand Punkte hinzu", "game.addScore": "Fügt zum aktuellen Spielstand Punkte hinzu",
"game.addScore|param|points": "Anzahl von zu verändernden Punkten, z.B.: 1", "game.addScore|param|points": "Anzahl von zu verändernden Punkten, z.B.: 1",
"game.createSprite": "Erzeugt einen neuen LED-Sprite, der nach rechts zeigt.", "game.createSprite": "Erzeugt einen neuen LED-Sprite, der nach rechts zeigt.",
@ -86,12 +85,9 @@
"game.levelUp": "Erhöht das Level und zeigt eine Nachricht an.", "game.levelUp": "Erhöht das Level und zeigt eine Nachricht an.",
"game.life": "Ruft das aktuelle Leben ab", "game.life": "Ruft das aktuelle Leben ab",
"game.removeLife": "Entfernt ein Leben", "game.removeLife": "Entfernt ein Leben",
"game.removeLife|param|life": "TODO",
"game.score": "Ruft den aktuellen Punktestand ab", "game.score": "Ruft den aktuellen Punktestand ab",
"game.setLife": "Setzt den aktuellen Wert der Leben", "game.setLife": "Setzt den aktuellen Wert der Leben",
"game.setLife|param|value": "TODO",
"game.setScore": "Setzt den aktuellen Wert des Spielstands", "game.setScore": "Setzt den aktuellen Wert des Spielstands",
"game.setScore|param|value": "TODO",
"game.showScore": "Zeigt den Spielstand auf dem Display.", "game.showScore": "Zeigt den Spielstand auf dem Display.",
"game.startCountdown": "Startet einen Spiel-Countdown", "game.startCountdown": "Startet einen Spiel-Countdown",
"game.startCountdown|param|ms": "Countdown-Dauer in Millisekunden, z.B.: 10000", "game.startCountdown|param|ms": "Countdown-Dauer in Millisekunden, z.B.: 10000",
@ -101,38 +97,24 @@
"images.createImage": "Erstellt ein Bild, das auf den LED-Bildschirm passt.", "images.createImage": "Erstellt ein Bild, das auf den LED-Bildschirm passt.",
"input": "Ereignisse und Daten der Sensoren", "input": "Ereignisse und Daten der Sensoren",
"input.acceleration": "Holt den Beschleunigungswert in Milli-Erdanziehung (wenn das Board flach mit dem Display nach oben liegt, X = 0, y = 0 und Z =-1024)", "input.acceleration": "Holt den Beschleunigungswert in Milli-Erdanziehung (wenn das Board flach mit dem Display nach oben liegt, X = 0, y = 0 und Z =-1024)",
"input.acceleration|param|dimension": "TODO",
"input.buttonIsPressed": "Erhalte den Sie den Tastenstatus (gepresst oder nicht) für ``A`` und ``B``.", "input.buttonIsPressed": "Erhalte den Sie den Tastenstatus (gepresst oder nicht) für ``A`` und ``B``.",
"input.calibrate": "Veraltet, Kompasskalibrierung erfolgt automatisch.", "input.calibrate": "Veraltet, Kompasskalibrierung erfolgt automatisch.",
"input.compassHeading": "Holt die aktuelle Kompassrichtung in Grad.", "input.compassHeading": "Holt die aktuelle Kompassrichtung in Grad.",
"input.lightLevel": "Liest die Lichtintensität auf dem LED-Bildschirm im Bereich von ``0`` (dunkel) und `` 255`` (hell).", "input.lightLevel": "Liest die Lichtintensität auf dem LED-Bildschirm im Bereich von ``0`` (dunkel) und `` 255`` (hell).",
"input.magneticForce": "Ruft den Wert der Magnetkraft in ``Mikro-Tesla`` (``µT``) ab. Diese Funktion wird im Simulator nicht unterstützt.", "input.magneticForce": "Ruft den Wert der Magnetkraft in ``Mikro-Tesla`` (``µT``) ab. Diese Funktion wird im Simulator nicht unterstützt.",
"input.magneticForce|param|dimension": "TODO",
"input.onButtonPressed": "Tue etwas, wenn eine Taste (``A``, ``B`` oder ``A + B``) gedrückt wird", "input.onButtonPressed": "Tue etwas, wenn eine Taste (``A``, ``B`` oder ``A + B``) gedrückt wird",
"input.onButtonPressed|param|body": "TODO",
"input.onButtonPressed|param|button": "TODO",
"input.onGesture": "Mache etwas, wenn eine Geste gemacht wird (wie den mini zu schütteln).", "input.onGesture": "Mache etwas, wenn eine Geste gemacht wird (wie den mini zu schütteln).",
"input.onGesture|param|body": "TODO",
"input.onLogoDown": "Fügt Code hinzu, der ausgeführt wird, wenn das Logo nach unten zeigt und das Board vertikal ausgerichtet ist.", "input.onLogoDown": "Fügt Code hinzu, der ausgeführt wird, wenn das Logo nach unten zeigt und das Board vertikal ausgerichtet ist.",
"input.onLogoDown|param|body": "TODO",
"input.onLogoUp": "Fügt Code hinzu, der ausgeführt wird, wenn das Logo nach oben zeigt und das Board vertikal ausgerichtet ist.", "input.onLogoUp": "Fügt Code hinzu, der ausgeführt wird, wenn das Logo nach oben zeigt und das Board vertikal ausgerichtet ist.",
"input.onLogoUp|param|body": "TODO",
"input.onPinPressed": "Mache etwas, wenn eine Pin gehalten wird.", "input.onPinPressed": "Mache etwas, wenn eine Pin gehalten wird.",
"input.onPinPressed|param|body": "Code, der ausführt wird, wenn ein Pin gehalten wird", "input.onPinPressed|param|body": "Code, der ausführt wird, wenn ein Pin gehalten wird",
"input.onPinPressed|param|name": "Der Pin, der gehalten werden muss",
"input.onPinReleased": "Mache etwas, wenn der Pin losgelassen wird.", "input.onPinReleased": "Mache etwas, wenn der Pin losgelassen wird.",
"input.onPinReleased|param|body": "Code, der ausgeführt werden soll, wenn der Pin losgelassen wird", "input.onPinReleased|param|body": "Code, der ausgeführt werden soll, wenn der Pin losgelassen wird",
"input.onPinReleased|param|name": "Der Pin, der losgelassen werden muss",
"input.onScreenDown": "Hängt Code an, der ausgeführt wird, wenn der Bildschirm nach unten zeigt.", "input.onScreenDown": "Hängt Code an, der ausgeführt wird, wenn der Bildschirm nach unten zeigt.",
"input.onScreenDown|param|body": "TODO",
"input.onScreenUp": "Hängt Code an, der ausgeführt wird, wenn der Bildschirm nach oben zeigt.", "input.onScreenUp": "Hängt Code an, der ausgeführt wird, wenn der Bildschirm nach oben zeigt.",
"input.onScreenUp|param|body": "TODO",
"input.onShake": "Hängt Code an, der ausgeführt wird, wenn der mini geschüttelt wird.", "input.onShake": "Hängt Code an, der ausgeführt wird, wenn der mini geschüttelt wird.",
"input.onShake|param|body": "TODO",
"input.pinIsPressed": "Ruft den Pin-Zustand (gehalten oder nicht) ab. Die Erdung muss gehalten werden, um den Stromkreis zu schließen.", "input.pinIsPressed": "Ruft den Pin-Zustand (gehalten oder nicht) ab. Die Erdung muss gehalten werden, um den Stromkreis zu schließen.",
"input.pinIsPressed|param|name": "Pin, der verwendet wird, um eine Berührung zu erkennen",
"input.rotation": "Die Neigung und Drehung des mini Drehung auf ``X-Achse``oder ``Y-Achse``, in Grad.", "input.rotation": "Die Neigung und Drehung des mini Drehung auf ``X-Achse``oder ``Y-Achse``, in Grad.",
"input.rotation|param|kind": "TODO",
"input.runningTime": "Ruft die Anzahl der Millisekunden auf, die seit dem Einschalten vergangen sind.", "input.runningTime": "Ruft die Anzahl der Millisekunden auf, die seit dem Einschalten vergangen sind.",
"input.setAccelerometerRange": "Legt die Stichprobenbereich des Beschleunigungssensors in Schwerkraft fest.", "input.setAccelerometerRange": "Legt die Stichprobenbereich des Beschleunigungssensors in Schwerkraft fest.",
"input.setAccelerometerRange|param|range": "Ein Wert, der die maximale Stärke der gemessenen Beschleunigung beschreibt", "input.setAccelerometerRange|param|range": "Ein Wert, der die maximale Stärke der gemessenen Beschleunigung beschreibt",
@ -141,19 +123,13 @@
"led.brightness": "Ruft die Helligkeit des Bildschirms ab, von 0 (aus) bis 255 (volle Helligkeit).", "led.brightness": "Ruft die Helligkeit des Bildschirms ab, von 0 (aus) bis 255 (volle Helligkeit).",
"led.enable": "Schaltet das Display an und aus", "led.enable": "Schaltet das Display an und aus",
"led.fadeIn": "Blendet die Bildschirmanzeige ein.", "led.fadeIn": "Blendet die Bildschirmanzeige ein.",
"led.fadeIn|param|ms": "TODO",
"led.fadeOut": "Blendet die Bildschirmhelligkeit aus.", "led.fadeOut": "Blendet die Bildschirmhelligkeit aus.",
"led.fadeOut|param|ms": "TODO",
"led.plot": "Schalte die angegebene LED mit Hilfe von X- und Y-Koordinaten ein (X ist horizontal, Y ist vertikal). (0,0) ist die obere linke Ecke.", "led.plot": "Schalte die angegebene LED mit Hilfe von X- und Y-Koordinaten ein (X ist horizontal, Y ist vertikal). (0,0) ist die obere linke Ecke.",
"led.plotAll": "Schaltet alle LEDs an", "led.plotAll": "Schaltet alle LEDs an",
"led.plotBarGraph": "Zeigt ein vertikales Balkendiagramm an, basierend auf dem `Wert`und dem `Hoch`-Wert. Wenn `Hoch`0 ist, wird das Diagramm automatisch angepasst.", "led.plotBarGraph": "Zeigt ein vertikales Balkendiagramm an, basierend auf dem `Wert`und dem `Hoch`-Wert. Wenn `Hoch`0 ist, wird das Diagramm automatisch angepasst.",
"led.plotBarGraph|param|high": "maximalen Wert. Wenn dieser 0 ist, wird der Maximalwert automatisch angepasst, z.B.: 0", "led.plotBarGraph|param|high": "maximalen Wert. Wenn dieser 0 ist, wird der Maximalwert automatisch angepasst, z.B.: 0",
"led.plotBarGraph|param|value": "aktueller Wert zum Darstellen", "led.plotBarGraph|param|value": "aktueller Wert zum Darstellen",
"led.plot|param|x": "TODO",
"led.plot|param|y": "TODO",
"led.point": "Ruft den An/Aus-Status einer vorgegebenen LED mittels X-/Y-Koordinaten ab. (0,0) ist oben links.", "led.point": "Ruft den An/Aus-Status einer vorgegebenen LED mittels X-/Y-Koordinaten ab. (0,0) ist oben links.",
"led.point|param|x": "TODO",
"led.point|param|y": "TODO",
"led.screenshot": "Macht einen Screenshot vom LED-Bildschirm und gibt ein Bild aus.", "led.screenshot": "Macht einen Screenshot vom LED-Bildschirm und gibt ein Bild aus.",
"led.setBrightness": "Lege die Helligkeit des Bildschirms fest, von 0 (aus) bis 255 (volle Helligkeit).", "led.setBrightness": "Lege die Helligkeit des Bildschirms fest, von 0 (aus) bis 255 (volle Helligkeit).",
"led.setBrightness|param|value": "Helligkeitswert, z.B.: 255, 127, 0", "led.setBrightness|param|value": "Helligkeitswert, z.B.: 255, 127, 0",
@ -162,11 +138,7 @@
"led.stopAnimation": "Bricht die aktuelle Animation ab und löscht andere ausstehende Animationen.", "led.stopAnimation": "Bricht die aktuelle Animation ab und löscht andere ausstehende Animationen.",
"led.toggle": "Schaltet ein bestimmtes Pixel ein", "led.toggle": "Schaltet ein bestimmtes Pixel ein",
"led.toggleAll": "Invertiert die aktuelle LED-Anzeige", "led.toggleAll": "Invertiert die aktuelle LED-Anzeige",
"led.toggle|param|x": "TODO",
"led.toggle|param|y": "TODO",
"led.unplot": "Schalte die angegebene LED mit x-und y-Koordinaten ab (X ist horizontal, y ist vertikal). (0,0) ist oben links.", "led.unplot": "Schalte die angegebene LED mit x-und y-Koordinaten ab (X ist horizontal, y ist vertikal). (0,0) ist oben links.",
"led.unplot|param|x": "TODO",
"led.unplot|param|y": "TODO",
"motors": "Blöcke, die genutzt werden, um Onboard-Motoren zu steuern", "motors": "Blöcke, die genutzt werden, um Onboard-Motoren zu steuern",
"motors.dualMotorPower": "Steuert zwei an das Board angeschlossene Motoren. Schaltet auf Dual-Motor-Modus um!", "motors.dualMotorPower": "Steuert zwei an das Board angeschlossene Motoren. Schaltet auf Dual-Motor-Modus um!",
"motors.motorCommand": "Schicke Anhalten, Ausrollen oder Anhalten-Befehle an den Motor. Hat im Dual-Motor-Modus keinen Effekt.", "motors.motorCommand": "Schicke Anhalten, Ausrollen oder Anhalten-Befehle an den Motor. Hat im Dual-Motor-Modus keinen Effekt.",
@ -177,7 +149,6 @@
"music.changeTempoBy": "Ändere die Geschwindigkeit um den angegebenen Betrag", "music.changeTempoBy": "Ändere die Geschwindigkeit um den angegebenen Betrag",
"music.changeTempoBy|param|bpm": "Die Änderung in Schlägen pro Minute auf das Tempo, z.B.: 20", "music.changeTempoBy|param|bpm": "Die Änderung in Schlägen pro Minute auf das Tempo, z.B.: 20",
"music.noteFrequency": "Ruft die Frequenz einer Note ab.", "music.noteFrequency": "Ruft die Frequenz einer Note ab.",
"music.noteFrequency|param|name": "der Name der Notiz",
"music.playTone": "Spielt einen Ton für den angegebenen Zeitraum auf dem Lautsprecher ab.", "music.playTone": "Spielt einen Ton für den angegebenen Zeitraum auf dem Lautsprecher ab.",
"music.playTone|param|ms": "Tondauer in Millisekunden (ms)", "music.playTone|param|ms": "Tondauer in Millisekunden (ms)",
"music.rest": "Ruht (spielt nichts) für eine bestimmte Zeit auf Pin ``P0``.", "music.rest": "Ruht (spielt nichts) für eine bestimmte Zeit auf Pin ``P0``.",
@ -189,24 +160,15 @@
"music.tempo": "Gibt die Geschwindigkeit in Schlägen pro Minute aus. Die Geschwindigkeit ist Schnelligkeit (Bpm = Beats pro Minute), in der Töne abgespielt werden. Je größer der Wert, desto schneller werden die Töne abgespielt.", "music.tempo": "Gibt die Geschwindigkeit in Schlägen pro Minute aus. Die Geschwindigkeit ist Schnelligkeit (Bpm = Beats pro Minute), in der Töne abgespielt werden. Je größer der Wert, desto schneller werden die Töne abgespielt.",
"pins": "Steuere die Stromstärke über die Pins für analoge/digitale Signale, Servos, I2C,...", "pins": "Steuere die Stromstärke über die Pins für analoge/digitale Signale, Servos, I2C,...",
"pins.analogPitch": "Gibt ein Pulsweiten Modulation (PWM)-Signal über den aktuellen Pitch-Pin. Benutze `analog set pitch pin`, um den Pitch-Pin festzulegen.", "pins.analogPitch": "Gibt ein Pulsweiten Modulation (PWM)-Signal über den aktuellen Pitch-Pin. Benutze `analog set pitch pin`, um den Pitch-Pin festzulegen.",
"pins.analogPitch|param|frequency": "TODO",
"pins.analogPitch|param|ms": "TODO",
"pins.analogReadPin": "Lese den Anschlusswert als Analog aus, d. h. als einen Wert zwischen 0 und 1023.", "pins.analogReadPin": "Lese den Anschlusswert als Analog aus, d. h. als einen Wert zwischen 0 und 1023.",
"pins.analogReadPin|param|name": "Pin, auf den geschrieben werden soll",
"pins.analogSetPeriod": "Stellt die Pulsweite Modulation (PWM) des Analogausganges auf den angegebenen Wert in ** Mikrosekunden ** oder `1/1000` Millisekunden ein.\nWenn dieser Pin nicht als einen Analogausgang (mit `analog write pin`) konfiguriert ist, hat der Vorgang keine Auswirkungen.", "pins.analogSetPeriod": "Stellt die Pulsweite Modulation (PWM) des Analogausganges auf den angegebenen Wert in ** Mikrosekunden ** oder `1/1000` Millisekunden ein.\nWenn dieser Pin nicht als einen Analogausgang (mit `analog write pin`) konfiguriert ist, hat der Vorgang keine Auswirkungen.",
"pins.analogSetPeriod|param|micros": "Zeit in Mikrosekunden. z.B.: 20000", "pins.analogSetPeriod|param|micros": "Zeit in Mikrosekunden. z.B.: 20000",
"pins.analogSetPeriod|param|name": "analoger Pin, der zeitlich festgelegt werden soll",
"pins.analogSetPitchPin": "Setzt den genutzten Pin, wenn `pins->analog pitch`angewendet wird.",
"pins.analogSetPitchPin|param|name": "TODO",
"pins.analogWritePin": "Legt den Wert des Verbinders auf analog fest. Der Wert muss zwischen 0 und 1023 liegen.", "pins.analogWritePin": "Legt den Wert des Verbinders auf analog fest. Der Wert muss zwischen 0 und 1023 liegen.",
"pins.analogWritePin|param|name": "PIN-Name, auf den geschrieben werden soll",
"pins.analogWritePin|param|value": "Wert, der auf den Pin geschrieben werden soll, zwischen ``0`` und ``1023`` z.B.: 1023,0", "pins.analogWritePin|param|value": "Wert, der auf den Pin geschrieben werden soll, zwischen ``0`` und ``1023`` z.B.: 1023,0",
"pins.createBuffer": "Erstellt einen Null-initialisierten Zwischenspeicher.", "pins.createBuffer": "Erstellt einen Null-initialisierten Zwischenspeicher.",
"pins.createBuffer|param|size": "Anzahl der Bytes im Zwischenspeicher", "pins.createBuffer|param|size": "Anzahl der Bytes im Zwischenspeicher",
"pins.digitalReadPin": "Lese den angegebene Pin oder Verbinder als 0 oder 1", "pins.digitalReadPin": "Lese den angegebene Pin oder Verbinder als 0 oder 1",
"pins.digitalReadPin|param|name": "Pin, aus dem gelesen werden soll",
"pins.digitalWritePin": "Setzt einen Pin- oder Verbinder-Wert auf 0 oder 1.", "pins.digitalWritePin": "Setzt einen Pin- oder Verbinder-Wert auf 0 oder 1.",
"pins.digitalWritePin|param|name": "Pin, auf den geschrieben werden soll",
"pins.digitalWritePin|param|value": "Wert, der auf dem Pin 1 gesetzt werden soll, z.B. 0", "pins.digitalWritePin|param|value": "Wert, der auf dem Pin 1 gesetzt werden soll, z.B. 0",
"pins.i2cReadBuffer": "Lese `Größe`bytes aus einer 7-bit I2C-Adresse.", "pins.i2cReadBuffer": "Lese `Größe`bytes aus einer 7-bit I2C-Adresse.",
"pins.i2cReadNumber": "Lese eine Nummer aus einer 7-bit I2C-Adresse.", "pins.i2cReadNumber": "Lese eine Nummer aus einer 7-bit I2C-Adresse.",
@ -227,11 +189,8 @@
"pins.servoSetPulse|param|micros": "Impulsdauer in Mikrosekunden, z.B.: 1500", "pins.servoSetPulse|param|micros": "Impulsdauer in Mikrosekunden, z.B.: 1500",
"pins.servoSetPulse|param|name": "PIN-Name", "pins.servoSetPulse|param|name": "PIN-Name",
"pins.servoWritePin": "Schreibt einen Wert in den Servo, der die Welle entsprechend kontroliert. Auf einem Standard-Servo wird so der Winkel der Welle (in Grad) eingestellt, sodass sich die Welle entsprechend anpasst. Auf einem kontinuierlich drehenden Servo wird dadurch die Geschwindigkeit des Servos festgelegt, wobei ``0``die volle Geschwindigkeit in eine Richtung darstellt, ``180``die volle Geschwindigkeit in die andere, und ein Wert von ``90`` einen Stillstand erzeugt.", "pins.servoWritePin": "Schreibt einen Wert in den Servo, der die Welle entsprechend kontroliert. Auf einem Standard-Servo wird so der Winkel der Welle (in Grad) eingestellt, sodass sich die Welle entsprechend anpasst. Auf einem kontinuierlich drehenden Servo wird dadurch die Geschwindigkeit des Servos festgelegt, wobei ``0``die volle Geschwindigkeit in eine Richtung darstellt, ``180``die volle Geschwindigkeit in die andere, und ein Wert von ``90`` einen Stillstand erzeugt.",
"pins.servoWritePin|param|name": "Pin, auf den geschrieben werden soll",
"pins.servoWritePin|param|value": "Winkel oder Rotationsbeschleunigung, z.B.: 180,90,0", "pins.servoWritePin|param|value": "Winkel oder Rotationsbeschleunigung, z.B.: 180,90,0",
"pins.setPull": "Stellt die Anziehungskraft des Pins ein.", "pins.setPull": "Stellt die Anziehungskraft des Pins ein.",
"pins.setPull|param|name": "Pin, auf dem der Pull-Modus aktiviert wird",
"pins.setPull|param|pull": "eine der mbed-Pull-Konfigurationen: PullUp, PullDown, PullNone",
"pins.sizeOf": "Ruft die Bytegröße im spezifierten Nummernformat ab.", "pins.sizeOf": "Ruft die Bytegröße im spezifierten Nummernformat ab.",
"pins.spiWrite": "Schreibe in den SPI-Slave und gebe die Antwort aus", "pins.spiWrite": "Schreibe in den SPI-Slave und gebe die Antwort aus",
"pins.spiWrite|param|value": "Daten, die an den SPI-Slave geschickt werden sollen", "pins.spiWrite|param|value": "Daten, die an den SPI-Slave geschickt werden sollen",
@ -242,8 +201,6 @@
"serial.readUntil": "Liest aus eine Textzeile aus dem seriellen Anschluss und gibt den Puffer aus, wenn die Begrenzung erreicht wurde.", "serial.readUntil": "Liest aus eine Textzeile aus dem seriellen Anschluss und gibt den Puffer aus, wenn die Begrenzung erreicht wurde.",
"serial.readUntil|param|delimiter": "Text-Begrenzung, die die Textblöcke voneinander trennt", "serial.readUntil|param|delimiter": "Text-Begrenzung, die die Textblöcke voneinander trennt",
"serial.redirect": "Konfiguriert dynamisch die serielle Instanz, damit sie andere Pins als USBTX und USBRX benutzt.", "serial.redirect": "Konfiguriert dynamisch die serielle Instanz, damit sie andere Pins als USBTX und USBRX benutzt.",
"serial.redirect|param|rx": "der neue Empfangs-Pin",
"serial.redirect|param|tx": "Der neue Übertragungs-Pin",
"serial.writeLine": "Gibt eine Zeile des Textes an die serielle", "serial.writeLine": "Gibt eine Zeile des Textes an die serielle",
"serial.writeNumber": "Gibt einen numerischen Wert an die serielle", "serial.writeNumber": "Gibt einen numerischen Wert an die serielle",
"serial.writeString": "Sendet ein Stück Text über serielle Verbindung.", "serial.writeString": "Sendet ein Stück Text über serielle Verbindung.",

View File

@ -4,12 +4,12 @@
/** /**
* Provides access to basic micro:bit functionality. * Provides access to basic micro:bit functionality.
*/ */
//% color=#54C9C9 weight=100 //% color=#54C9C9 weight=100 icon="\uf00a"
namespace basic { namespace basic {
/** /**
* Sets the color on the build-in LED. Set to 0 to turn off. * Sets the color on the build-in LED. Set to 0 to turn off.
*/ */
//% blockId=device_set_led_color block="set led to %color=color_id" icon="\uf00a" //% blockId=device_set_led_color block="set led to %color=color_id"
//% weight=50 //% weight=50
void setLedColor(int color) { void setLedColor(int color) {
if (!color) { if (!color) {
@ -31,7 +31,7 @@ namespace basic {
*/ */
//% help=basic/show-number //% help=basic/show-number
//% weight=96 //% weight=96
//% blockId=device_show_number block="show|number %number" blockGap=8 icon="\uf1ec" //% blockId=device_show_number block="show|number %number" blockGap=8
//% async //% async
//% parts="ledmatrix" //% parts="ledmatrix"
void showNumber(int value, int interval = 150) { void showNumber(int value, int interval = 150) {
@ -55,7 +55,7 @@ namespace basic {
//% weight=95 blockGap=8 //% weight=95 blockGap=8
//% imageLiteral=1 async //% imageLiteral=1 async
//% blockId=device_show_leds //% blockId=device_show_leds
//% block="show leds" icon="\uf00a" //% block="show leds"
//% parts="ledmatrix" //% parts="ledmatrix"
void showLeds(ImageLiteral leds, int interval = 400) { void showLeds(ImageLiteral leds, int interval = 400) {
uBit.display.print(MicroBitImage(imageBytes(leds)), 0, 0, 0, interval); uBit.display.print(MicroBitImage(imageBytes(leds)), 0, 0, 0, interval);
@ -68,7 +68,7 @@ namespace basic {
*/ */
//% help=basic/show-string //% help=basic/show-string
//% weight=87 blockGap=8 //% weight=87 blockGap=8
//% block="show|string %text" icon="\uf031" //% block="show|string %text"
//% async //% async
//% blockId=device_print_message //% blockId=device_print_message
//% parts="ledmatrix" //% parts="ledmatrix"
@ -91,7 +91,7 @@ namespace basic {
* Turn off all LEDs * Turn off all LEDs
*/ */
//% help=basic/clear-screen weight=79 //% help=basic/clear-screen weight=79
//% blockId=device_clear_display block="clear screen" icon="\uf12d" //% blockId=device_clear_display block="clear screen"
//% parts="ledmatrix" //% parts="ledmatrix"
void clearScreen() { void clearScreen() {
uBit.display.image.clear(); uBit.display.image.clear();
@ -131,7 +131,7 @@ namespace basic {
* @param body code to execute * @param body code to execute
*/ */
//% help=basic/forever weight=55 blockGap=8 //% help=basic/forever weight=55 blockGap=8
//% blockId=device_forever block="forever" icon="\uf01e" //% blockId=device_forever block="forever"
void forever(Action a) { void forever(Action a) {
if (a != 0) { if (a != 0) {
incr(a); incr(a);
@ -145,7 +145,7 @@ namespace basic {
*/ */
//% help=basic/pause weight=54 //% help=basic/pause weight=54
//% async block="pause (ms) %pause" //% async block="pause (ms) %pause"
//% blockId=device_pause icon="\uf110" //% blockId=device_pause
void pause(int ms) { void pause(int ms) {
fiber_sleep(ms); fiber_sleep(ms);
} }

View File

@ -34,17 +34,18 @@ enum EventBusSource {
MICROBIT_ID_IO_P5_ = MICROBIT_ID_IO_P5, MICROBIT_ID_IO_P5_ = MICROBIT_ID_IO_P5,
MICROBIT_ID_IO_P6_ = MICROBIT_ID_IO_P6, MICROBIT_ID_IO_P6_ = MICROBIT_ID_IO_P6,
MICROBIT_ID_IO_P7_ = MICROBIT_ID_IO_P7, MICROBIT_ID_IO_P7_ = MICROBIT_ID_IO_P7,
//MICROBIT_ID_IO_P8_ = MICROBIT_ID_IO_P8, MICROBIT_ID_IO_P8_ = MICROBIT_ID_IO_P8,
MICROBIT_ID_IO_P9_ = MICROBIT_ID_IO_P9, MICROBIT_ID_IO_P9_ = MICROBIT_ID_IO_P9,
MICROBIT_ID_IO_P10_ = MICROBIT_ID_IO_P10, MICROBIT_ID_IO_P10_ = MICROBIT_ID_IO_P10,
MICROBIT_ID_IO_P11_ = MICROBIT_ID_IO_P11, MICROBIT_ID_IO_P11_ = MICROBIT_ID_IO_P11,
//MICROBIT_ID_IO_P12_ = MICROBIT_ID_IO_P12, MICROBIT_ID_IO_P12_ = MICROBIT_ID_IO_P12,
//MICROBIT_ID_IO_P13_ = MICROBIT_ID_IO_P13, MICROBIT_ID_IO_P13_ = MICROBIT_ID_IO_P13,
//MICROBIT_ID_IO_P14_ = MICROBIT_ID_IO_P14, MICROBIT_ID_IO_P14_ = MICROBIT_ID_IO_P14,
//MICROBIT_ID_IO_P15_ = MICROBIT_ID_IO_P15, MICROBIT_ID_IO_P15_ = MICROBIT_ID_IO_P15,
//MICROBIT_ID_IO_P16_ = MICROBIT_ID_IO_P16, MICROBIT_ID_IO_P16_ = MICROBIT_ID_IO_P16,
MICROBIT_ID_IO_P19_ = MICROBIT_ID_IO_P19, MICROBIT_ID_IO_P19_ = MICROBIT_ID_IO_P19,
MICROBIT_ID_IO_P20_ = MICROBIT_ID_IO_P20, MICROBIT_ID_IO_P20_ = MICROBIT_ID_IO_P20,
MICROBIT_ID_IO_P21_ = MICROBIT_ID_IO_P21,
MES_DEVICE_INFO_ID_ = MES_DEVICE_INFO_ID, MES_DEVICE_INFO_ID_ = MES_DEVICE_INFO_ID,
MES_SIGNAL_STRENGTH_ID_ = MES_SIGNAL_STRENGTH_ID, MES_SIGNAL_STRENGTH_ID_ = MES_SIGNAL_STRENGTH_ID,
MES_DPAD_CONTROLLER_ID_ = MES_DPAD_CONTROLLER_ID, MES_DPAD_CONTROLLER_ID_ = MES_DPAD_CONTROLLER_ID,
@ -56,6 +57,10 @@ enum EventBusValue {
MICROBIT_BUTTON_EVT_CLICK_ = MICROBIT_BUTTON_EVT_CLICK, MICROBIT_BUTTON_EVT_CLICK_ = MICROBIT_BUTTON_EVT_CLICK,
MICROBIT_RADIO_EVT_DATAGRAM_ = MICROBIT_RADIO_EVT_DATAGRAM, MICROBIT_RADIO_EVT_DATAGRAM_ = MICROBIT_RADIO_EVT_DATAGRAM,
MICROBIT_ACCELEROMETER_EVT_DATA_UPDATE_ = MICROBIT_ACCELEROMETER_EVT_DATA_UPDATE, MICROBIT_ACCELEROMETER_EVT_DATA_UPDATE_ = MICROBIT_ACCELEROMETER_EVT_DATA_UPDATE,
MICROBIT_PIN_EVT_RISE_ = MICROBIT_PIN_EVT_RISE,
MICROBIT_PIN_EVT_FALL_ = MICROBIT_PIN_EVT_FALL,
MICROBIT_PIN_EVT_PULSE_HI_ = MICROBIT_PIN_EVT_PULSE_HI,
MICROBIT_PIN_EVT_PULSE_LO_ = MICROBIT_PIN_EVT_PULSE_LO,
MES_ALERT_EVT_ALARM1_ = MES_ALERT_EVT_ALARM1, MES_ALERT_EVT_ALARM1_ = MES_ALERT_EVT_ALARM1,
MES_ALERT_EVT_ALARM2_ = MES_ALERT_EVT_ALARM2, MES_ALERT_EVT_ALARM2_ = MES_ALERT_EVT_ALARM2,
MES_ALERT_EVT_ALARM3_ = MES_ALERT_EVT_ALARM3, MES_ALERT_EVT_ALARM3_ = MES_ALERT_EVT_ALARM3,

View File

@ -1,7 +1,7 @@
/** /**
* Runtime and event utilities. * Runtime and event utilities.
*/ */
//% weight=1 color="#42495F" //% weight=1 color="#42495F" icon="\uf233"
//% advanced=true //% advanced=true
namespace control { namespace control {

View File

@ -21,7 +21,12 @@ namespace String_ {
//% //%
int compare(StringData *s, StringData *that) { int compare(StringData *s, StringData *that) {
return strcmp(s->data, that->data); int compareResult = strcmp(s->data, that->data);
if (compareResult < 0)
return -1;
else if (compareResult > 0)
return 1;
return 0;
} }
//% //%
@ -76,7 +81,7 @@ namespace Boolean_ {
} }
//% //%
bool bang(bool v) { return !v; } bool bang(int v) { return v == 0; }
} }
namespace Number_ { namespace Number_ {
@ -153,13 +158,19 @@ namespace Array_ {
//% //%
int length(RefCollection *c) { return c->length(); } int length(RefCollection *c) { return c->length(); }
//% //%
void setLength(RefCollection *c, int newLength) { c->setLength(newLength); }
//%
void push(RefCollection *c, uint32_t x) { c->push(x); } void push(RefCollection *c, uint32_t x) { c->push(x); }
//% //%
uint32_t pop(RefCollection *c) { return c->pop(); }
//%
uint32_t getAt(RefCollection *c, int x) { return c->getAt(x); } uint32_t getAt(RefCollection *c, int x) { return c->getAt(x); }
//% //%
void removeAt(RefCollection *c, int x) { c->removeAt(x); } void setAt(RefCollection *c, int x, uint32_t y) { c->setAt(x, y); }
//% //%
void setAt(RefCollection *c, int x, uint32_t y) { c->setAt(x, y); } uint32_t removeAt(RefCollection *c, int x) { return c->removeAt(x); }
//%
void insertAt(RefCollection *c, int x, uint32_t value) { c->insertAt(x, value); }
//% //%
int indexOf(RefCollection *c, uint32_t x, int start) { return c->indexOf(x, start); } int indexOf(RefCollection *c, uint32_t x, int start) { return c->indexOf(x, start); }
//% //%

49
libs/core/dal.d.ts vendored
View File

@ -79,12 +79,15 @@ declare const enum DAL {
MICROBIT_BLE_PAIRING_TIMEOUT = 90, MICROBIT_BLE_PAIRING_TIMEOUT = 90,
MICROBIT_BLE_POWER_LEVELS = 8, MICROBIT_BLE_POWER_LEVELS = 8,
MICROBIT_BLE_MAXIMUM_BONDS = 4, MICROBIT_BLE_MAXIMUM_BONDS = 4,
MICROBIT_BLE_EDDYSTONE_URL_ADV_INTERVAL = 400, MICROBIT_BLE_EDDYSTONE_ADV_INTERVAL = 400,
MICROBIT_BLE_EDDYSTONE_DEFAULT_POWER = 0xF0,
MICROBIT_BLE_DISCONNECT_AFTER_PAIRING_DELAY = 500,
// built/yt/yotta_modules/microbit-dal/inc/bluetooth/MicroBitButtonService.h // built/yt/yotta_modules/microbit-dal/inc/bluetooth/MicroBitButtonService.h
// built/yt/yotta_modules/microbit-dal/inc/bluetooth/MicroBitDFUService.h // built/yt/yotta_modules/microbit-dal/inc/bluetooth/MicroBitDFUService.h
MICROBIT_DFU_OPCODE_START_DFU = 1, MICROBIT_DFU_OPCODE_START_DFU = 1,
MICROBIT_DFU_HISTOGRAM_WIDTH = 5, MICROBIT_DFU_HISTOGRAM_WIDTH = 5,
MICROBIT_DFU_HISTOGRAM_HEIGHT = 5, MICROBIT_DFU_HISTOGRAM_HEIGHT = 5,
// built/yt/yotta_modules/microbit-dal/inc/bluetooth/MicroBitEddystone.h
// built/yt/yotta_modules/microbit-dal/inc/bluetooth/MicroBitEventService.h // built/yt/yotta_modules/microbit-dal/inc/bluetooth/MicroBitEventService.h
// built/yt/yotta_modules/microbit-dal/inc/bluetooth/MicroBitIOPinService.h // built/yt/yotta_modules/microbit-dal/inc/bluetooth/MicroBitIOPinService.h
MICROBIT_IO_PIN_SERVICE_PINCOUNT = 19, MICROBIT_IO_PIN_SERVICE_PINCOUNT = 19,
@ -124,7 +127,6 @@ declare const enum DAL {
MICROBIT_ID_ACCELEROMETER = 4, MICROBIT_ID_ACCELEROMETER = 4,
MICROBIT_ID_COMPASS = 5, MICROBIT_ID_COMPASS = 5,
MICROBIT_ID_DISPLAY = 6, MICROBIT_ID_DISPLAY = 6,
MICROBIT_IO_PINS = 20,
MICROBIT_ID_IO_P0 = 7, MICROBIT_ID_IO_P0 = 7,
MICROBIT_ID_IO_P1 = 8, MICROBIT_ID_IO_P1 = 8,
MICROBIT_ID_IO_P2 = 9, MICROBIT_ID_IO_P2 = 9,
@ -133,11 +135,18 @@ declare const enum DAL {
MICROBIT_ID_IO_P5 = 12, MICROBIT_ID_IO_P5 = 12,
MICROBIT_ID_IO_P6 = 13, MICROBIT_ID_IO_P6 = 13,
MICROBIT_ID_IO_P7 = 14, MICROBIT_ID_IO_P7 = 14,
MICROBIT_ID_IO_P8 = 15,
MICROBIT_ID_IO_P9 = 16, MICROBIT_ID_IO_P9 = 16,
MICROBIT_ID_IO_P10 = 17, MICROBIT_ID_IO_P10 = 17,
MICROBIT_ID_IO_P11 = 18, MICROBIT_ID_IO_P11 = 18,
MICROBIT_ID_IO_P12 = 19,
MICROBIT_ID_IO_P13 = 20,
MICROBIT_ID_IO_P14 = 21,
MICROBIT_ID_IO_P15 = 22,
MICROBIT_ID_IO_P16 = 23,
MICROBIT_ID_IO_P19 = 24, MICROBIT_ID_IO_P19 = 24,
MICROBIT_ID_IO_P20 = 25, MICROBIT_ID_IO_P20 = 25,
MICROBIT_ID_IO_P21 = 50,
MICROBIT_ID_BUTTON_AB = 26, MICROBIT_ID_BUTTON_AB = 26,
MICROBIT_ID_GESTURE = 27, MICROBIT_ID_GESTURE = 27,
MICROBIT_ID_THERMOMETER = 28, MICROBIT_ID_THERMOMETER = 28,
@ -145,17 +154,6 @@ declare const enum DAL {
MICROBIT_ID_RADIO_DATA_READY = 30, MICROBIT_ID_RADIO_DATA_READY = 30,
MICROBIT_ID_MULTIBUTTON_ATTACH = 31, MICROBIT_ID_MULTIBUTTON_ATTACH = 31,
MICROBIT_ID_SERIAL = 32, MICROBIT_ID_SERIAL = 32,
CALLIOPE_ID_IO_P3 = 33,
CALLIOPE_ID_IO_P7 = 34,
CALLIOPE_ID_IO_P8 = 35,
CALLIOPE_ID_IO_P9 = 36,
CALLIOPE_ID_IO_P13 = 37,
CALLIOPE_ID_IO_P14 = 38,
CALLIOPE_ID_IO_P15 = 39,
CALLIOPE_ID_IO_P22 = 40,
CALLIOPE_ID_IO_P28 = 41,
CALLIOPE_ID_IO_P29 = 42,
CALLIOPE_ID_IO_P30 = 43,
MICROBIT_ID_MESSAGE_BUS_LISTENER = 1021, MICROBIT_ID_MESSAGE_BUS_LISTENER = 1021,
MICROBIT_ID_NOTIFY_ONE = 1022, MICROBIT_ID_NOTIFY_ONE = 1022,
MICROBIT_ID_NOTIFY = 1023, MICROBIT_ID_NOTIFY = 1023,
@ -513,6 +511,30 @@ declare const enum DAL {
MICROBIT_DISPLAY_ROTATION_90 = 1, MICROBIT_DISPLAY_ROTATION_90 = 1,
MICROBIT_DISPLAY_ROTATION_180 = 2, MICROBIT_DISPLAY_ROTATION_180 = 2,
MICROBIT_DISPLAY_ROTATION_270 = 3, MICROBIT_DISPLAY_ROTATION_270 = 3,
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitFile.h
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitFileSystem.h
MBFS_FILENAME_LENGTH = 16,
MB_READ = 0x01,
MB_WRITE = 0x02,
MB_CREAT = 0x04,
MB_APPEND = 0x08,
MB_SEEK_SET = 0x01,
MB_SEEK_END = 0x02,
MB_SEEK_CUR = 0x04,
MBFS_STATUS_INITIALISED = 0x01,
MBFS_UNUSED = 0xFFFF,
MBFS_EOF = 0xEFFF,
MBFS_DELETED = 0x0000,
MBFS_DIRECTORY_ENTRY_FREE = 0x8000,
MBFS_DIRECTORY_ENTRY_VALID = 0x4000,
MBFS_DIRECTORY_ENTRY_DIRECTORY = 0x2000,
MBFS_DIRECTORY_ENTRY_NEW = 0xffff,
MBFS_DIRECTORY_ENTRY_DELETED = 0x0000,
MBFS_BLOCK_TYPE_FILE = 1,
MBFS_BLOCK_TYPE_DIRECTORY = 2,
MBFS_BLOCK_TYPE_FILETABLE = 3,
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitFlash.h
PAGE_SIZE = 1024,
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitI2C.h // built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitI2C.h
MICROBIT_I2C_MAX_RETRIES = 9, MICROBIT_I2C_MAX_RETRIES = 9,
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitIO.h // built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitIO.h
@ -558,7 +580,6 @@ declare const enum DAL {
MICROBIT_PIN_EVT_PULSE_LO = 5, MICROBIT_PIN_EVT_PULSE_LO = 5,
PIN_CAPABILITY_DIGITAL = 0x01, PIN_CAPABILITY_DIGITAL = 0x01,
PIN_CAPABILITY_ANALOG = 0x02, PIN_CAPABILITY_ANALOG = 0x02,
PIN_CAPABILITY_TOUCH = 0x04,
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitRadio.h // built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitRadio.h
MICROBIT_RADIO_STATUS_INITIALISED = 0x0001, MICROBIT_RADIO_STATUS_INITIALISED = 0x0001,
MICROBIT_RADIO_BASE_ADDRESS = 0x75626974, MICROBIT_RADIO_BASE_ADDRESS = 0x75626974,

81
libs/core/enums.d.ts vendored
View File

@ -34,10 +34,10 @@ declare namespace basic {
declare enum TouchPin { declare enum TouchPin {
P0 = 7, // MICROBIT_ID_IO_P0 P0 = 19, // MICROBIT_ID_IO_P12
P1 = 8, // MICROBIT_ID_IO_P1 P1 = 7, // MICROBIT_ID_IO_P0
P2 = 9, // MICROBIT_ID_IO_P2 P2 = 8, // MICROBIT_ID_IO_P1
P3 = 40, // CALLIOPE_ID_IO_P22 P3 = 23, // MICROBIT_ID_IO_P16
} }
@ -152,17 +152,18 @@ declare namespace input {
MICROBIT_ID_IO_P5 = 12, // MICROBIT_ID_IO_P5 MICROBIT_ID_IO_P5 = 12, // MICROBIT_ID_IO_P5
MICROBIT_ID_IO_P6 = 13, // MICROBIT_ID_IO_P6 MICROBIT_ID_IO_P6 = 13, // MICROBIT_ID_IO_P6
MICROBIT_ID_IO_P7 = 14, // MICROBIT_ID_IO_P7 MICROBIT_ID_IO_P7 = 14, // MICROBIT_ID_IO_P7
//MICROBIT_ID_IO_P8_ = MICROBIT_ID_IO_P8, MICROBIT_ID_IO_P8 = 15, // MICROBIT_ID_IO_P8
MICROBIT_ID_IO_P9 = 16, // MICROBIT_ID_IO_P9 MICROBIT_ID_IO_P9 = 16, // MICROBIT_ID_IO_P9
MICROBIT_ID_IO_P10 = 17, // MICROBIT_ID_IO_P10 MICROBIT_ID_IO_P10 = 17, // MICROBIT_ID_IO_P10
MICROBIT_ID_IO_P11 = 18, // MICROBIT_ID_IO_P11 MICROBIT_ID_IO_P11 = 18, // MICROBIT_ID_IO_P11
//MICROBIT_ID_IO_P12_ = MICROBIT_ID_IO_P12, MICROBIT_ID_IO_P12 = 19, // MICROBIT_ID_IO_P12
//MICROBIT_ID_IO_P13_ = MICROBIT_ID_IO_P13, MICROBIT_ID_IO_P13 = 20, // MICROBIT_ID_IO_P13
//MICROBIT_ID_IO_P14_ = MICROBIT_ID_IO_P14, MICROBIT_ID_IO_P14 = 21, // MICROBIT_ID_IO_P14
//MICROBIT_ID_IO_P15_ = MICROBIT_ID_IO_P15, MICROBIT_ID_IO_P15 = 22, // MICROBIT_ID_IO_P15
//MICROBIT_ID_IO_P16_ = MICROBIT_ID_IO_P16, MICROBIT_ID_IO_P16 = 23, // MICROBIT_ID_IO_P16
MICROBIT_ID_IO_P19 = 24, // MICROBIT_ID_IO_P19 MICROBIT_ID_IO_P19 = 24, // MICROBIT_ID_IO_P19
MICROBIT_ID_IO_P20 = 25, // MICROBIT_ID_IO_P20 MICROBIT_ID_IO_P20 = 25, // MICROBIT_ID_IO_P20
MICROBIT_ID_IO_P21 = 50, // MICROBIT_ID_IO_P21
MES_DEVICE_INFO_ID = 1103, // MES_DEVICE_INFO_ID MES_DEVICE_INFO_ID = 1103, // MES_DEVICE_INFO_ID
MES_SIGNAL_STRENGTH_ID = 1101, // MES_SIGNAL_STRENGTH_ID MES_SIGNAL_STRENGTH_ID = 1101, // MES_SIGNAL_STRENGTH_ID
MES_DPAD_CONTROLLER_ID = 1104, // MES_DPAD_CONTROLLER_ID MES_DPAD_CONTROLLER_ID = 1104, // MES_DPAD_CONTROLLER_ID
@ -175,6 +176,10 @@ declare namespace input {
MICROBIT_BUTTON_EVT_CLICK = 3, // MICROBIT_BUTTON_EVT_CLICK MICROBIT_BUTTON_EVT_CLICK = 3, // MICROBIT_BUTTON_EVT_CLICK
MICROBIT_RADIO_EVT_DATAGRAM = 1, // MICROBIT_RADIO_EVT_DATAGRAM MICROBIT_RADIO_EVT_DATAGRAM = 1, // MICROBIT_RADIO_EVT_DATAGRAM
MICROBIT_ACCELEROMETER_EVT_DATA_UPDATE = 1, // MICROBIT_ACCELEROMETER_EVT_DATA_UPDATE MICROBIT_ACCELEROMETER_EVT_DATA_UPDATE = 1, // MICROBIT_ACCELEROMETER_EVT_DATA_UPDATE
MICROBIT_PIN_EVT_RISE = 2, // MICROBIT_PIN_EVT_RISE
MICROBIT_PIN_EVT_FALL = 3, // MICROBIT_PIN_EVT_FALL
MICROBIT_PIN_EVT_PULSE_HI = 4, // MICROBIT_PIN_EVT_PULSE_HI
MICROBIT_PIN_EVT_PULSE_LO = 5, // MICROBIT_PIN_EVT_PULSE_LO
MES_ALERT_EVT_ALARM1 = 6, // MES_ALERT_EVT_ALARM1 MES_ALERT_EVT_ALARM1 = 6, // MES_ALERT_EVT_ALARM1
MES_ALERT_EVT_ALARM2 = 7, // MES_ALERT_EVT_ALARM2 MES_ALERT_EVT_ALARM2 = 7, // MES_ALERT_EVT_ALARM2
MES_ALERT_EVT_ALARM3 = 8, // MES_ALERT_EVT_ALARM3 MES_ALERT_EVT_ALARM3 = 8, // MES_ALERT_EVT_ALARM3
@ -263,36 +268,33 @@ declare namespace motors {
declare enum DigitalPin { declare enum DigitalPin {
P0 = 7, // MICROBIT_ID_IO_P0 P0 = 19, // MICROBIT_ID_IO_P12
P1 = 8, // MICROBIT_ID_IO_P1 P1 = 7, // MICROBIT_ID_IO_P0
P2 = 9, // MICROBIT_ID_IO_P2 P2 = 8, // MICROBIT_ID_IO_P1
P3 = 40, // CALLIOPE_ID_IO_P22 P3 = 23, // MICROBIT_ID_IO_P16
C4 = 10, // MICROBIT_ID_IO_P3 C4 = 10, // MICROBIT_ID_IO_P3
C5 = 11, // MICROBIT_ID_IO_P4 C5 = 11, // MICROBIT_ID_IO_P4
C6 = 17, // MICROBIT_ID_IO_P10 C6 = 17, // MICROBIT_ID_IO_P10
C7 = 34, // CALLIOPE_ID_IO_P7 C7 = 20, // MICROBIT_ID_IO_P13
C8 = 35, // CALLIOPE_ID_IO_P8 C8 = 21, // MICROBIT_ID_IO_P14
C9 = 36, // CALLIOPE_ID_IO_P9 C9 = 22, // MICROBIT_ID_IO_P15
C10 = 16, // MICROBIT_ID_IO_P9 C10 = 16, // MICROBIT_ID_IO_P9
C11 = 14, // MICROBIT_ID_IO_P7 C11 = 14, // MICROBIT_ID_IO_P7
C12 = 13, // MICROBIT_ID_IO_P6 C12 = 13, // MICROBIT_ID_IO_P6
C13 = 37, // CALLIOPE_ID_IO_P13 C16 = 9, // MICROBIT_ID_IO_P2
C14 = 38, // CALLIOPE_ID_IO_P14 C17 = 15, // MICROBIT_ID_IO_P8
C15 = 39, // CALLIOPE_ID_IO_P15 C18 = 25, // MICROBIT_ID_IO_P20
//P16 = MICROBIT_ID_IO_P16,
C19 = 24, // MICROBIT_ID_IO_P19 C19 = 24, // MICROBIT_ID_IO_P19
C20 = 25, // MICROBIT_ID_IO_P20
} }
declare enum AnalogPin { declare enum AnalogPin {
//P0 = MICROBIT_ID_IO_P0, -- does not work analogue P1 = 7, // MICROBIT_ID_IO_P0
P1 = 8, // MICROBIT_ID_IO_P1 P2 = 8, // MICROBIT_ID_IO_P1
P2 = 9, // MICROBIT_ID_IO_P2
//P3 = CALLIOPE_ID_IO_P22, -- does not work analogue
C4 = 10, // MICROBIT_ID_IO_P3 C4 = 10, // MICROBIT_ID_IO_P3
C5 = 11, // MICROBIT_ID_IO_P4 C5 = 11, // MICROBIT_ID_IO_P4
C6 = 17, // MICROBIT_ID_IO_P10 C6 = 17, // MICROBIT_ID_IO_P10
MIC = 50, // MICROBIT_ID_IO_P21
} }
@ -312,16 +314,25 @@ declare namespace motors {
} }
declare enum PinEventType {
//% block="edge"
Edge = 1, // MICROBIT_PIN_EVENT_ON_EDGE
//% block="pulse"
Pulse = 2, // MICROBIT_PIN_EVENT_ON_PULSE
//% block="touch"
Touch = 3, // MICROBIT_PIN_EVENT_ON_TOUCH
//% block="none"
None = 0, // MICROBIT_PIN_EVENT_NONE
}
declare enum SerialPin { declare enum SerialPin {
P0 = 7, // MICROBIT_ID_IO_P0 C16 = 9, // MICROBIT_ID_IO_P2
P1 = 8, // MICROBIT_ID_IO_P1 C17 = 15, // MICROBIT_ID_IO_P8
P2 = 9, // MICROBIT_ID_IO_P2 P0 = 19, // MICROBIT_ID_IO_P12
//P8 = MICROBIT_ID_IO_P8, P1 = 7, // MICROBIT_ID_IO_P0
//P12 = MICROBIT_ID_IO_P12, P2 = 8, // MICROBIT_ID_IO_P1
//P13 = MICROBIT_ID_IO_P13, P3 = 23, // MICROBIT_ID_IO_P16
//P14 = MICROBIT_ID_IO_P14,
//P15 = MICROBIT_ID_IO_P15,
//P16 = MICROBIT_ID_IO_P16
} }

View File

@ -21,7 +21,7 @@ enum LedSpriteProperty {
/** /**
* A single-LED sprite game engine * A single-LED sprite game engine
*/ */
//% color=#008272 weight=32 //% color=#008272 weight=32 icon="\uf11b"
//% advanced=true //% advanced=true
namespace game { namespace game {
let _score: number = 0; let _score: number = 0;

View File

@ -3,7 +3,7 @@
/** /**
* Creation, manipulation and display of LED images. * Creation, manipulation and display of LED images.
*/ */
//% color=#5C2D91 weight=31 //% color=#5C2D91 weight=31 icon="\uf03e"
//% advanced=true //% advanced=true
namespace images { namespace images {
/** /**
@ -43,9 +43,9 @@ namespace ImageMethods {
*/ */
//% help=images/show-image weight=80 blockNamespace=images //% help=images/show-image weight=80 blockNamespace=images
//% blockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8 //% blockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8
//% parts="ledmatrix" //% parts="ledmatrix" async
void showImage(Image sprite, int xOffset) { void showImage(Image sprite, int xOffset, int interval = 400) {
uBit.display.print(MicroBitImage(sprite), -xOffset, 0, 0); uBit.display.print(MicroBitImage(sprite), -xOffset, 0, 0, interval);
} }
/** /**
@ -150,7 +150,7 @@ namespace ImageMethods {
*/ */
//% weight=70 help=images/show-frame //% weight=70 help=images/show-frame
//% parts="ledmatrix" //% parts="ledmatrix"
void showFrame(Image i, int frame) { void showFrame(Image i, int frame, int interval = 400) {
showImage(i, frame * 5); showImage(i, frame * 5, interval);
} }
} }

View File

@ -26,10 +26,10 @@ enum class Rotation {
}; };
enum class TouchPin { enum class TouchPin {
P0 = MICROBIT_ID_IO_P0, P0 = MICROBIT_ID_IO_P12,
P1 = MICROBIT_ID_IO_P1, P1 = MICROBIT_ID_IO_P0,
P2 = MICROBIT_ID_IO_P2, P2 = MICROBIT_ID_IO_P1,
P3 = CALLIOPE_ID_IO_P22 P3 = MICROBIT_ID_IO_P16
}; };
enum class AcceleratorRange { enum class AcceleratorRange {
@ -108,7 +108,7 @@ enum class Gesture {
SixG = MICROBIT_ACCELEROMETER_EVT_6G SixG = MICROBIT_ACCELEROMETER_EVT_6G
}; };
//% color=#C90072 weight=99 //% color=#C90072 weight=99 icon="\uf192"
namespace input { namespace input {
/** /**
* Do something when a button (``A``, ``B`` or both ``A+B``) is pressed * Do something when a button (``A``, ``B`` or both ``A+B``) is pressed
@ -116,7 +116,7 @@ namespace input {
* @param body TODO * @param body TODO
*/ */
//% help=input/on-button-pressed weight=85 blockGap=8 //% help=input/on-button-pressed weight=85 blockGap=8
//% blockId=device_button_event block="on button|%NAME|pressed" icon="\uf192" //% blockId=device_button_event block="on button|%NAME|pressed"
//% parts="buttonpair" //% parts="buttonpair"
void onButtonPressed(Button button, Action body) { void onButtonPressed(Button button, Action body) {
registerWithDal((int)button, MICROBIT_BUTTON_EVT_CLICK, body); registerWithDal((int)button, MICROBIT_BUTTON_EVT_CLICK, body);
@ -127,7 +127,7 @@ namespace input {
* @param body TODO * @param body TODO
*/ */
//% help=input/on-gesture weight=84 blockGap=8 //% help=input/on-gesture weight=84 blockGap=8
//% blockId=device_gesture_event block="on |%NAME" icon="\uf135" //% blockId=device_gesture_event block="on |%NAME"
//% parts="accelerometer" //% parts="accelerometer"
void onGesture(Gesture gesture, Action body) { void onGesture(Gesture gesture, Action body) {
if ((int)gesture == MICROBIT_ACCELEROMETER_EVT_3G && uBit.accelerometer.getRange() < 3) if ((int)gesture == MICROBIT_ACCELEROMETER_EVT_3G && uBit.accelerometer.getRange() < 3)
@ -143,7 +143,7 @@ namespace input {
* @param body the code to run when the pin is pressed * @param body the code to run when the pin is pressed
*/ */
//% help=input/on-pin-pressed weight=83 //% help=input/on-pin-pressed weight=83
//% blockId=device_pin_event block="on pin %NAME|pressed" icon="\uf094" //% blockId=device_pin_event block="on pin %NAME|pressed"
void onPinPressed(TouchPin name, Action body) { void onPinPressed(TouchPin name, Action body) {
auto pin = getPin((int)name); auto pin = getPin((int)name);
if (!pin) return; if (!pin) return;
@ -159,7 +159,7 @@ namespace input {
* @param body the code to run when the pin is released * @param body the code to run when the pin is released
*/ */
//% help=input/on-pin-released weight=6 blockGap=8 //% help=input/on-pin-released weight=6 blockGap=8
//% blockId=device_pin_released block="on pin %NAME|released" icon="\uf094" //% blockId=device_pin_released block="on pin %NAME|released"
//% advanced=true //% advanced=true
void onPinReleased(TouchPin name, Action body) { void onPinReleased(TouchPin name, Action body) {
auto pin = getPin((int)name); auto pin = getPin((int)name);
@ -176,7 +176,7 @@ namespace input {
//% help=input/button-is-pressed weight=60 //% help=input/button-is-pressed weight=60
//% block="button|%NAME|is pressed" //% block="button|%NAME|is pressed"
//% blockId=device_get_button2 //% blockId=device_get_button2
//% icon="\uf192" blockGap=8 //% blockGap=8
//% parts="buttonpair" //% parts="buttonpair"
bool buttonIsPressed(Button button) { bool buttonIsPressed(Button button) {
if (button == Button::A) if (button == Button::A)
@ -193,7 +193,7 @@ namespace input {
* @param name pin used to detect the touch * @param name pin used to detect the touch
*/ */
//% help=input/pin-is-pressed weight=58 //% help=input/pin-is-pressed weight=58
//% blockId="device_pin_is_pressed" block="pin %NAME|is pressed" icon="\uf094" //% blockId="device_pin_is_pressed" block="pin %NAME|is pressed"
//% blockGap=8 //% blockGap=8
bool pinIsPressed(TouchPin name) { bool pinIsPressed(TouchPin name) {
auto pin = getPin((int)name); auto pin = getPin((int)name);
@ -211,7 +211,7 @@ namespace input {
* Get the acceleration value in milli-gravitys (when the board is laying flat with the screen up, x=0, y=0 and z=-1024) * Get the acceleration value in milli-gravitys (when the board is laying flat with the screen up, x=0, y=0 and z=-1024)
* @param dimension TODO * @param dimension TODO
*/ */
//% help=input/acceleration weight=58 icon="\uf135" //% help=input/acceleration weight=58
//% blockId=device_acceleration block="acceleration (mg)|%NAME" blockGap=8 //% blockId=device_acceleration block="acceleration (mg)|%NAME" blockGap=8
//% parts="accelerometer" //% parts="accelerometer"
int acceleration(Dimension dimension) { int acceleration(Dimension dimension) {
@ -228,7 +228,7 @@ namespace input {
* Reads the light level applied to the LED screen in a range from ``0`` (dark) to ``255`` bright. * Reads the light level applied to the LED screen in a range from ``0`` (dark) to ``255`` bright.
*/ */
//% help=input/light-level weight=57 //% help=input/light-level weight=57
//% blockId=device_get_light_level block="light level" blockGap=8 icon="\uf185" //% blockId=device_get_light_level block="light level" blockGap=8
//% parts="ledmatrix" //% parts="ledmatrix"
int lightLevel() { int lightLevel() {
return uBit.display.readLightLevel(); return uBit.display.readLightLevel();
@ -238,7 +238,7 @@ namespace input {
* Get the current compass heading in degrees. * Get the current compass heading in degrees.
*/ */
//% help=input/compass-heading //% help=input/compass-heading
//% weight=56 icon="\uf14e" //% weight=56
//% blockId=device_heading block="compass heading (°)" blockGap=8 //% blockId=device_heading block="compass heading (°)" blockGap=8
//% parts="compass" //% parts="compass"
int compassHeading() { int compassHeading() {
@ -249,7 +249,7 @@ namespace input {
/** /**
* Gets the temperature in Celsius degrees (°C). * Gets the temperature in Celsius degrees (°C).
*/ */
//% weight=55 icon="\uf06d" //% weight=55
//% help=input/temperature //% help=input/temperature
//% blockId=device_temperature block="temperature (°C)" blockGap=8 //% blockId=device_temperature block="temperature (°C)" blockGap=8
//% parts="thermometer" //% parts="thermometer"
@ -262,7 +262,7 @@ namespace input {
* @param kind TODO * @param kind TODO
*/ */
//% help=input/rotation weight=52 //% help=input/rotation weight=52
//% blockId=device_get_rotation block="rotation (°)|%NAME" blockGap=8 icon="\uf197" //% blockId=device_get_rotation block="rotation (°)|%NAME" blockGap=8
//% parts="accelerometer" advanced=true //% parts="accelerometer" advanced=true
int rotation(Rotation kind) { int rotation(Rotation kind) {
switch (kind) { switch (kind) {
@ -277,7 +277,7 @@ namespace input {
* @param dimension TODO * @param dimension TODO
*/ */
//% help=input/magnetic-force weight=51 //% help=input/magnetic-force weight=51
//% blockId=device_get_magnetic_force block="magnetic force (µT)|%NAME" blockGap=8 icon="\uf076" //% blockId=device_get_magnetic_force block="magnetic force (µT)|%NAME" blockGap=8
//% parts="compass" //% parts="compass"
//% advanced=true //% advanced=true
int magneticForce(Dimension dimension) { int magneticForce(Dimension dimension) {
@ -297,7 +297,7 @@ namespace input {
* Gets the number of milliseconds elapsed since power on. * Gets the number of milliseconds elapsed since power on.
*/ */
//% 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)"
//% advanced=true //% advanced=true
int runningTime() { int runningTime() {
return system_timer_current_time(); return system_timer_current_time();
@ -314,7 +314,7 @@ namespace input {
* @param range a value describe the maximum strengh of acceleration measured * @param range a value describe the maximum strengh of acceleration measured
*/ */
//% help=input/set-accelerometer-range //% help=input/set-accelerometer-range
//% blockId=device_set_accelerometer_range block="set accelerometer|range %range" icon="\uf135" //% blockId=device_set_accelerometer_range block="set accelerometer|range %range"
//% weight=5 //% weight=5
//% parts="accelerometer" //% parts="accelerometer"
//% advanced=true //% advanced=true

View File

@ -8,7 +8,7 @@ enum class DisplayMode_ {
// TODO DISPLAY_MODE_BLACK_AND_WHITE_LIGHT_SENSE // TODO DISPLAY_MODE_BLACK_AND_WHITE_LIGHT_SENSE
}; };
//% color=#8169E6 weight=35 //% color=#8169E6 weight=35 icon="\uf205"
namespace led { namespace led {
/** /**
@ -17,7 +17,7 @@ namespace led {
* @param y TODO * @param y TODO
*/ */
//% help=led/plot weight=78 //% help=led/plot weight=78
//% blockId=device_plot block="plot|x %x|y %y" icon="\uf205" blockGap=8 //% blockId=device_plot block="plot|x %x|y %y" blockGap=8
//% parts="ledmatrix" //% parts="ledmatrix"
void plot(int x, int y) { void plot(int x, int y) {
uBit.display.image.setPixelValue(x, y, 1); uBit.display.image.setPixelValue(x, y, 1);
@ -29,7 +29,7 @@ namespace led {
* @param y TODO * @param y TODO
*/ */
//% help=led/unplot weight=77 //% help=led/unplot weight=77
//% blockId=device_unplot block="unplot|x %x|y %y" icon="\uf204" blockGap=8 //% blockId=device_unplot block="unplot|x %x|y %y" blockGap=8
//% parts="ledmatrix" //% parts="ledmatrix"
void unplot(int x, int y) { void unplot(int x, int y) {
uBit.display.image.setPixelValue(x, y, 0); uBit.display.image.setPixelValue(x, y, 0);
@ -41,7 +41,7 @@ namespace led {
* @param y TODO * @param y TODO
*/ */
//% help=led/point weight=76 //% help=led/point weight=76
//% blockId=device_point block="point|x %x|y %y" icon="\uf10c" //% blockId=device_point block="point|x %x|y %y"
//% parts="ledmatrix" //% parts="ledmatrix"
bool point(int x, int y) { bool point(int x, int y) {
int pix = uBit.display.image.getPixelValue(x, y); int pix = uBit.display.image.getPixelValue(x, y);
@ -52,7 +52,7 @@ namespace led {
* Get the screen brightness from 0 (off) to 255 (full bright). * Get the screen brightness from 0 (off) to 255 (full bright).
*/ */
//% help=led/brightness weight=60 //% help=led/brightness weight=60
//% blockId=device_get_brightness block="brightness" icon="\uf042" blockGap=8 //% blockId=device_get_brightness block="brightness" blockGap=8
//% parts="ledmatrix" //% parts="ledmatrix"
//% advanced=true //% advanced=true
int brightness() { int brightness() {
@ -64,7 +64,7 @@ namespace led {
* @param value the brightness value, eg:255, 127, 0 * @param value the brightness value, eg:255, 127, 0
*/ */
//% help=led/set-brightness weight=59 //% help=led/set-brightness weight=59
//% blockId=device_set_brightness block="set brightness %value" icon="\uf042" //% blockId=device_set_brightness block="set brightness %value"
//% parts="ledmatrix" //% parts="ledmatrix"
//% advanced=true //% advanced=true
void setBrightness(int value) { void setBrightness(int value) {
@ -75,7 +75,7 @@ namespace led {
* Cancels the current animation and clears other pending animations. * Cancels the current animation and clears other pending animations.
*/ */
//% weight=50 help=led/stop-animation //% weight=50 help=led/stop-animation
//% blockId=device_stop_animation block="stop animation" icon="\uf04d" //% blockId=device_stop_animation block="stop animation"
//% parts="ledmatrix" //% parts="ledmatrix"
//% advanced=true //% advanced=true
void stopAnimation() { void stopAnimation() {
@ -95,7 +95,7 @@ namespace led {
/** /**
* Turns on or off the display * Turns on or off the display
*/ */
//% help=led/enable blockId=device_led_enable icon="\uf04d" //% help=led/enable blockId=device_led_enable
//% advanced=true parts="ledmatrix" //% advanced=true parts="ledmatrix"
void enable(bool on) { void enable(bool on) {
if (on) uBit.display.enable(); if (on) uBit.display.enable();

View File

@ -19,7 +19,7 @@ enum Motor {
/** /**
* Blocks to control the onboard motors * Blocks to control the onboard motors
*/ */
//% color=#008272 weight=30 //% color=#008272 weight=30 icon="\uf1b9"
namespace motors { namespace motors {
/** /**
* Turns on the motor at a certain percent of power. Switches to single motor mode! * Turns on the motor at a certain percent of power. Switches to single motor mode!

View File

@ -125,7 +125,7 @@ enum BeatFraction {
/** /**
* Generation of music tones through pin ``P0``. * Generation of music tones through pin ``P0``.
*/ */
//% color=#DF4600 weight=98 //% color=#DF4600 weight=98 icon="\uf025"
namespace music { namespace music {
let beatsPerMinute: number = 120; let beatsPerMinute: number = 120;
@ -145,7 +145,7 @@ namespace music {
* @param frequency pitch of the tone to play in Hertz (Hz) * @param frequency pitch of the tone to play in Hertz (Hz)
*/ */
//% help=music/ring-tone weight=80 //% help=music/ring-tone weight=80
//% blockId=device_ring block="ring tone (Hz)|%note=device_note" icon="\uf025" blockGap=8 //% blockId=device_ring block="ring tone (Hz)|%note=device_note" blockGap=8
//% parts="speaker" async //% parts="speaker" async
export function ringTone(frequency: number) { export function ringTone(frequency: number) {
playTone(frequency, 0); playTone(frequency, 0);

View File

@ -1,35 +1,32 @@
#include "pxt.h" #include "pxt.h"
enum class DigitalPin { enum class DigitalPin {
P0 = MICROBIT_ID_IO_P0, // edge connector 0 P0 = MICROBIT_ID_IO_P12, // edge connector 0
P1 = MICROBIT_ID_IO_P1, // edge connector 1 P1 = MICROBIT_ID_IO_P0, // edge connector 1
P2 = MICROBIT_ID_IO_P2, // edge connector 2 P2 = MICROBIT_ID_IO_P1, // edge connector 2
P3 = CALLIOPE_ID_IO_P22, // edge connector 3 P3 = MICROBIT_ID_IO_P16, // edge connector 3
C4 = MICROBIT_ID_IO_P3, // LED matrix C1 C4 = MICROBIT_ID_IO_P3, // LED matrix C1
C5 = MICROBIT_ID_IO_P4, // LED matrix C2 C5 = MICROBIT_ID_IO_P4, // LED matrix C2
C6 = MICROBIT_ID_IO_P10, // LED matrix C3 C6 = MICROBIT_ID_IO_P10, // LED matrix C3
C7 = CALLIOPE_ID_IO_P7, // LED matrix C4 C7 = MICROBIT_ID_IO_P13, // LED matrix C4
C8 = CALLIOPE_ID_IO_P8, // LED matrix C5 C8 = MICROBIT_ID_IO_P14, // LED matrix C5
C9 = CALLIOPE_ID_IO_P9, // LED matrix C6 C9 = MICROBIT_ID_IO_P15, // LED matrix C6
C10 = MICROBIT_ID_IO_P9, // LED matrix C7 C10 = MICROBIT_ID_IO_P9, // LED matrix C7
C11 = MICROBIT_ID_IO_P7, // LED matrix C8 C11 = MICROBIT_ID_IO_P7, // LED matrix C8
C12 = MICROBIT_ID_IO_P6, // LED matrix C9 C12 = MICROBIT_ID_IO_P6, // LED matrix C9
C13 = CALLIOPE_ID_IO_P13, // LED matrix R1 C16 = MICROBIT_ID_IO_P2, // RX
C14 = CALLIOPE_ID_IO_P14, // LED matrix R2 C17 = MICROBIT_ID_IO_P8, // TX
C15 = CALLIOPE_ID_IO_P15, // LED matrix R3 C18 = MICROBIT_ID_IO_P20, // SDA
//P16 = MICROBIT_ID_IO_P16, C19 = MICROBIT_ID_IO_P19 // SCL
C19 = MICROBIT_ID_IO_P19, // SCL
C20 = MICROBIT_ID_IO_P20 // SDA
}; };
enum class AnalogPin { enum class AnalogPin {
//P0 = MICROBIT_ID_IO_P0, -- does not work analogue P1 = MICROBIT_ID_IO_P0, // edge connector 1
P1 = MICROBIT_ID_IO_P1, // edge connector 1 P2 = MICROBIT_ID_IO_P1, // edge connector 2
P2 = MICROBIT_ID_IO_P2, // edge connector 2 C4 = MICROBIT_ID_IO_P3, // LED matrix C1
//P3 = CALLIOPE_ID_IO_P22, -- does not work analogue C5 = MICROBIT_ID_IO_P4, // LED matrix C2
C4 = MICROBIT_ID_IO_P3, C6 = MICROBIT_ID_IO_P10, // LED matrix C3
C5 = MICROBIT_ID_IO_P4, MIC = MICROBIT_ID_IO_P21 // microphone
C6 = MICROBIT_ID_IO_P10,
}; };
enum class PulseValue { enum class PulseValue {
@ -46,6 +43,17 @@ enum class PinPullMode {
PullNone = 2 PullNone = 2
}; };
enum class PinEventType {
//% block="edge"
Edge = MICROBIT_PIN_EVENT_ON_EDGE,
//% block="pulse"
Pulse = MICROBIT_PIN_EVENT_ON_PULSE,
//% block="touch"
Touch = MICROBIT_PIN_EVENT_ON_TOUCH,
//% block="none"
None = MICROBIT_PIN_EVENT_NONE
};
MicroBitPin *getPin(int id) { MicroBitPin *getPin(int id) {
switch (id) { switch (id) {
case MICROBIT_ID_IO_P0: return &uBit.io.P0; case MICROBIT_ID_IO_P0: return &uBit.io.P0;
@ -56,28 +64,18 @@ MicroBitPin *getPin(int id) {
case MICROBIT_ID_IO_P5: return &uBit.io.P5; case MICROBIT_ID_IO_P5: return &uBit.io.P5;
case MICROBIT_ID_IO_P6: return &uBit.io.P6; case MICROBIT_ID_IO_P6: return &uBit.io.P6;
case MICROBIT_ID_IO_P7: return &uBit.io.P7; case MICROBIT_ID_IO_P7: return &uBit.io.P7;
//case MICROBIT_ID_IO_P8: return &uBit.io.P8; case MICROBIT_ID_IO_P8: return &uBit.io.P8;
case MICROBIT_ID_IO_P9: return &uBit.io.P9; case MICROBIT_ID_IO_P9: return &uBit.io.P9;
case MICROBIT_ID_IO_P10: return &uBit.io.P10; case MICROBIT_ID_IO_P10: return &uBit.io.P10;
case MICROBIT_ID_IO_P11: return &uBit.io.P11; case MICROBIT_ID_IO_P11: return &uBit.io.P11;
//case MICROBIT_ID_IO_P12: return &uBit.io.P12; case MICROBIT_ID_IO_P12: return &uBit.io.P12;
//case MICROBIT_ID_IO_P13: return &uBit.io.P13; case MICROBIT_ID_IO_P13: return &uBit.io.P13;
//case MICROBIT_ID_IO_P14: return &uBit.io.P14; case MICROBIT_ID_IO_P14: return &uBit.io.P14;
//case MICROBIT_ID_IO_P15: return &uBit.io.P15; case MICROBIT_ID_IO_P15: return &uBit.io.P15;
//case MICROBIT_ID_IO_P16: return &uBit.io.P16; case MICROBIT_ID_IO_P16: return &uBit.io.P16;
case MICROBIT_ID_IO_P19: return &uBit.io.P19; case MICROBIT_ID_IO_P19: return &uBit.io.P19;
case MICROBIT_ID_IO_P20: return &uBit.io.P20; case MICROBIT_ID_IO_P20: return &uBit.io.P20;
case CALLIOPE_ID_IO_P3: return &uBit.io.CAL_P3; case MICROBIT_ID_IO_P21: return &uBit.io.P21;
case CALLIOPE_ID_IO_P7: return &uBit.io.CAL_P7;
case CALLIOPE_ID_IO_P8: return &uBit.io.CAL_P8;
case CALLIOPE_ID_IO_P9: return &uBit.io.CAL_P9;
case CALLIOPE_ID_IO_P13: return &uBit.io.CAL_P13;
case CALLIOPE_ID_IO_P14: return &uBit.io.CAL_P14;
case CALLIOPE_ID_IO_P15: return &uBit.io.CAL_P15;
case CALLIOPE_ID_IO_P22: return &uBit.io.CAL_P22;
case CALLIOPE_ID_IO_P28: return &uBit.io.CAL_P28;
case CALLIOPE_ID_IO_P29: return &uBit.io.CAL_P29;
case CALLIOPE_ID_IO_P30: return &uBit.io.CAL_P30;
default: return NULL; default: return NULL;
} }
} }
@ -117,7 +115,7 @@ namespace pins {
*/ */
//% help=pins/digital-write-pin weight=29 //% help=pins/digital-write-pin weight=29
//% blockId=device_set_digital_pin block="digital write|pin %name|to %value" //% blockId=device_set_digital_pin block="digital write|pin %name|to %value"
void digitalWritePin(DigitalPin name, int value) { void digitalWritePin(DigitalPin name, int value) {
PINOP(setDigitalValue(value)); PINOP(setDigitalValue(value));
} }
@ -126,7 +124,7 @@ namespace pins {
* @param name pin to write to * @param name pin to write to
*/ */
//% help=pins/analog-read-pin weight=25 //% help=pins/analog-read-pin weight=25
//% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8" //% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8"
int analogReadPin(AnalogPin name) { int analogReadPin(AnalogPin name) {
PINREAD(getAnalogValue()); PINREAD(getAnalogValue());
} }
@ -138,7 +136,7 @@ namespace pins {
*/ */
//% help=pins/analog-write-pin weight=24 //% help=pins/analog-write-pin weight=24
//% blockId=device_set_analog_pin block="analog write|pin %name|to %value" blockGap=8 //% blockId=device_set_analog_pin block="analog write|pin %name|to %value" blockGap=8
void analogWritePin(AnalogPin name, int value) { void analogWritePin(AnalogPin name, int value) {
PINOP(setAnalogValue(value)); PINOP(setAnalogValue(value));
} }
@ -149,11 +147,11 @@ namespace pins {
* @param micros period in micro seconds. eg:20000 * @param micros period in micro seconds. eg:20000
*/ */
//% help=pins/analog-set-period weight=23 blockGap=8 //% help=pins/analog-set-period weight=23 blockGap=8
//% blockId=device_set_analog_period block="analog set period|pin %pin|to (µs)%micros" //% blockId=device_set_analog_period block="analog set period|pin %pin|to (µs)%micros"
void analogSetPeriod(AnalogPin name, int micros) { void analogSetPeriod(AnalogPin name, int micros) {
PINOP(setAnalogPeriodUs(micros)); PINOP(setAnalogPeriodUs(micros));
} }
/** /**
* Configures this pin to a digital input, and generates events where the timestamp is the duration that this pin was either ``high`` or ``low``. * Configures this pin to a digital input, and generates events where the timestamp is the duration that this pin was either ``high`` or ``low``.
*/ */
@ -162,11 +160,11 @@ namespace pins {
void onPulsed(DigitalPin name, PulseValue pulse, Action body) { void onPulsed(DigitalPin name, PulseValue pulse, Action body) {
MicroBitPin* pin = getPin((int)name); MicroBitPin* pin = getPin((int)name);
if (!pin) return; if (!pin) return;
pin->eventOn(MICROBIT_PIN_EVENT_ON_PULSE); pin->eventOn(MICROBIT_PIN_EVENT_ON_PULSE);
registerWithDal((int)name, (int)pulse, body); registerWithDal((int)name, (int)pulse, body);
} }
/** /**
* Gets the duration of the last pulse in micro-seconds. This function should be called from a ``onPulsed`` handler. * Gets the duration of the last pulse in micro-seconds. This function should be called from a ``onPulsed`` handler.
*/ */
@ -182,7 +180,7 @@ namespace pins {
* @param name the pin which measures the pulse * @param name the pin which measures the pulse
* @param value the value of the pulse (default high) * @param value the value of the pulse (default high)
* @param maximum duration in micro-seconds * @param maximum duration in micro-seconds
*/ */
//% blockId="pins_pulse_in" block="pulse in (µs)|pin %name|pulsed %value" //% blockId="pins_pulse_in" block="pulse in (µs)|pin %name|pulsed %value"
//% weight=20 //% weight=20
int pulseIn(DigitalPin name, PulseValue value, int maxDuration = 2000000) { int pulseIn(DigitalPin name, PulseValue value, int maxDuration = 2000000) {
@ -190,20 +188,20 @@ namespace pins {
if (!pin) return 0; if (!pin) return 0;
int pulse = value == PulseValue::High ? 1 : 0; int pulse = value == PulseValue::High ? 1 : 0;
uint64_t tick = system_timer_current_time_us(); uint64_t tick = system_timer_current_time_us();
uint64_t maxd = (uint64_t)maxDuration; uint64_t maxd = (uint64_t)maxDuration;
while(pin->getDigitalValue() != pulse) { while(pin->getDigitalValue() != pulse) {
if(system_timer_current_time_us() - tick > maxd) if(system_timer_current_time_us() - tick > maxd)
return 0; return 0;
} }
uint64_t start = system_timer_current_time_us(); uint64_t start = system_timer_current_time_us();
while(pin->getDigitalValue() == pulse) { while(pin->getDigitalValue() == pulse) {
if(system_timer_current_time_us() - tick > maxd) if(system_timer_current_time_us() - tick > maxd)
return 0; return 0;
} }
uint64_t end = system_timer_current_time_us(); uint64_t end = system_timer_current_time_us();
return end - start; return end - start;
} }
/** /**
@ -214,7 +212,7 @@ namespace pins {
//% help=pins/servo-write-pin weight=20 //% help=pins/servo-write-pin weight=20
//% blockId=device_set_servo_pin block="servo write|pin %name|to %value" blockGap=8 //% blockId=device_set_servo_pin block="servo write|pin %name|to %value" blockGap=8
//% parts=microservo trackArgs=0 //% parts=microservo trackArgs=0
void servoWritePin(AnalogPin name, int value) { void servoWritePin(AnalogPin name, int value) {
PINOP(setServoValue(value)); PINOP(setServoValue(value));
} }
@ -225,7 +223,7 @@ namespace pins {
*/ */
//% help=pins/servo-set-pulse weight=19 //% help=pins/servo-set-pulse weight=19
//% blockId=device_set_servo_pulse block="servo set pulse|pin %value|to (µs) %micros" //% blockId=device_set_servo_pulse block="servo set pulse|pin %value|to (µs) %micros"
void servoSetPulse(AnalogPin name, int micros) { void servoSetPulse(AnalogPin name, int micros) {
PINOP(setServoPulseUs(micros)); PINOP(setServoPulseUs(micros));
} }
@ -236,8 +234,9 @@ namespace pins {
* Sets the pin used when using `pins->analog pitch`. * Sets the pin used when using `pins->analog pitch`.
* @param name TODO * @param name TODO
*/ */
//% help=pins/analog-set-pitch weight=12 //% blockId=device_analog_set_pitch_pin block="analog set pitch pin %name"
void analogSetPitchPin(AnalogPin name) { //% help=pins/analog-set-pitch weight=3 advanced=true
void analogSetPitchPin(AnalogPin name) {
pitchPin = getPin((int)name); pitchPin = getPin((int)name);
} }
@ -246,16 +245,18 @@ namespace pins {
* @param frequency TODO * @param frequency TODO
* @param ms TODO * @param ms TODO
*/ */
//% help=pins/analog-pitch weight=14 async //% blockId=device_analog_pitch block="analog pitch %frequency|for (ms) %ms"
void analogPitch(int frequency, int ms) { //% help=pins/analog-pitch weight=4 async advanced=true blockGap=8
if (pitchPin == NULL) return; void analogPitch(int frequency, int ms) {
if (pitchPin == NULL)
analogSetPitchPin(AnalogPin::P1);
if (frequency <= 0) { if (frequency <= 0) {
pitchPin->setAnalogValue(0); pitchPin->setAnalogValue(0);
} else { } else {
pitchPin->setAnalogValue(512); pitchPin->setAnalogValue(512);
pitchPin->setAnalogPeriodUs(1000000/frequency); pitchPin->setAnalogPeriodUs(1000000/frequency);
} }
if (ms > 0) { if (ms > 0) {
fiber_sleep(ms); fiber_sleep(ms);
pitchPin->setAnalogValue(0); pitchPin->setAnalogValue(0);
@ -264,7 +265,7 @@ namespace pins {
} }
} }
/** /**
* Configures the pull of this pin. * Configures the pull of this pin.
* @param name pin to set the pull mode on * @param name pin to set the pull mode on
@ -273,13 +274,25 @@ namespace pins {
//% help=pins/set-pull weight=3 //% help=pins/set-pull weight=3
//% blockId=device_set_pull block="set pull|pin %pin|to %pull" //% blockId=device_set_pull block="set pull|pin %pin|to %pull"
void setPull(DigitalPin name, PinPullMode pull) { void setPull(DigitalPin name, PinPullMode pull) {
PinMode m = pull == PinPullMode::PullDown PinMode m = pull == PinPullMode::PullDown
? PinMode::PullDown ? PinMode::PullDown
: pull == PinPullMode::PullUp ? PinMode::PullUp : pull == PinPullMode::PullUp ? PinMode::PullUp
: PinMode::PullNone; : PinMode::PullNone;
PINOP(setPull(m)); PINOP(setPull(m));
} }
/**
* Configures the events emitted by this pin. Events can be subscribed to
* using ``control.onEvent()``.
* @param name pin to set the event mode on, eg: DigitalPin.P0
* @param type the type of events for this pin to emit, eg: PinEventType.Edge
*/
//% help=pins/set-events weight=4 advanced=true
//% blockId=device_set_pin_events block="set pin %pin|to emit %type|events"
void setEvents(DigitalPin name, PinEventType type) {
getPin((int)name)->eventOn((int)type);
}
/** /**
* Create a new zero-initialized buffer. * Create a new zero-initialized buffer.
* @param size number of bytes in the buffer * @param size number of bytes in the buffer
@ -300,7 +313,7 @@ namespace pins {
uBit.i2c.read(address << 1, (char*)buf->payload, size, repeat); uBit.i2c.read(address << 1, (char*)buf->payload, size, repeat);
return buf; return buf;
} }
/** /**
* Write bytes to a 7-bit I2C `address`. * Write bytes to a 7-bit I2C `address`.
*/ */
@ -327,5 +340,5 @@ namespace pins {
auto p = allocSPI(); auto p = allocSPI();
return p->write(value); return p->write(value);
} }
} }

View File

@ -1,7 +1,7 @@
/** /**
* Control currents in Pins for analog/digital signals, servos, i2c, ... * Control currents in Pins for analog/digital signals, servos, i2c, ...
*/ */
//% color=#A80000 weight=30 //% color=#A80000 weight=30 icon="\uf140"
//% advanced=true //% advanced=true
namespace pins { namespace pins {
/** /**

View File

@ -79,7 +79,7 @@ namespace pxt {
intcheck(vtable->methods[0] == &RefRecord_destroy, ERR_SIZE, 3); intcheck(vtable->methods[0] == &RefRecord_destroy, ERR_SIZE, 3);
intcheck(vtable->methods[1] == &RefRecord_print, ERR_SIZE, 4); intcheck(vtable->methods[1] == &RefRecord_print, ERR_SIZE, 4);
void *ptr = ::operator new(vtable->numbytes); void *ptr = ::operator new(vtable->numbytes);
RefRecord *r = new (ptr) RefRecord(PXT_VTABLE_TO_INT(vtable)); RefRecord *r = new (ptr) RefRecord(PXT_VTABLE_TO_INT(vtable));
memset(r->fields, 0, vtable->numbytes - sizeof(RefRecord)); memset(r->fields, 0, vtable->numbytes - sizeof(RefRecord));
@ -117,7 +117,6 @@ namespace pxt {
void RefObject::destroy() { void RefObject::destroy() {
((RefObjectMethod)getVTable()->methods[0])(this); ((RefObjectMethod)getVTable()->methods[0])(this);
delete this;
} }
void RefObject::print() { void RefObject::print() {
@ -142,63 +141,327 @@ namespace pxt {
printf("RefRecord %p r=%d size=%d bytes\n", r, r->refcnt, r->getVTable()->numbytes); printf("RefRecord %p r=%d size=%d bytes\n", r, r->refcnt, r->getVTable()->numbytes);
} }
void RefCollection::push(uint32_t x) { uint32_t Segment::get(uint32_t i)
if (isRef()) incr(x); {
data.push_back(x); #ifdef DEBUG_BUILD
} printf("In Segment::get index:%u\n", i);
this->print();
uint32_t RefCollection::getAt(int x) { #endif
if (in_range(x)) {
uint32_t tmp = data.at(x); if (i < length)
if (isRef()) incr(tmp); {
return tmp; return data[i];
}
else {
error(ERR_OUT_OF_BOUNDS);
return 0;
} }
return Segment::DefaultValue;
} }
void RefCollection::removeAt(int x) { void Segment::set(uint32_t i, uint32_t value)
if (!in_range(x)) {
return; if (i < size)
{
if (isRef()) decr(data.at(x)); data[i] = value;
data.erase(data.begin()+x);
}
void RefCollection::setAt(int x, uint32_t y) {
if (!in_range(x))
return;
if (isRef()) {
decr(data.at(x));
incr(y);
}
data.at(x) = y;
}
int RefCollection::indexOf(uint32_t x, int start) {
if (!in_range(start))
return -1;
if (isString()) {
StringData *xx = (StringData*)x;
for (uint32_t i = start; i < data.size(); ++i) {
StringData *ee = (StringData*)data.at(i);
if (xx->len == ee->len && memcmp(xx->data, ee->data, xx->len) == 0)
return (int)i;
} }
} else { else if (i < Segment::MaxSize)
for (uint32_t i = start; i < data.size(); ++i) {
if (data.at(i) == x) growByMin(i + 1);
data[i] = value;
}
if (length <= i)
{
length = i + 1;
}
#ifdef DEBUG_BUILD
printf("In Segment::set\n");
this->print();
#endif
return;
}
uint16_t Segment::growthFactor(uint16_t size)
{
if (size == 0)
{
return 4;
}
if (size < 64)
{
return size * 2; // Double
}
if (size < 512)
{
return size * 5/3; //Grow by 1.66 rate
}
return size + 256; //Grow by constant rate
}
void Segment::growByMin(uint16_t minSize)
{
growBy(max(minSize, growthFactor(size)));
}
void Segment::growBy(uint16_t newSize)
{
#ifdef DEBUG_BUILD
printf("growBy: %d\n", newSize);
this->print();
#endif
if (size < newSize)
{
//this will throw if unable to allocate
uint32_t *tmp = (uint32_t*)(::operator new(newSize * sizeof(uint32_t)));
//Copy existing data
if (size)
{
memcpy(tmp, data, size * sizeof(uint32_t));
}
//fill the rest with default value
memset(tmp + size, Segment::DefaultValue, (newSize - size) * sizeof(uint32_t));
//free older segment;
::operator delete(data);
data = tmp;
size = newSize;
#ifdef DEBUG_BUILD
printf("growBy - after reallocation\n");
this->print();
#endif
}
//else { no shrinking yet; }
return;
}
void Segment::ensure(uint16_t newSize)
{
if (newSize < size)
{
return;
}
growByMin(newSize);
}
void Segment::setLength(uint32_t newLength)
{
if (newLength > size)
{
ensure(length);
}
length = newLength;
return;
}
void Segment::push(uint32_t value)
{
this->set(length, value);
}
uint32_t Segment::pop()
{
#ifdef DEBUG_BUILD
printf("In Segment::pop\n");
this->print();
#endif
if (length > 0)
{
uint32_t value = data[length];
data[length] = Segment::DefaultValue;
--length;
return value;
}
return Segment::DefaultValue;
}
//this function removes an element at index i and shifts the rest of the elements to
//left to fill the gap
uint32_t Segment::remove(uint32_t i)
{
#ifdef DEBUG_BUILD
printf("In Segment::remove index:%u\n", i);
this->print();
#endif
if (i < length)
{
//value to return
uint32_t ret = data[i];
if (i + 1 < length)
{
//Move the rest of the elements to fill in the gap.
memmove(data + i, data + i + 1, (length - i - 1) * sizeof(uint32_t));
}
length--;
data[length] = Segment::DefaultValue;
#ifdef DEBUG_BUILD
printf("After Segment::remove index:%u\n", i);
this->print();
#endif
return ret;
}
return Segment::DefaultValue;
}
//this function inserts element value at index i by shifting the rest of the elements right.
void Segment::insert(uint32_t i, uint32_t value)
{
#ifdef DEBUG_BUILD
printf("In Segment::insert index:%u value:%u\n", i, value);
this->print();
#endif
if (i < length)
{
ensure(length + 1);
if (i + 1 < length)
{
//Move the rest of the elements to fill in the gap.
memmove(data + i + 1, data + i, (length - i) * sizeof(uint32_t));
}
data[i] = value;
length++;
}
else
{
//This is insert beyond the length, just call set which will adjust the length
set(i, value);
}
#ifdef DEBUG_BUILD
printf("After Segment::insert index:%u\n", i);
this->print();
#endif
}
void Segment::print()
{
printf("Segment: %x, length: %u, size: %u\n", data, (uint32_t)length, (uint32_t)size);
for(uint32_t i = 0; i < size; i++)
{
printf("%d ",(uint32_t)data[i]);
}
printf("\n");
}
bool Segment::isValidIndex(uint32_t i)
{
if (i > length)
{
return false;
}
return true;
}
void Segment::destroy()
{
#ifdef DEBUG_BUILD
printf("In Segment::destroy\n");
this->print();
#endif
length = size = 0;
::operator delete(data);
data = nullptr;
}
void RefCollection::push(uint32_t x)
{
if (isRef()) incr(x);
head.push(x);
}
uint32_t RefCollection::pop()
{
uint32_t ret = head.pop();
if (isRef())
{
incr(ret);
}
return ret;
}
uint32_t RefCollection::getAt(int i)
{
uint32_t tmp = head.get(i);
if (isRef())
{
incr(tmp);
}
return tmp;
}
uint32_t RefCollection::removeAt(int i)
{
if (isRef())
{
decr(head.get(i));
}
return head.remove(i);
}
void RefCollection::insertAt(int i, uint32_t value)
{
head.insert(i, value);
if (isRef())
{
incr(value);
}
}
void RefCollection::setAt(int i, uint32_t value)
{
if (isRef())
{
if (head.isValidIndex((uint32_t)i))
{
decr(head.get(i));
}
incr(value);
}
head.set(i, value);
}
int RefCollection::indexOf(uint32_t x, int start)
{
if (isString())
{
StringData *xx = (StringData*)x;
uint32_t i = start;
while(head.isValidIndex(i))
{
StringData *ee = (StringData*)head.get(i);
if (ee == xx)
{
//handles ee being null
return (int) i;
}
if (ee && xx->len == ee->len && memcmp(xx->data, ee->data, xx->len) == 0)
{
return (int)i; return (int)i;
}
i++;
}
}
else
{
uint32_t i = start;
while(head.isValidIndex(i))
{
if (head.get(i) == x)
{
return (int)i;
}
i++;
}
} }
return -1; return -1;
} }
int RefCollection::removeElement(uint32_t x) { int RefCollection::removeElement(uint32_t x)
{
int idx = indexOf(x, 0); int idx = indexOf(x, 0);
if (idx >= 0) { if (idx >= 0) {
removeAt(idx); removeAt(idx);
@ -240,16 +503,20 @@ namespace pxt {
void RefCollection::destroy() void RefCollection::destroy()
{ {
if (this->isRef()) if (this->isRef())
for (uint32_t i = 0; i < this->data.size(); ++i) { {
decr(this->data[i]); for(uint32_t i = 0; i < this->head.getLength(); i++)
this->data[i] = 0; {
decr(this->head.get(i));
} }
this->data.resize(0); }
this->head.destroy();
delete this;
} }
void RefCollection::print() void RefCollection::print()
{ {
printf("RefCollection %p r=%d flags=%d size=%d [%p, ...]\n", this, refcnt, getFlags(), data.size(), data.size() > 0 ? data[0] : 0); printf("RefCollection %p r=%d flags=%d size=%d\n", this, refcnt, getFlags(), head.getLength());
head.print();
} }
PXT_VTABLE_CTOR(RefAction) {} PXT_VTABLE_CTOR(RefAction) {}
@ -278,6 +545,7 @@ namespace pxt {
void RefLocal::destroy() void RefLocal::destroy()
{ {
delete this;
} }
PXT_VTABLE_CTOR(RefLocal) { PXT_VTABLE_CTOR(RefLocal) {
@ -296,6 +564,7 @@ namespace pxt {
void RefRefLocal::destroy() void RefRefLocal::destroy()
{ {
decr(v); decr(v);
delete this;
} }
PXT_VTABLE_BEGIN(RefMap, 0, RefMapMarker) PXT_VTABLE_BEGIN(RefMap, 0, RefMapMarker)
@ -310,6 +579,7 @@ namespace pxt {
data[i].val = 0; data[i].val = 0;
} }
data.resize(0); data.resize(0);
delete this;
} }
int RefMap::findIdx(uint32_t key) { int RefMap::findIdx(uint32_t key) {
@ -334,7 +604,7 @@ namespace pxt {
for(std::set<RefObject*>::iterator itr = allptrs.begin();itr!=allptrs.end();itr++) for(std::set<RefObject*>::iterator itr = allptrs.begin();itr!=allptrs.end();itr++)
{ {
(*itr)->print(); (*itr)->print();
} }
printf("\n"); printf("\n");
} }
#else #else
@ -347,16 +617,16 @@ namespace pxt {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
map<pair<int, int>, Action> handlersMap; map<pair<int, int>, Action> handlersMap;
MicroBitEvent lastEvent; MicroBitEvent lastEvent;
// We have the invariant that if [dispatchEvent] is registered against the DAL // We have the invariant that if [dispatchEvent] is registered against the DAL
// for a given event, then [handlersMap] contains a valid entry for that // for a given event, then [handlersMap] contains a valid entry for that
// event. // event.
void dispatchEvent(MicroBitEvent e) { void dispatchEvent(MicroBitEvent e) {
lastEvent = e; lastEvent = e;
Action curr = handlersMap[{ e.source, e.value }]; Action curr = handlersMap[{ e.source, e.value }];
if (curr) if (curr)
runAction1(curr, e.value); runAction1(curr, e.value);
@ -389,7 +659,7 @@ namespace pxt {
create_fiber((void(*)(void*))runAction0, (void*)a, fiberDone); create_fiber((void(*)(void*))runAction0, (void*)a, fiberDone);
} }
} }
void error(ERROR code, int subcode) void error(ERROR code, int subcode)
{ {
@ -441,10 +711,10 @@ namespace pxt {
// unique group for radio based on source hash // unique group for radio based on source hash
// ::touch_develop::micro_bit::radioDefaultGroup = programHash(); // ::touch_develop::micro_bit::radioDefaultGroup = programHash();
// repeat error 4 times and restart as needed // repeat error 4 times and restart as needed
microbit_panic_timeout(4); microbit_panic_timeout(4);
int32_t ver = *pc++; int32_t ver = *pc++;
checkStr(ver == 0x4209, ":( Bad runtime version"); checkStr(ver == 0x4209, ":( Bad runtime version");
@ -473,6 +743,6 @@ namespace pxt {
{ {
exec_binary((int32_t*)functionsAndBytecode); exec_binary((int32_t*)functionsAndBytecode);
} }
} }
// vim: ts=2 sw=2 expandtab // vim: ts=2 sw=2 expandtab

View File

@ -1,7 +1,7 @@
#ifndef __PXT_H #ifndef __PXT_H
#define __PXT_H #define __PXT_H
// #define DEBUG_MEMLEAKS 1 //#define DEBUG_MEMLEAKS 1
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
@ -63,7 +63,7 @@ namespace pxt {
int templateHash(); int templateHash();
int programHash(); int programHash();
uint32_t programSize(); uint32_t programSize();
uint32_t afterProgramPage(); uint32_t afterProgramPage();
int getNumGlobals(); int getNumGlobals();
RefRecord* mkClassInstance(int vtableOffset); RefRecord* mkClassInstance(int vtableOffset);
@ -167,11 +167,49 @@ namespace pxt {
} }
}; };
class Segment {
private:
uint32_t* data;
uint16_t length;
uint16_t size;
static const uint16_t MaxSize = 0xFFFF;
static const uint32_t DefaultValue = 0x0;
static uint16_t growthFactor(uint16_t size);
void growByMin(uint16_t minSize);
void growBy(uint16_t newSize);
void ensure(uint16_t newSize);
public:
Segment() : data (nullptr), length(0), size(0) {};
uint32_t get(uint32_t i);
void set(uint32_t i, uint32_t value);
uint32_t getLength() { return length;};
void setLength(uint32_t newLength);
void push(uint32_t value);
uint32_t pop();
uint32_t remove(uint32_t i);
void insert(uint32_t i, uint32_t value);
bool isValidIndex(uint32_t i);
void destroy();
void print();
};
// A ref-counted collection of either primitive or ref-counted objects (String, Image, // A ref-counted collection of either primitive or ref-counted objects (String, Image,
// user-defined record, another collection) // user-defined record, another collection)
class RefCollection class RefCollection
: public RefObject : public RefObject
{ {
private:
Segment head;
public: public:
// 1 - collection of refs (need decr) // 1 - collection of refs (need decr)
// 2 - collection of strings (in fact we always have 3, never 2 alone) // 2 - collection of strings (in fact we always have 3, never 2 alone)
@ -179,23 +217,23 @@ namespace pxt {
inline bool isRef() { return getFlags() & 1; } inline bool isRef() { return getFlags() & 1; }
inline bool isString() { return getFlags() & 2; } inline bool isString() { return getFlags() & 2; }
std::vector<uint32_t> data;
RefCollection(uint16_t f); RefCollection(uint16_t f);
inline bool in_range(int x) {
return (0 <= x && x < (int)data.size());
}
inline int length() { return data.size(); }
void destroy(); void destroy();
void print(); void print();
uint32_t length() { return head.getLength();}
void setLength(uint32_t newLength) { head.setLength(newLength); }
void push(uint32_t x); void push(uint32_t x);
uint32_t getAt(int x); uint32_t pop();
void removeAt(int x); uint32_t getAt(int i);
void setAt(int x, uint32_t y); void setAt(int i, uint32_t x);
//removes the element at index i and shifts the other elements left
uint32_t removeAt(int i);
//inserts the element at index i and moves the other elements right.
void insertAt(int i, uint32_t x);
int indexOf(uint32_t x, int start); int indexOf(uint32_t x, int start);
int removeElement(uint32_t x); int removeElement(uint32_t x);
}; };

View File

@ -43,8 +43,7 @@
"public": true, "public": true,
"dependencies": {}, "dependencies": {},
"yotta": { "yotta": {
"configIsJustDefaults": true, "optionalConfig": {
"config": {
"microbit-dal": { "microbit-dal": {
"bluetooth": { "bluetooth": {
"enabled": 0 "enabled": 0

View File

@ -1,15 +1,12 @@
#include "pxt.h" #include "pxt.h"
enum SerialPin { enum SerialPin {
P0 = MICROBIT_ID_IO_P0, C16 = MICROBIT_ID_IO_P2,
P1 = MICROBIT_ID_IO_P1, C17 = MICROBIT_ID_IO_P8,
P2 = MICROBIT_ID_IO_P2, P0 = MICROBIT_ID_IO_P12,
//P8 = MICROBIT_ID_IO_P8, P1 = MICROBIT_ID_IO_P0,
//P12 = MICROBIT_ID_IO_P12, P2 = MICROBIT_ID_IO_P1,
//P13 = MICROBIT_ID_IO_P13, P3 = MICROBIT_ID_IO_P16,
//P14 = MICROBIT_ID_IO_P14,
//P15 = MICROBIT_ID_IO_P15,
//P16 = MICROBIT_ID_IO_P16
}; };
enum BaudRate { enum BaudRate {
@ -51,24 +48,27 @@ namespace serial {
} }
/** /**
* Reads a line of text from the serial port. * Reads the buffered received data as a string
*/ */
//% help=serial/read-line //% blockId=serial_read_buffer block="serial|read string"
//% blockId=serial_read_line block="serial|read line" //% weight=18
//% weight=20 blockGap=8 StringData* readString() {
StringData* readLine() { int n = uBit.serial.getRxBufferSize();
return readUntil(ManagedString("\n").leakData()); if (n == 0) return ManagedString("").leakData();
return ManagedString(uBit.serial.read(n, MicroBitSerialMode::ASYNC)).leakData();
} }
/** /**
* Registers an event to be fired when one of the delimiter is matched * Registers an event to be fired when one of the delimiter is matched.
* @param delimiters the characters to match received characters against. eg:"\n" * @param delimiters the characters to match received characters against.
*/ */
// help=serial/on-data-received //% help=serial/on-data-received
// weight=18 //% weight=18 blockId=serial_on_data_received block="serial|on data received %delimiters=serial_delimiter_conv"
void onDataReceived(StringData* delimiters, Action body) { void onDataReceived(StringData* delimiters, Action body) {
uBit.serial.eventOn(ManagedString(delimiters)); uBit.serial.eventOn(ManagedString(delimiters));
registerWithDal(MICROBIT_ID_SERIAL, MICROBIT_SERIAL_EVT_DELIM_MATCH, body); registerWithDal(MICROBIT_ID_SERIAL, MICROBIT_SERIAL_EVT_DELIM_MATCH, body);
// lazy initialization of serial buffers
uBit.serial.read(MicroBitSerialMode::ASYNC);
} }
/** /**

View File

@ -1,7 +1,7 @@
/** /**
* Reading and writing data over a serial connection. * Reading and writing data over a serial connection.
*/ */
//% weight=2 color=#002050 //% weight=2 color=#002050 icon="\uf287"
//% advanced=true //% advanced=true
namespace serial { namespace serial {
/** /**
@ -38,20 +38,20 @@ namespace serial {
} }
/** /**
* Registers an event to be fired when a line has been received * Reads a line of text from the serial port.
*/ */
// help=serial/on-line-received //% help=serial/read-line
// blockId=serial_on_line_received block="serial on line received" //% blockId=serial_read_line block="serial|read line"
// weight=21 blockGap=8 //% weight=20 blockGap=8
export function onLineReceived(body: Action): void { export function readLine(): string {
// serial.onDataReceived("\n", body); return serial.readUntil(delimiters(Delimiters.NewLine));
} }
/** /**
* Returns the delimiter corresponding string * Returns the delimiter corresponding string
*/ */
//% blockId="serial_delimiter_conv" block="%del" //% blockId="serial_delimiter_conv" block="%del"
//% weight=1 //% weight=1 blockHidden=true
export function delimiters(del: Delimiters): string { export function delimiters(del: Delimiters): string {
// even though it might not look like, this is more // even though it might not look like, this is more
// (memory) efficient than the C++ implementation, because the // (memory) efficient than the C++ implementation, because the

107
libs/core/shims.d.ts vendored
View File

@ -4,7 +4,7 @@
/** /**
* Creation, manipulation and display of LED images. * Creation, manipulation and display of LED images.
*/ */
//% color=#5C2D91 weight=31 //% color=#5C2D91 weight=31 icon="\uf03e"
//% advanced=true //% advanced=true
declare namespace images { declare namespace images {
@ -40,8 +40,8 @@ declare interface Image {
*/ */
//% help=images/show-image weight=80 blockNamespace=images //% help=images/show-image weight=80 blockNamespace=images
//% blockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8 //% blockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8
//% parts="ledmatrix" shim=ImageMethods::showImage //% parts="ledmatrix" async interval.defl=400 shim=ImageMethods::showImage
showImage(xOffset: number): void; showImage(xOffset: number, interval?: number): void;
/** /**
* Draws the ``index``-th frame of the image on the screen. * Draws the ``index``-th frame of the image on the screen.
@ -118,21 +118,21 @@ declare interface Image {
* @param frame TODO * @param frame TODO
*/ */
//% weight=70 help=images/show-frame //% weight=70 help=images/show-frame
//% parts="ledmatrix" shim=ImageMethods::showFrame //% parts="ledmatrix" interval.defl=400 shim=ImageMethods::showFrame
showFrame(frame: number): void; showFrame(frame: number, interval?: number): void;
} }
/** /**
* Provides access to basic micro:bit functionality. * Provides access to basic micro:bit functionality.
*/ */
//% color=#54C9C9 weight=100 //% color=#54C9C9 weight=100 icon="\uf00a"
declare namespace basic { declare namespace basic {
/** /**
* Sets the color on the build-in LED. Set to 0 to turn off. * Sets the color on the build-in LED. Set to 0 to turn off.
*/ */
//% blockId=device_set_led_color block="set led to %color=color_id" icon="\uf00a" //% blockId=device_set_led_color block="set led to %color=color_id"
//% weight=50 shim=basic::setLedColor //% weight=50 shim=basic::setLedColor
function setLedColor(color: number): void; function setLedColor(color: number): void;
@ -142,7 +142,7 @@ declare namespace basic {
*/ */
//% help=basic/show-number //% help=basic/show-number
//% weight=96 //% weight=96
//% blockId=device_show_number block="show|number %number" blockGap=8 icon="\uf1ec" //% blockId=device_show_number block="show|number %number" blockGap=8
//% async //% async
//% parts="ledmatrix" interval.defl=150 shim=basic::showNumber //% parts="ledmatrix" interval.defl=150 shim=basic::showNumber
function showNumber(value: number, interval?: number): void; function showNumber(value: number, interval?: number): void;
@ -156,7 +156,7 @@ declare namespace basic {
//% weight=95 blockGap=8 //% weight=95 blockGap=8
//% imageLiteral=1 async //% imageLiteral=1 async
//% blockId=device_show_leds //% blockId=device_show_leds
//% block="show leds" icon="\uf00a" //% block="show leds"
//% parts="ledmatrix" interval.defl=400 shim=basic::showLeds //% parts="ledmatrix" interval.defl=400 shim=basic::showLeds
function showLeds(leds: string, interval?: number): void; function showLeds(leds: string, interval?: number): void;
@ -167,7 +167,7 @@ declare namespace basic {
*/ */
//% help=basic/show-string //% help=basic/show-string
//% weight=87 blockGap=8 //% weight=87 blockGap=8
//% block="show|string %text" icon="\uf031" //% block="show|string %text"
//% async //% async
//% blockId=device_print_message //% blockId=device_print_message
//% parts="ledmatrix" interval.defl=150 shim=basic::showString //% parts="ledmatrix" interval.defl=150 shim=basic::showString
@ -177,7 +177,7 @@ declare namespace basic {
* Turn off all LEDs * Turn off all LEDs
*/ */
//% help=basic/clear-screen weight=79 //% help=basic/clear-screen weight=79
//% blockId=device_clear_display block="clear screen" icon="\uf12d" //% blockId=device_clear_display block="clear screen"
//% parts="ledmatrix" shim=basic::clearScreen //% parts="ledmatrix" shim=basic::clearScreen
function clearScreen(): void; function clearScreen(): void;
@ -203,7 +203,7 @@ declare namespace basic {
* @param body code to execute * @param body code to execute
*/ */
//% help=basic/forever weight=55 blockGap=8 //% help=basic/forever weight=55 blockGap=8
//% blockId=device_forever block="forever" icon="\uf01e" shim=basic::forever //% blockId=device_forever block="forever" shim=basic::forever
function forever(a: () => void): void; function forever(a: () => void): void;
/** /**
@ -212,13 +212,13 @@ declare namespace basic {
*/ */
//% help=basic/pause weight=54 //% help=basic/pause weight=54
//% async block="pause (ms) %pause" //% async block="pause (ms) %pause"
//% blockId=device_pause icon="\uf110" shim=basic::pause //% blockId=device_pause shim=basic::pause
function pause(ms: number): void; function pause(ms: number): void;
} }
//% color=#C90072 weight=99 //% color=#C90072 weight=99 icon="\uf192"
declare namespace input { declare namespace input {
/** /**
@ -227,7 +227,7 @@ declare namespace input {
* @param body TODO * @param body TODO
*/ */
//% help=input/on-button-pressed weight=85 blockGap=8 //% help=input/on-button-pressed weight=85 blockGap=8
//% blockId=device_button_event block="on button|%NAME|pressed" icon="\uf192" //% blockId=device_button_event block="on button|%NAME|pressed"
//% parts="buttonpair" shim=input::onButtonPressed //% parts="buttonpair" shim=input::onButtonPressed
function onButtonPressed(button: Button, body: () => void): void; function onButtonPressed(button: Button, body: () => void): void;
@ -236,7 +236,7 @@ declare namespace input {
* @param body TODO * @param body TODO
*/ */
//% help=input/on-gesture weight=84 blockGap=8 //% help=input/on-gesture weight=84 blockGap=8
//% blockId=device_gesture_event block="on |%NAME" icon="\uf135" //% blockId=device_gesture_event block="on |%NAME"
//% parts="accelerometer" shim=input::onGesture //% parts="accelerometer" shim=input::onGesture
function onGesture(gesture: Gesture, body: () => void): void; function onGesture(gesture: Gesture, body: () => void): void;
@ -246,7 +246,7 @@ declare namespace input {
* @param body the code to run when the pin is pressed * @param body the code to run when the pin is pressed
*/ */
//% help=input/on-pin-pressed weight=83 //% help=input/on-pin-pressed weight=83
//% blockId=device_pin_event block="on pin %NAME|pressed" icon="\uf094" shim=input::onPinPressed //% blockId=device_pin_event block="on pin %NAME|pressed" shim=input::onPinPressed
function onPinPressed(name: TouchPin, body: () => void): void; function onPinPressed(name: TouchPin, body: () => void): void;
/** /**
@ -255,7 +255,7 @@ declare namespace input {
* @param body the code to run when the pin is released * @param body the code to run when the pin is released
*/ */
//% help=input/on-pin-released weight=6 blockGap=8 //% help=input/on-pin-released weight=6 blockGap=8
//% blockId=device_pin_released block="on pin %NAME|released" icon="\uf094" //% blockId=device_pin_released block="on pin %NAME|released"
//% advanced=true shim=input::onPinReleased //% advanced=true shim=input::onPinReleased
function onPinReleased(name: TouchPin, body: () => void): void; function onPinReleased(name: TouchPin, body: () => void): void;
@ -265,7 +265,7 @@ declare namespace input {
//% help=input/button-is-pressed weight=60 //% help=input/button-is-pressed weight=60
//% block="button|%NAME|is pressed" //% block="button|%NAME|is pressed"
//% blockId=device_get_button2 //% blockId=device_get_button2
//% icon="\uf192" blockGap=8 //% blockGap=8
//% parts="buttonpair" shim=input::buttonIsPressed //% parts="buttonpair" shim=input::buttonIsPressed
function buttonIsPressed(button: Button): boolean; function buttonIsPressed(button: Button): boolean;
@ -274,7 +274,7 @@ declare namespace input {
* @param name pin used to detect the touch * @param name pin used to detect the touch
*/ */
//% help=input/pin-is-pressed weight=58 //% help=input/pin-is-pressed weight=58
//% blockId="device_pin_is_pressed" block="pin %NAME|is pressed" icon="\uf094" //% blockId="device_pin_is_pressed" block="pin %NAME|is pressed"
//% blockGap=8 shim=input::pinIsPressed //% blockGap=8 shim=input::pinIsPressed
function pinIsPressed(name: TouchPin): boolean; function pinIsPressed(name: TouchPin): boolean;
@ -282,7 +282,7 @@ declare namespace input {
* Get the acceleration value in milli-gravitys (when the board is laying flat with the screen up, x=0, y=0 and z=-1024) * Get the acceleration value in milli-gravitys (when the board is laying flat with the screen up, x=0, y=0 and z=-1024)
* @param dimension TODO * @param dimension TODO
*/ */
//% help=input/acceleration weight=58 icon="\uf135" //% help=input/acceleration weight=58
//% blockId=device_acceleration block="acceleration (mg)|%NAME" blockGap=8 //% blockId=device_acceleration block="acceleration (mg)|%NAME" blockGap=8
//% parts="accelerometer" shim=input::acceleration //% parts="accelerometer" shim=input::acceleration
function acceleration(dimension: Dimension): number; function acceleration(dimension: Dimension): number;
@ -291,7 +291,7 @@ declare namespace input {
* Reads the light level applied to the LED screen in a range from ``0`` (dark) to ``255`` bright. * Reads the light level applied to the LED screen in a range from ``0`` (dark) to ``255`` bright.
*/ */
//% help=input/light-level weight=57 //% help=input/light-level weight=57
//% blockId=device_get_light_level block="light level" blockGap=8 icon="\uf185" //% blockId=device_get_light_level block="light level" blockGap=8
//% parts="ledmatrix" shim=input::lightLevel //% parts="ledmatrix" shim=input::lightLevel
function lightLevel(): number; function lightLevel(): number;
@ -299,7 +299,7 @@ declare namespace input {
* Get the current compass heading in degrees. * Get the current compass heading in degrees.
*/ */
//% help=input/compass-heading //% help=input/compass-heading
//% weight=56 icon="\uf14e" //% weight=56
//% blockId=device_heading block="compass heading (°)" blockGap=8 //% blockId=device_heading block="compass heading (°)" blockGap=8
//% parts="compass" shim=input::compassHeading //% parts="compass" shim=input::compassHeading
function compassHeading(): number; function compassHeading(): number;
@ -307,7 +307,7 @@ declare namespace input {
/** /**
* Gets the temperature in Celsius degrees (°C). * Gets the temperature in Celsius degrees (°C).
*/ */
//% weight=55 icon="\uf06d" //% weight=55
//% help=input/temperature //% help=input/temperature
//% blockId=device_temperature block="temperature (°C)" blockGap=8 //% blockId=device_temperature block="temperature (°C)" blockGap=8
//% parts="thermometer" shim=input::temperature //% parts="thermometer" shim=input::temperature
@ -318,7 +318,7 @@ declare namespace input {
* @param kind TODO * @param kind TODO
*/ */
//% help=input/rotation weight=52 //% help=input/rotation weight=52
//% blockId=device_get_rotation block="rotation (°)|%NAME" blockGap=8 icon="\uf197" //% blockId=device_get_rotation block="rotation (°)|%NAME" blockGap=8
//% parts="accelerometer" advanced=true shim=input::rotation //% parts="accelerometer" advanced=true shim=input::rotation
function rotation(kind: Rotation): number; function rotation(kind: Rotation): number;
@ -327,7 +327,7 @@ declare namespace input {
* @param dimension TODO * @param dimension TODO
*/ */
//% help=input/magnetic-force weight=51 //% help=input/magnetic-force weight=51
//% blockId=device_get_magnetic_force block="magnetic force (µT)|%NAME" blockGap=8 icon="\uf076" //% blockId=device_get_magnetic_force block="magnetic force (µT)|%NAME" blockGap=8
//% parts="compass" //% parts="compass"
//% advanced=true shim=input::magneticForce //% advanced=true shim=input::magneticForce
function magneticForce(dimension: Dimension): number; function magneticForce(dimension: Dimension): number;
@ -336,7 +336,7 @@ declare namespace input {
* Gets the number of milliseconds elapsed since power on. * Gets the number of milliseconds elapsed since power on.
*/ */
//% 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)"
//% advanced=true shim=input::runningTime //% advanced=true shim=input::runningTime
function runningTime(): number; function runningTime(): number;
@ -351,7 +351,7 @@ declare namespace input {
* @param range a value describe the maximum strengh of acceleration measured * @param range a value describe the maximum strengh of acceleration measured
*/ */
//% help=input/set-accelerometer-range //% help=input/set-accelerometer-range
//% blockId=device_set_accelerometer_range block="set accelerometer|range %range" icon="\uf135" //% blockId=device_set_accelerometer_range block="set accelerometer|range %range"
//% weight=5 //% weight=5
//% parts="accelerometer" //% parts="accelerometer"
//% advanced=true shim=input::setAccelerometerRange //% advanced=true shim=input::setAccelerometerRange
@ -432,7 +432,7 @@ declare namespace control {
//% color=#8169E6 weight=35 //% color=#8169E6 weight=35 icon="\uf205"
declare namespace led { declare namespace led {
/** /**
@ -441,7 +441,7 @@ declare namespace led {
* @param y TODO * @param y TODO
*/ */
//% help=led/plot weight=78 //% help=led/plot weight=78
//% blockId=device_plot block="plot|x %x|y %y" icon="\uf205" blockGap=8 //% blockId=device_plot block="plot|x %x|y %y" blockGap=8
//% parts="ledmatrix" shim=led::plot //% parts="ledmatrix" shim=led::plot
function plot(x: number, y: number): void; function plot(x: number, y: number): void;
@ -451,7 +451,7 @@ declare namespace led {
* @param y TODO * @param y TODO
*/ */
//% help=led/unplot weight=77 //% help=led/unplot weight=77
//% blockId=device_unplot block="unplot|x %x|y %y" icon="\uf204" blockGap=8 //% blockId=device_unplot block="unplot|x %x|y %y" blockGap=8
//% parts="ledmatrix" shim=led::unplot //% parts="ledmatrix" shim=led::unplot
function unplot(x: number, y: number): void; function unplot(x: number, y: number): void;
@ -461,7 +461,7 @@ declare namespace led {
* @param y TODO * @param y TODO
*/ */
//% help=led/point weight=76 //% help=led/point weight=76
//% blockId=device_point block="point|x %x|y %y" icon="\uf10c" //% blockId=device_point block="point|x %x|y %y"
//% parts="ledmatrix" shim=led::point //% parts="ledmatrix" shim=led::point
function point(x: number, y: number): boolean; function point(x: number, y: number): boolean;
@ -469,7 +469,7 @@ declare namespace led {
* Get the screen brightness from 0 (off) to 255 (full bright). * Get the screen brightness from 0 (off) to 255 (full bright).
*/ */
//% help=led/brightness weight=60 //% help=led/brightness weight=60
//% blockId=device_get_brightness block="brightness" icon="\uf042" blockGap=8 //% blockId=device_get_brightness block="brightness" blockGap=8
//% parts="ledmatrix" //% parts="ledmatrix"
//% advanced=true shim=led::brightness //% advanced=true shim=led::brightness
function brightness(): number; function brightness(): number;
@ -479,7 +479,7 @@ declare namespace led {
* @param value the brightness value, eg:255, 127, 0 * @param value the brightness value, eg:255, 127, 0
*/ */
//% help=led/set-brightness weight=59 //% help=led/set-brightness weight=59
//% blockId=device_set_brightness block="set brightness %value" icon="\uf042" //% blockId=device_set_brightness block="set brightness %value"
//% parts="ledmatrix" //% parts="ledmatrix"
//% advanced=true shim=led::setBrightness //% advanced=true shim=led::setBrightness
function setBrightness(value: number): void; function setBrightness(value: number): void;
@ -488,7 +488,7 @@ declare namespace led {
* Cancels the current animation and clears other pending animations. * Cancels the current animation and clears other pending animations.
*/ */
//% weight=50 help=led/stop-animation //% weight=50 help=led/stop-animation
//% blockId=device_stop_animation block="stop animation" icon="\uf04d" //% blockId=device_stop_animation block="stop animation"
//% parts="ledmatrix" //% parts="ledmatrix"
//% advanced=true shim=led::stopAnimation //% advanced=true shim=led::stopAnimation
function stopAnimation(): void; function stopAnimation(): void;
@ -504,7 +504,7 @@ declare namespace led {
/** /**
* Turns on or off the display * Turns on or off the display
*/ */
//% help=led/enable blockId=device_led_enable icon="\uf04d" //% help=led/enable blockId=device_led_enable
//% advanced=true parts="ledmatrix" shim=led::enable //% advanced=true parts="ledmatrix" shim=led::enable
function enable(on: boolean): void; function enable(on: boolean): void;
@ -520,7 +520,7 @@ declare namespace led {
/** /**
* Blocks to control the onboard motors * Blocks to control the onboard motors
*/ */
//% color=#008272 weight=30 //% color=#008272 weight=30 icon="\uf1b9"
declare namespace motors { declare namespace motors {
/** /**
@ -651,7 +651,8 @@ declare namespace pins {
* Sets the pin used when using `pins->analog pitch`. * Sets the pin used when using `pins->analog pitch`.
* @param name TODO * @param name TODO
*/ */
//% help=pins/analog-set-pitch weight=12 shim=pins::analogSetPitchPin //% blockId=device_analog_set_pitch_pin block="analog set pitch pin %name"
//% help=pins/analog-set-pitch weight=3 advanced=true shim=pins::analogSetPitchPin
function analogSetPitchPin(name: AnalogPin): void; function analogSetPitchPin(name: AnalogPin): void;
/** /**
@ -659,7 +660,8 @@ declare namespace pins {
* @param frequency TODO * @param frequency TODO
* @param ms TODO * @param ms TODO
*/ */
//% help=pins/analog-pitch weight=14 async shim=pins::analogPitch //% blockId=device_analog_pitch block="analog pitch %frequency|for (ms) %ms"
//% help=pins/analog-pitch weight=4 async advanced=true blockGap=8 shim=pins::analogPitch
function analogPitch(frequency: number, ms: number): void; function analogPitch(frequency: number, ms: number): void;
/** /**
@ -671,6 +673,16 @@ declare namespace pins {
//% blockId=device_set_pull block="set pull|pin %pin|to %pull" shim=pins::setPull //% blockId=device_set_pull block="set pull|pin %pin|to %pull" shim=pins::setPull
function setPull(name: DigitalPin, pull: PinPullMode): void; function setPull(name: DigitalPin, pull: PinPullMode): void;
/**
* Configures the events emitted by this pin. Events can be subscribed to
* using ``control.onEvent()``.
* @param name pin to set the event mode on, eg: DigitalPin.P0
* @param type the type of events for this pin to emit, eg: PinEventType.Edge
*/
//% help=pins/set-events weight=4 advanced=true
//% blockId=device_set_pin_events block="set pin %pin|to emit %type|events" shim=pins::setEvents
function setEvents(name: DigitalPin, type: PinEventType): void;
/** /**
* Create a new zero-initialized buffer. * Create a new zero-initialized buffer.
* @param size number of bytes in the buffer * @param size number of bytes in the buffer
@ -715,12 +727,19 @@ declare namespace serial {
function readUntil(delimiter: string): string; function readUntil(delimiter: string): string;
/** /**
* Reads a line of text from the serial port. * Reads the buffered received data as a string
*/ */
//% help=serial/read-line //% blockId=serial_read_buffer block="serial|read string"
//% blockId=serial_read_line block="serial|read line" //% weight=18 shim=serial::readString
//% weight=20 blockGap=8 shim=serial::readLine function readString(): string;
function readLine(): string;
/**
* Registers an event to be fired when one of the delimiter is matched.
* @param delimiters the characters to match received characters against.
*/
//% help=serial/on-data-received
//% weight=18 blockId=serial_on_data_received block="serial|on data received %delimiters=serial_delimiter_conv" shim=serial::onDataReceived
function onDataReceived(delimiters: string, body: () => void): void;
/** /**
* Sends a piece of text through Serial connection. * Sends a piece of text through Serial connection.

View File

@ -1,7 +1,7 @@
/** /**
* Communicate data using radio packets * Communicate data using radio packets
*/ */
//% color=#E3008C weight=34 //% color=#E3008C weight=34 icon="\uf012"
namespace radio { namespace radio {
export class Packet { export class Packet {
/** /**

View File

@ -1,7 +1,7 @@
{ {
"name": "pxt-calliope", "name": "pxt-calliope",
"version": "0.7.1", "version": "0.8.14",
"description": "calliope target for PXT", "description": "Calliope Mini editor for PXT",
"keywords": [ "keywords": [
"JavaScript", "JavaScript",
"education", "education",
@ -34,6 +34,9 @@
"semantic-ui-less": "^2.2.4" "semantic-ui-less": "^2.2.4"
}, },
"dependencies": { "dependencies": {
"pxt-core": "0.6.2" "pxt-core": "0.11.14"
},
"scripts": {
"test": "node node_modules/pxt-core/built/pxt.js travis"
} }
} }

View File

@ -15,13 +15,13 @@
"workspace": false, "workspace": false,
"packages": true, "packages": true,
"sharing": true, "sharing": true,
"publish": true, "publishing": true,
"preferredPackages": [ "preferredPackages": [
], ],
"githubPackages": true "githubPackages": true
}, },
"compile": { "compile": {
"isNative": false, "isNative": true,
"hasHex": true, "hasHex": true,
"deployDrives": "MINI", "deployDrives": "MINI",
"driveName": "MINI", "driveName": "MINI",
@ -54,7 +54,9 @@
"mathBlocks": true, "mathBlocks": true,
"loopsBlocks": true, "loopsBlocks": true,
"logicBlocks": true, "logicBlocks": true,
"variablesBlocks": true "variablesBlocks": true,
"onStartColor": "#54C9C9",
"onStartNamespace": "basic"
}, },
"simulator": { "simulator": {
"autoRun": true, "autoRun": true,
@ -114,7 +116,7 @@
"C19": "C_P19", "C19": "C_P19",
"C20": "C_P20", "C20": "C_P20",
"EXT_PWR":"EXT_PWR", "EXT_PWR":"EXT_PWR",
"SPKR":"EXT_PWR", "SPKR":"SPKR",
"BTN_A": "BTN_A", "BTN_A": "BTN_A",
"BTN_B": "BTN_B", "BTN_B": "BTN_B",
"MOTOR1": "M_OUT1", "MOTOR1": "M_OUT1",
@ -165,12 +167,12 @@
} }
}, },
"compileService": { "compileService": {
"yottaTarget": "bbc-microbit-classic-gcc", "yottaTarget": "calliope-mini-classic-gcc",
"yottaCorePackage": "microbit", "yottaCorePackage": "microbit",
"githubCorePackage": "calliope-mini/microbit", "githubCorePackage": "calliope-mini/microbit",
"gittag": "v1.0.2-calliope", "gittag": "v2.0.0-rc7-calliope-p9",
"serviceId": "microbit" "serviceId": "calliope"
}, },
"serial": { "serial": {
"manufacturerFilter": "^mbed$", "manufacturerFilter": "^mbed$",
"nameFilter": "^mbed Serial Port", "nameFilter": "^mbed Serial Port",
@ -187,10 +189,11 @@
"cardLogo": "./static/icons/apple-touch-icon.png", "cardLogo": "./static/icons/apple-touch-icon.png",
"appLogo": "./static/icons/apple-touch-icon.png", "appLogo": "./static/icons/apple-touch-icon.png",
"homeUrl": "https://calliope.cc/", "homeUrl": "https://calliope.cc/",
"embedUrl": "https://calliope.cc/", "embedUrl": "https://mini.pxt.io/",
"privacyUrl": "https://go.microsoft.com/fwlink/?LinkId=521839", "privacyUrl": "https://go.microsoft.com/fwlink/?LinkId=521839",
"termsOfUseUrl": "https://go.microsoft.com/fwlink/?LinkID=206977", "termsOfUseUrl": "https://go.microsoft.com/fwlink/?LinkID=206977",
"githubUrl": "https://github.com/Microsoft/pxt-calliope", "githubUrl": "https://github.com/Microsoft/pxt-calliope",
"crowdinProject": "kindscript",
"organization": "Microsoft", "organization": "Microsoft",
"organizationUrl": "https://pxt.io/", "organizationUrl": "https://pxt.io/",
"organizationLogo": "./static/Microsoft-logo_rgb_c-gray.png", "organizationLogo": "./static/Microsoft-logo_rgb_c-gray.png",
@ -289,8 +292,17 @@
], ],
"invertedMenu": true, "invertedMenu": true,
"invertedToolbox": true, "invertedToolbox": true,
"monacoToolbox": false,
"hasAudio": true,
"simAnimationEnter": "rotate in", "simAnimationEnter": "rotate in",
"simAnimationExit": "rotate out", "simAnimationExit": "rotate out",
"blocklyOptions": { } "blocklyOptions": {
"grid": {
"spacing": 45,
"length": 7,
"colour": "rgba(189, 195, 199, 0.30)",
"snap": false
}
}
} }
} }

View File

@ -16,7 +16,6 @@ namespace pxsim {
neopixelState: NeoPixelState; neopixelState: NeoPixelState;
rgbLedState: number; rgbLedState: number;
speakerState: SpeakerState; speakerState: SpeakerState;
servosState: MicroServosState;
fileSystem: FileSystemState; fileSystem: FileSystemState;
constructor() { constructor() {
@ -42,20 +41,27 @@ namespace pxsim {
DAL.MICROBIT_ID_IO_P5, DAL.MICROBIT_ID_IO_P5,
DAL.MICROBIT_ID_IO_P6, DAL.MICROBIT_ID_IO_P6,
DAL.MICROBIT_ID_IO_P7, DAL.MICROBIT_ID_IO_P7,
0, //DAL.MICROBIT_ID_IO_P8, DAL.MICROBIT_ID_IO_P8,
DAL.MICROBIT_ID_IO_P9, DAL.MICROBIT_ID_IO_P9,
DAL.MICROBIT_ID_IO_P10, DAL.MICROBIT_ID_IO_P10,
DAL.MICROBIT_ID_IO_P11, DAL.MICROBIT_ID_IO_P11,
0, //DAL.MICROBIT_ID_IO_P12, DAL.MICROBIT_ID_IO_P12,
0, //DAL.MICROBIT_ID_IO_P13, DAL.MICROBIT_ID_IO_P13,
0, //DAL.MICROBIT_ID_IO_P14, DAL.MICROBIT_ID_IO_P14,
0, //DAL.MICROBIT_ID_IO_P15, DAL.MICROBIT_ID_IO_P15,
0, //DAL.MICROBIT_ID_IO_P16, DAL.MICROBIT_ID_IO_P16,
0, 0,
0, 0,
DAL.MICROBIT_ID_IO_P19, DAL.MICROBIT_ID_IO_P19,
DAL.MICROBIT_ID_IO_P20 DAL.MICROBIT_ID_IO_P20,
] DAL.MICROBIT_ID_IO_P21
],
servos: {
"P0": DAL.MICROBIT_ID_IO_P12,
"P1": DAL.MICROBIT_ID_IO_P0,
"P2": DAL.MICROBIT_ID_IO_P1,
"P3": DAL.MICROBIT_ID_IO_P16
}
}); });
this.builtinParts["radio"] = this.radioState = new RadioState(runtime); this.builtinParts["radio"] = this.radioState = new RadioState(runtime);
this.builtinParts["accelerometer"] = this.accelerometerState = new AccelerometerState(runtime); this.builtinParts["accelerometer"] = this.accelerometerState = new AccelerometerState(runtime);
@ -65,12 +71,7 @@ namespace pxsim {
this.builtinParts["compass"] = this.compassState = new CompassState(); this.builtinParts["compass"] = this.compassState = new CompassState();
this.builtinParts["neopixel"] = this.neopixelState = new NeoPixelState(); this.builtinParts["neopixel"] = this.neopixelState = new NeoPixelState();
this.builtinParts["speaker"] = this.speakerState = new SpeakerState(); this.builtinParts["speaker"] = this.speakerState = new SpeakerState();
this.builtinParts["microservo"] = this.servosState = new MicroServosState({ this.builtinParts["microservo"] = this.edgeConnectorState;
"P0": DAL.MICROBIT_ID_IO_P0,
"P1": DAL.MICROBIT_ID_IO_P1,
"P2": DAL.MICROBIT_ID_IO_P2,
"P3": DAL.MICROBIT_ID_IO_P3
});
this.builtinVisuals["buttonpair"] = () => new visuals.ButtonPairView(); this.builtinVisuals["buttonpair"] = () => new visuals.ButtonPairView();
this.builtinVisuals["ledmatrix"] = () => new visuals.LedMatrixView(); this.builtinVisuals["ledmatrix"] = () => new visuals.LedMatrixView();

View File

@ -1,4 +1,4 @@
/// <reference path="../node_modules/pxt-core/typings/bluebird/bluebird.d.ts"/> /// <reference path="../node_modules/pxt-core/typings/globals/bluebird/index.d.ts"/>
/// <reference path="../node_modules/pxt-core/built/pxtsim.d.ts"/> /// <reference path="../node_modules/pxt-core/built/pxtsim.d.ts"/>
/// <reference path="../node_modules/pxt-core/built/pxtrunner.d.ts"/> /// <reference path="../node_modules/pxt-core/built/pxtrunner.d.ts"/>

View File

@ -223,10 +223,10 @@ namespace pxsim {
return DAL.MICROBIT_ACCELEROMETER_EVT_TILT_UP; return DAL.MICROBIT_ACCELEROMETER_EVT_TILT_UP;
if (this.getZ() < (-1000 + DAL.MICROBIT_ACCELEROMETER_TILT_TOLERANCE)) if (this.getZ() < (-1000 + DAL.MICROBIT_ACCELEROMETER_TILT_TOLERANCE))
return DAL.MICROBIT_ACCELEROMETER_EVT_FACE_UP; return DAL.MICROBIT_ACCELEROMETER_EVT_FACE_DOWN;
if (this.getZ() > (1000 - DAL.MICROBIT_ACCELEROMETER_TILT_TOLERANCE)) if (this.getZ() > (1000 - DAL.MICROBIT_ACCELEROMETER_TILT_TOLERANCE))
return DAL.MICROBIT_ACCELEROMETER_EVT_FACE_DOWN; return DAL.MICROBIT_ACCELEROMETER_EVT_FACE_UP;
return 0; return 0;
} }

View File

@ -76,8 +76,7 @@ namespace pxsim.pins {
if (!pin) return; if (!pin) return;
analogSetPeriod(pinId, 20000); analogSetPeriod(pinId, 20000);
const state = board().servosState.servoState(pinId); pin.servoAngle = Math.max(0, Math.min(180, value));
state.setAngle(value);
} }
export function servoSetPulse(pinId: number, micros: number) { export function servoSetPulse(pinId: number, micros: number) {

View File

@ -53,9 +53,9 @@ namespace pxsim {
} }
public shiftRight(cols: number) { public shiftRight(cols: number) {
for (let x = this.width - 1; x <= 0; --x) for (let x = this.width - 1; x >= 0; --x)
for (let y = 0; y < 5; ++y) for (let y = 0; y < 5; ++y)
this.set(x, y, x > cols ? this.get(x - cols, y) : 0); this.set(x, y, x >= cols ? this.get(x - cols, y) : 0);
} }
public clear(): void { public clear(): void {
@ -129,10 +129,11 @@ namespace pxsim.images {
} }
namespace pxsim.ImageMethods { namespace pxsim.ImageMethods {
export function showImage(leds: Image, offset: number) { export function showImage(leds: Image, offset: number, interval: number) {
pxtrt.nullCheck(leds) pxtrt.nullCheck(leds)
leds.copyTo(offset, 5, board().ledMatrixState.image, 0) leds.copyTo(offset, 5, board().ledMatrixState.image, 0)
runtime.queueDisplayUpdate() runtime.queueDisplayUpdate()
basic.pause(interval);
} }
export function plotImage(leds: Image, offset: number): void { export function plotImage(leds: Image, offset: number): void {
@ -155,8 +156,8 @@ namespace pxsim.ImageMethods {
ImageMethods.plotImage(leds, frame * Image.height); ImageMethods.plotImage(leds, frame * Image.height);
} }
export function showFrame(leds: Image, frame: number) { export function showFrame(leds: Image, frame: number, interval: number) {
ImageMethods.showImage(leds, frame * Image.height); ImageMethods.showImage(leds, frame * Image.height, interval);
} }
export function pixel(leds: Image, x: number, y: number): number { export function pixel(leds: Image, x: number, y: number): number {
@ -195,11 +196,16 @@ namespace pxsim.ImageMethods {
board().ledMatrixState.animationQ.enqueue({ board().ledMatrixState.animationQ.enqueue({
interval: interval, interval: interval,
frame: () => { frame: () => {
//TODO: support right to left.
if (off >= leds.width || off < 0) return false; if (off >= leds.width || off < 0) return false;
stride > 0 ? display.shiftLeft(stride) : display.shiftRight(-stride); if (stride > 0) {
let c = Math.min(stride, leds.width - off); display.shiftLeft(stride);
leds.copyTo(off, c, display, 5 - stride) const c = Math.min(stride, leds.width - off);
leds.copyTo(off, c, display, 5 - stride)
} else {
display.shiftRight(-stride);
const c = Math.min(-stride, leds.width - off);
leds.copyTo(off, c, display, 0)
}
off += stride; off += stride;
return true; return true;
}, },
@ -223,7 +229,7 @@ namespace pxsim.basic {
clearScreen(); clearScreen();
pause(interval * 5); pause(interval * 5);
} else { } else {
if (s.length == 1) showLeds(createImageFromString(s + " "), interval * 5) if (s.length == 1) showLeds(createImageFromString(s), 0);
else ImageMethods.scrollImage(createImageFromString(s + " "), 1, interval); else ImageMethods.scrollImage(createImageFromString(s + " "), 1, interval);
} }
} }

View File

@ -119,6 +119,9 @@ namespace pxsim.pins {
export function getPinAddress(name: number) { export function getPinAddress(name: number) {
return getPin(name) return getPin(name)
} }
export function setEvents(name: number, event: number) {
}
} }
namespace pxsim.devices { namespace pxsim.devices {

View File

@ -35,18 +35,14 @@ namespace pxsim.serial {
board().writeSerial(s); board().writeSerial(s);
} }
export function readUntil(del: string): string {
return readString();
}
export function readString(): string { export function readString(): string {
return board().serialState.readSerial(); return board().serialState.readSerial();
} }
export function readLine(): string {
return board().serialState.readSerial();
}
export function readUntil(del: string): string {
return readLine();
}
export function onDataReceived(delimiters: string, handler: RefAction) { export function onDataReceived(delimiters: string, handler: RefAction) {
let b = board(); let b = board();
b.bus.listen(DAL.MICROBIT_ID_SERIAL, DAL.MICROBIT_SERIAL_EVT_DELIM_MATCH, handler); b.bus.listen(DAL.MICROBIT_ID_SERIAL, DAL.MICROBIT_SERIAL_EVT_DELIM_MATCH, handler);

View File

@ -1,4 +1,4 @@
/// <reference path="../../node_modules/pxt-core/typings/bluebird/bluebird.d.ts"/> /// <reference path="../../node_modules/pxt-core/typings/globals/bluebird/index.d.ts"/>
/// <reference path="../../node_modules/pxt-core/built/pxtsim.d.ts"/> /// <reference path="../../node_modules/pxt-core/built/pxtsim.d.ts"/>
namespace pxsim.visuals { namespace pxsim.visuals {

View File

@ -12,17 +12,23 @@
/******************************* /*******************************
Add your custom CSS here Add your custom CSS here
*******************************/ *******************************/
/* not relevant in new UI
.openproject { .openproject {
background: #4ECC60 !important; background: #4ECC60 !important;
} } */
.blocks-menuitem, .javascript-menuitem { .blocks-menuitem.active, .javascript-menuitem.active {
background: #738791 !important; background: #738791 !important;
} }
/* not relevant in new UI
.help-dropdown-menuitem, .more-dropdown-menuitem { .help-dropdown-menuitem, .more-dropdown-menuitem {
background: #424955 !important; background: #424955 !important;
margin-right:0px !important; margin-right:0px !important;
} */
.huge.download-button i {
display:none !important; // otherwise spans 2 lines
} }
.play-button { .play-button {
@ -45,36 +51,18 @@
Blockly Blockly
*******************************/ *******************************/
.blocklyTreeRow { div.blocklyTreeRow {
border-radius:5px; border-radius:8px;
}
/* Specifying top and bottom rounded toolbox borders. */
.blocklyTreeRow.blocklyTreeRowTop {
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.blocklyTreeRow.blocklyTreeRowBottom {
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
.blocklyTreeRow:hover {
background: @invertedBackground !important;
} }
/* This removes any padding at the top of the toolbox */ /* This removes any padding at the top of the toolbox */
.blocklyTreeRoot { div.blocklyTreeRoot {
padding: 0px !important; padding: 0px !important;
} }
/* Blockly Text */ /* Blockly Text */
.blocklyTreeLabel { div.blocklyTreeLabel {
font-family: @pageFont !important; font-family: @pageFont !important;
}
.blocklyTreeLabel {
font-size:1rem !important; font-size:1rem !important;
} }
@ -83,21 +71,9 @@
} }
.blocklyToolboxDiv { .blocklyToolboxDiv {
/*left:30px !important;*/
padding:7px; padding:7px;
} }
/* Blockly Toolbox Buttons */
#blocklyToolboxButtons .blocklyAddPackageButton {
background-color: rgba(0, 0, 0, 0.3);
color: white;
}
#blocklyToolboxButtons .blocklyUndoButton {
background-color: rgba(0, 0, 0, 0.3);
color: white;
}
.organization { .organization {
top: 1.6em; top: 1.6em;
} }
@ -107,48 +83,18 @@
.blocklyTreeLabel { .blocklyTreeLabel {
font-size: 0.5rem !important; font-size: 0.5rem !important;
} }
.organization {
top: auto;
}
} }
/* Tablet */ /* Tablet */
@media only screen and (min-width: @tabletBreakpoint) and (max-width: @largestTabletScreen) { @media only screen and (min-width: @tabletBreakpoint) and (max-width: @largestTabletScreen) {
.organization {
top: auto;
}
/* Blockly Toolbox buttons */
#blocklyToolboxButtons {
margin-right: 0.5rem;
margin-left: 0.5rem;
}
} }
/* Small Monitor */ /* Small Monitor */
@media only screen and (min-width: @computerBreakpoint) and (max-width: @largestSmallMonitor) { @media only screen and (min-width: @computerBreakpoint) and (max-width: @largestSmallMonitor) {
.organization {
top: auto;
}
.blocklyTreeRow {
width: 230px;
}
/* Blockly Toolbox buttons */
#blocklyToolboxButtons {
margin-right: 1rem;
margin-left: 1rem;
}
} }
/* Large Monitor */ /* Large Monitor */
@media only screen and (min-width: @largeMonitorBreakpoint) { @media only screen and (min-width: @largeMonitorBreakpoint) {
.blocklyTreeRow {
width: 230px;
}
/* Blockly Toolbox buttons */
#blocklyToolboxButtons {
margin-right: 2rem;
margin-left: 2rem;
}
} }
/******************************* /*******************************

View File

@ -32,7 +32,7 @@
@input : 'pxt'; @input : 'pxt';
@label : 'pxt'; @label : 'pxt';
@list : 'pxt'; @list : 'pxt';
@loader : 'pulsar'; @loader : 'pxt';
@rail : 'pxt'; @rail : 'pxt';
@reveal : 'pxt'; @reveal : 'pxt';
@segment : 'pxt'; @segment : 'pxt';

View File

@ -7,4 +7,3 @@ export KS_FORCE_CLOUD=yes
(cd libs/lang-test0; node ../../node_modules/pxt-core/built/pxt.js test) (cd libs/lang-test0; node ../../node_modules/pxt-core/built/pxt.js test)
(cd libs/lang-test1; node ../../node_modules/pxt-core/built/pxt.js test) (cd libs/lang-test1; node ../../node_modules/pxt-core/built/pxt.js test)
node node_modules/pxt-core/built/pxt.js testdir tests node node_modules/pxt-core/built/pxt.js testdir tests
(cd libs/hello; node ../../node_modules/pxt-core/built/pxt.js testconv https://az851932.vo.msecnd.net/files/td-converter-tests-v1.json)

View File

@ -1,5 +1,5 @@
{ {
"name": "pxt.microbit.org", "name": "mini.pxt.io",
"icons": [ "icons": [
{ {
"src": "./static/icons/android-chrome-36x36.png", "src": "./static/icons/android-chrome-36x36.png",