Compare commits

...

34 Commits

Author SHA1 Message Date
8c15af11db 0.5.29 2016-10-20 20:16:52 -07:00
35e414764f missing tools 2016-10-20 20:14:25 -07:00
333659c320 0.5.28 2016-10-20 20:12:03 -07:00
8c161583eb Bump pxt-core to 0.4.71 2016-10-20 20:12:02 -07:00
b20e185bf2 parameterize download button color 2016-10-20 19:36:00 -07:00
299b595581 added custom theme style 2016-10-20 19:29:10 -07:00
65433216e6 adding semantic ui files 2016-10-20 16:40:39 -07:00
9ea2081e89 0.5.27 2016-10-20 11:48:48 -07:00
808e5fa17b Bump pxt-core to 0.4.68 2016-10-20 11:48:46 -07:00
20d967a230 removing .ico file 2016-10-20 11:30:04 -07:00
c1e5419e45 updated icons 2016-10-20 11:26:44 -07:00
27f5411404 0.5.26 2016-10-20 08:29:16 -07:00
f53eab0539 Bump pxt-core to 0.4.67 2016-10-20 08:29:11 -07:00
445fe12629 0.5.25 2016-10-19 19:11:13 +02:00
ddd6e90c6d Merge remote-tracking branch 'origin/master' 2016-10-19 19:08:52 +02:00
fd14ba6ff1 fix touch pins, add test for buttons and pins, update dependency 2016-10-19 19:08:41 +02:00
28a8f21d40 merging ble changes 2016-10-18 21:55:02 -07:00
0f7323f2da 0.4.55 2016-10-18 21:52:38 -07:00
23d30484d4 updated docs page 2016-10-18 21:52:10 -07:00
6ad59e04a6 fixed uart issues 2016-10-18 21:47:54 -07:00
ae5d5c74a7 better support for BLE UART and alignment with serial blocks. (#276)
* aligning uart apis with serial

* reorganizing serial/bluetooth blocks

* Autoupdate configuration for UART. (#279)

* Autoupdate configuration for UART.

* removing serial autoupdates.
2016-10-18 21:36:42 -07:00
3f626105cd 0.5.24 2016-10-18 21:07:02 -07:00
d9ff9c4800 Bump pxt-core to 0.4.65 2016-10-18 21:07:00 -07:00
75baca4a97 0.4.54 2016-10-18 21:03:36 -07:00
58ae4945cb Bump pxt-core to 0.4.65 2016-10-18 21:03:34 -07:00
fba37d96b2 updated localization help 2016-10-18 13:19:46 -07:00
5eb8704382 0.4.53 2016-10-18 13:18:20 -07:00
81b66664ef Bump pxt-core to 0.4.63 2016-10-18 13:18:19 -07:00
135aaf4855 0.4.52 2016-10-18 09:08:25 -07:00
1fbf257619 0.4.51 2016-10-17 21:12:33 -07:00
932c01f394 Bump pxt-core to 0.4.62 2016-10-17 21:12:30 -07:00
c3b2b99d7c 0.4.50 2016-10-17 16:45:20 -07:00
ec910cb10f Bump pxt-core to 0.4.60 2016-10-17 16:45:17 -07:00
a19d1c848b renaming board name 2016-10-17 16:18:04 -07:00
163 changed files with 883 additions and 246 deletions

View File

@ -5,7 +5,8 @@
### Things to do
* **[Getting Started](/getting-started)**
* [Ten projects](/projects)
* [Projects](/projects)
* [Lessons](/lessons)
### Micro:bit reference
@ -16,16 +17,15 @@
* [Blocks language](/blocks)
* [JavaScript language](/javascript)
* [Streaming data](/streaming)
### More questions?
* [Frequently Asked Question](/faq)
* [Embedding project](/share)
* [Help Translate](/translate)
* [Release notes](/release-notes)
* [Embedding project](/share)
### Developers
* [Command Line Interface](/cli)
* Learn about [packages](/packages)
* [Release notes](/release-notes)

View File

@ -2,6 +2,14 @@
Support for additional Bluetooth services.
### ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the micro:bit has, it must first be [paired with the micro:bit](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the micro:bit and exchange data relating to many of the micro:bit's features.
### ~
```cards
bluetooth.startAccelerometerService();
bluetooth.startButtonService();
@ -9,20 +17,34 @@ bluetooth.startIOPinService();
bluetooth.startLEDService();
bluetooth.startMagnetometerService();
bluetooth.startTemperatureService();
bluetooth.uartRead("");
bluetooth.uartWrite("");
bluetooth.onBluetoothConnected(() => {
bluetooth.onBluetoothConnected(() => {});
bluetooth.onBluetoothDisconnected(() => {});
```
});
bluetooth.onBluetoothDisconnected(() => {
## UART
});
```cards
bluetooth.startUartService();
bluetooth.uartReadUntil("");
bluetooth.uartWriteString("");
bluetooth.uartWriteNumber(0);
bluetooth.uartWriteValue("", 0);
```
```package
microbit-bluetooth
```
### Advanced
For more advanced information on the micro:bit Bluetooth UART service including information on using a smartphone, see the [Lancaster University micro:bit runtime technical documentation](http://lancaster-university.github.io/microbit-docs/ble/uart-service/)
### See Also
[startAccelerometerService](/reference/bluetooth/start-accelerometer-service), [startButtonService](/reference/bluetooth/start-button-service), [startIOPinService](/reference/bluetooth/start-io-pin-service), [startLEDService](/reference/bluetooth/start-led-service), [startMagnetometerService](/reference/bluetooth/start-magnetometer-service), [startTemperatureService](/reference/bluetooth/start-temperature-service), [uartRead](/reference/bluetooth/uart-read), [uartWrite](/reference/bluetooth/uart-write), [onBluetoothConnected](/reference/bluetooth/on-bluetooth-connected), [onBluetoothDisconnected](/reference/bluetooth/on-bluetooth-disconnected)
[startAccelerometerService](/reference/bluetooth/start-accelerometer-service), [startButtonService](/reference/bluetooth/start-button-service), [startIOPinService](/reference/bluetooth/start-io-pin-service), [startLEDService](/reference/bluetooth/start-led-service), [startMagnetometerService](/reference/bluetooth/start-magnetometer-service), [startTemperatureService](/reference/bluetooth/start-temperature-service),
[startUartService](/reference/bluetooth/start-uart-service),
[uartReadUntil](/reference/bluetooth/uart-read-until),
[uartWriteString](/reference/bluetooth/uart-write-string),
[uartWriteNumber](/reference/bluetooth/uart-write-number),
[uartWriteValue](/reference/bluetooth/uart-write-value),
[onBluetoothConnected](/reference/bluetooth/on-bluetooth-connected), [onBluetoothDisconnected](/reference/bluetooth/on-bluetooth-disconnected)

View File

@ -12,7 +12,7 @@ The [Bluetooth UART service](start-uart-service.md) allows another device such a
With the Bluetooth UART service running, this block allows a micro:bit to read data which has been received from a Bluetooth connected device, terminating reading and returning the value obtained as soon as a specified delimiter character is encountered. This means that connected devices can send data to the micro:bit and indicate that the complete message has been sent by appending the message with the delimiter character.
```sig
bluetooth.uartRead("");
bluetooth.uartReadUntil("");
```
### Example: Starting the Bluetooth UART service and then reading data received from another device which is terminated by ":" character and then displaying it
@ -25,7 +25,7 @@ bluetooth.onBluetoothConnected(() => {
basic.showString("C");
connected = 1;
while (connected == 1) {
uartData = bluetooth.uartRead(":");
uartData = bluetooth.uartReadUntil(":");
basic.showString(uartData);
}
});

View File

@ -0,0 +1,28 @@
# UART Write Number
### ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the micro:bit has, it must first be [paired with the micro:bit](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the micro:bit and exchange data relating to many of the micro:bit's features.
### ~
The [Bluetooth UART service](/reference/bluetooth/start-uart-service.md) allows another device such as a smartphone to exchange any data it wants to with the micro:bit, in small chunks.
With the Bluetooth UART service running, this block allows a micro:bit to send data to a Bluetooth connected device.
```sig
bluetooth.uartWriteNumber(42);
```
### Advanced
For more advanced information on the micro:bit Bluetooth UART service including information on using a smartphone, see the [Lancaster University micro:bit runtime technical documentation](http://lancaster-university.github.io/microbit-docs/ble/uart-service/)
### See also
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
```package
microbit-bluetooth
```

View File

@ -1,4 +1,4 @@
# UART Write
# UART Write String
### ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
@ -7,12 +7,12 @@ For another device like a smartphone to use any of the Bluetooth "services" whic
### ~
The [Bluetooth UART service](start-uart-service.md) allows another device such as a smartphone to exchange any data it wants to with the micro:bit, in small chunks.
The [Bluetooth UART service](/reference/bluetooth/start-uart-service.md) allows another device such as a smartphone to exchange any data it wants to with the micro:bit, in small chunks.
With the Bluetooth UART service running, this block allows a micro:bit to send data to a Bluetooth connected device.
```sig
bluetooth.uartWrite("");
bluetooth.uartWriteString("");
```
### Example: Starting the Bluetooth UART service and then sending "HELLO" whenever button A is pressed and another device has connected over Bluetooth
@ -29,7 +29,7 @@ bluetooth.onBluetoothDisconnected(() => {
});
input.onButtonPressed(Button.A, () => {
if (connected == 1) {
bluetooth.uartWrite("HELLO");
bluetooth.uartWriteString("HELLO");
}
});
```

View File

@ -0,0 +1,28 @@
# UART Write Value
### ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the micro:bit has, it must first be [paired with the micro:bit](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the micro:bit and exchange data relating to many of the micro:bit's features.
### ~
The [Bluetooth UART service](/reference/bluetooth/start-uart-service.md) allows another device such as a smartphone to exchange any data it wants to with the micro:bit, in small chunks.
With the Bluetooth UART service running, this block allows a micro:bit to send data to a Bluetooth connected device.
```sig
bluetooth.uartWriteValue("x", 42);
```
### Advanced
For more advanced information on the micro:bit Bluetooth UART service including information on using a smartphone, see the [Lancaster University micro:bit runtime technical documentation](http://lancaster-university.github.io/microbit-docs/ble/uart-service/)
### See also
[About Bluetooth](/reference/bluetooth/about-bluetooth), [micro:bit Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [micro:bit Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
```package
microbit-bluetooth
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

1
docs/static/faviconData.json vendored Normal file

File diff suppressed because one or more lines are too long

56
docs/static/faviconDescription.json vendored Normal file
View File

@ -0,0 +1,56 @@
{
"masterPicture": "Logo_Calliope_Woman.svg",
"iconsPath": "/",
"design": {
"ios": {
"pictureAspect": "backgroundAndMargin",
"backgroundColor": "#ffffff",
"margin": "14%",
"assets": {
"ios6AndPriorIcons": true,
"ios7AndLaterIcons": true,
"precomposedIcons": true,
"declareOnlyDefaultIcon": true
}
},
"desktopBrowser": {},
"windows": {
"pictureAspect": "noChange",
"backgroundColor": "#da532c",
"onConflict": "override",
"assets": {
"windows80Ie10Tile": true,
"windows10Ie11EdgeTiles": {
"small": true,
"medium": true,
"big": true,
"rectangle": true
}
}
},
"androidChrome": {
"pictureAspect": "noChange",
"themeColor": "#ffffff",
"manifest": {
"name": "Calliope MINI",
"display": "standalone",
"orientation": "notSet",
"onConflict": "override",
"declared": true
},
"assets": {
"legacyIcon": true,
"lowResolutionIcons": true
}
},
"safariPinnedTab": {
"pictureAspect": "silhouette",
"themeColor": "#5bbad5"
}
},
"settings": {
"scalingAlgorithm": "Mitchell",
"errorOnImageTooSmall": false
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1011 B

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 352 B

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 B

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 565 B

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 724 B

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 757 B

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 752 B

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 917 B

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 958 B

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 429 B

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 480 B

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 543 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 557 B

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

12
docs/static/icons/browserconfig.xml vendored Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="/mstile-70x70.png"/>
<square150x150logo src="/mstile-150x150.png"/>
<square310x310logo src="/mstile-310x310.png"/>
<wide310x150logo src="/mstile-310x150.png"/>
<TileColor>#da532c</TileColor>
</tile>
</msapplication>
</browserconfig>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 382 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 724 B

52
docs/static/icons/manifest.json vendored Normal file
View File

@ -0,0 +1,52 @@
{
"name": "Calliope MINI",
"icons": [
{
"src": "\/android-chrome-36x36.png",
"sizes": "36x36",
"type": "image\/png"
},
{
"src": "\/android-chrome-48x48.png",
"sizes": "48x48",
"type": "image\/png"
},
{
"src": "\/android-chrome-72x72.png",
"sizes": "72x72",
"type": "image\/png"
},
{
"src": "\/android-chrome-96x96.png",
"sizes": "96x96",
"type": "image\/png"
},
{
"src": "\/android-chrome-144x144.png",
"sizes": "144x144",
"type": "image\/png"
},
{
"src": "\/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image\/png"
},
{
"src": "\/android-chrome-256x256.png",
"sizes": "256x256",
"type": "image\/png"
},
{
"src": "\/android-chrome-384x384.png",
"sizes": "384x384",
"type": "image\/png"
},
{
"src": "\/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image\/png"
}
],
"theme_color": "#ffffff",
"display": "standalone"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1011 B

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 918 B

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 971 B

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 682 B

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -2,58 +2,42 @@
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="319.000000pt" height="319.000000pt" viewBox="0 0 319.000000 319.000000"
width="704.000000pt" height="704.000000pt" viewBox="0 0 704.000000 704.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.11, written by Peter Selinger 2001-2013
</metadata>
<g transform="translate(0.000000,319.000000) scale(0.100000,-0.100000)"
<g transform="translate(0.000000,704.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M145 2888 c-49 -17 -92 -55 -114 -101 -21 -43 -21 -46 -21 -1110 l0
-1067 40 0 40 0 0 -135 c0 -78 4 -135 9 -135 6 0 11 90 13 218 3 207 4 218 26
249 28 40 98 68 147 59 46 -9 102 -59 112 -99 5 -18 7 -127 5 -244 l-3 -212
-107 -4 -107 -3 120 0 120 1 3 158 3 158 142 -3 142 -3 3 -157 c1 -87 7 -158
12 -158 5 0 10 100 12 227 3 254 8 274 78 320 60 41 143 20 187 -46 22 -33 23
-41 23 -267 0 -149 4 -234 10 -234 6 0 10 60 10 160 l0 160 190 0 190 0 0
-161 c0 -104 3 -158 10 -154 6 4 10 93 10 233 0 207 2 230 20 259 40 67 112
88 182 54 78 -38 83 -53 86 -319 2 -135 7 -232 13 -232 5 0 9 68 9 160 l0 160
185 0 185 0 0 -154 c0 -93 4 -157 10 -161 7 -4 10 66 10 202 0 114 5 225 10
245 34 121 169 154 249 63 l31 -36 0 -234 c0 -145 4 -236 10 -240 7 -4 10 50
10 154 l0 161 150 0 150 0 0 -160 c0 -100 4 -160 10 -160 6 0 10 83 10 228 0
263 4 280 81 320 51 27 104 24 151 -9 54 -39 58 -58 58 -294 0 -137 4 -215 10
-215 6 0 10 53 10 140 l0 140 45 0 44 0 4 -77 c1 -43 4 435 5 1062 1 1092 1
1142 -17 1180 -24 53 -55 83 -105 106 -39 18 -96 19 -1466 18 -967 0 -1435 -4
-1455 -11z m1203 -635 l3 -73 -41 0 -40 0 0 76 0 75 38 -3 37 -3 3 -72z m587
2 l0 -70 -37 -3 -38 -3 0 76 0 76 38 -3 37 -3 0 -70z m-880 -280 l0 -70 -40 0
-40 0 -3 49 c-2 27 -1 60 3 73 5 21 11 24 43 21 l37 -3 0 -70z m589 59 c9 -23
7 -107 -3 -122 -5 -8 -22 -12 -42 -10 l-34 3 -3 59 c-2 32 -1 65 2 72 8 20 72
18 80 -2z m584 -61 l3 -73 -41 0 -40 0 0 68 c0 38 3 72 7 76 4 4 21 6 38 4
l30 -3 3 -72z m-880 -5 l-3 -73 -35 0 -35 0 -3 73 -3 72 41 0 41 0 -3 -72z
m570 -5 l3 -73 -41 0 -40 0 0 68 c0 38 3 72 7 76 4 4 21 6 38 4 l30 -3 3 -72z
m-1388 -363 l0 -180 -185 0 -185 0 0 180 0 180 185 0 185 0 0 -180z m2500 0
l0 -180 -180 0 -180 0 0 180 0 180 180 0 180 0 0 -180z m-1982 161 c9 -5 12
-27 10 -72 l-3 -64 -40 0 -40 0 -3 58 c-2 35 2 64 9 73 13 15 47 18 67 5z
m307 -66 l0 -70 -37 -3 -38 -3 0 76 0 76 38 -3 37 -3 0 -70z m873 -2 l3 -73
-41 0 -40 0 0 68 c0 38 3 72 7 76 4 4 21 6 38 4 l30 -3 3 -72z m-590 -10 l3
-73 -41 0 -40 0 0 68 c0 38 3 72 7 76 4 4 21 6 38 4 l30 -3 3 -72z m280 68 c9
-5 12 -27 10 -72 l-3 -64 -40 0 -40 0 -3 64 c-3 67 4 81 43 81 11 0 26 -4 33
-9z m-568 -341 l0 -70 -40 0 -40 0 0 70 0 70 40 0 40 0 0 -70z m590 0 l0 -70
-40 0 -40 0 0 70 0 70 40 0 40 0 0 -70z m-292 -27 l3 -73 -41 0 -40 0 0 68 c0
38 3 72 7 76 4 4 21 6 38 4 l30 -3 3 -72z m-3 -253 l0 -65 -42 -3 -43 -3 0 71
0 71 43 -3 42 -3 0 -65z"/>
<path d="M294 1689 c-25 -13 -54 -60 -54 -89 0 -55 47 -100 105 -100 42 0 75
20 94 57 15 29 14 49 -4 88 -24 49 -88 69 -141 44z"/>
<path d="M2779 1671 c-23 -23 -29 -38 -29 -71 0 -91 106 -135 171 -71 64 65
20 171 -71 171 -33 0 -48 -6 -71 -29z"/>
<path d="M845 836 c-88 -40 -106 -150 -34 -210 24 -20 41 -26 81 -26 44 0 54
4 84 34 32 32 40 56 34 111 -7 70 -99 121 -165 91z"/>
<path d="M1543 836 c-89 -40 -97 -178 -13 -221 66 -34 141 -10 175 55 19 37
19 64 -1 105 -28 60 -101 87 -161 61z"/>
<path d="M2255 836 c-86 -38 -105 -146 -35 -208 24 -23 40 -28 79 -28 143 0
173 188 38 239 -36 14 -45 13 -82 -3z"/>
<path d="M192 820 c-118 -72 -38 -255 98 -225 45 10 90 67 90 116 0 105 -99
163 -188 109z"/>
<path d="M2875 831 c-90 -40 -97 -169 -12 -221 122 -75 250 92 149 193 -32 31
-98 45 -137 28z"/>
<path d="M3559 6976 c-2 -3 -27 -7 -54 -10 -28 -3 -61 -8 -75 -11 -14 -3 -38
-8 -55 -11 -30 -5 -104 -27 -160 -46 -76 -27 -305 -145 -325 -167 -3 -4 -32
-26 -65 -51 -58 -42 -183 -163 -235 -225 -61 -75 -190 -291 -205 -345 -1 -3
-7 -18 -13 -33 -16 -38 -42 -119 -47 -143 -2 -10 -4 -19 -5 -19 -2 0 -6 -17
-24 -110 -16 -87 -20 -240 -21 -969 l-1 -828 -46 -37 c-25 -20 -56 -43 -68
-51 -12 -8 -30 -22 -41 -30 -123 -96 -251 -190 -259 -190 -4 0 -10 -4 -12 -8
-1 -5 -102 -82 -223 -172 -121 -91 -224 -168 -230 -172 -5 -5 -53 -40 -105
-78 -52 -39 -105 -78 -116 -88 -12 -9 -32 -25 -45 -34 -13 -9 -49 -36 -80 -60
-31 -24 -155 -117 -275 -208 -121 -90 -237 -180 -258 -200 -62 -55 -158 -153
-188 -191 -50 -63 -93 -124 -107 -152 -8 -15 -18 -27 -23 -27 -5 0 -7 -4 -3
-9 3 -5 1 -12 -4 -15 -21 -13 -124 -256 -138 -326 -8 -40 -9 -44 -16 -65 -37
-115 -44 -485 -11 -598 3 -10 7 -30 9 -45 3 -15 11 -52 20 -82 9 -30 17 -62
19 -70 27 -111 162 -371 233 -450 13 -14 23 -28 23 -31 0 -3 10 -17 22 -31 13
-14 35 -38 49 -54 58 -66 179 -170 259 -223 92 -62 230 -135 230 -123 0 4 4 3
8 -3 8 -11 92 -44 131 -51 14 -3 29 -8 35 -12 6 -4 13 -7 16 -7 3 -1 30 -7 60
-13 93 -21 104 -23 145 -29 22 -4 1125 -8 2450 -10 1808 -3 2429 0 2485 8 82
13 193 46 267 81 88 40 214 129 271 191 77 83 77 82 151 197 9 14 28 52 43 85
37 87 41 99 39 109 -1 4 4 14 10 22 6 8 9 14 6 14 -3 0 -1 15 4 33 6 17 13 46
15 62 10 54 11 5669 2 5705 -5 19 -11 41 -13 48 -3 7 -4 13 -3 15 5 6 -64 95
-94 122 -73 64 -134 84 -258 82 -49 -1 -90 2 -90 7 0 5 -6 5 -12 0 -11 -8 -40
-9 -110 -3 -7 0 -65 0 -128 0 -63 0 -124 -1 -135 -1 -11 1 -46 0 -77 0 -31 0
-60 0 -65 1 -4 1 -12 1 -18 0 -5 -1 -89 -2 -185 -1 -252 1 -285 0 -380 -4 -85
-3 -164 -26 -186 -52 -6 -8 -16 -14 -21 -14 -13 0 -73 -69 -87 -100 -6 -14
-13 -27 -16 -30 -11 -10 -27 -76 -26 -108 1 -18 -1 -32 -4 -32 -8 0 -4 -166 4
-178 4 -7 4 -12 -1 -12 -9 0 -9 -103 1 -118 3 -6 3 -13 -1 -15 -5 -3 -7 -43
-5 -89 3 -104 3 -95 -1 -148 -2 -25 1 -53 5 -62 4 -9 4 -19 0 -22 -8 -5 -6
-79 3 -103 2 -7 1 -15 -4 -17 -4 -3 -13 25 -20 62 -46 252 -163 493 -336 691
-91 104 -289 270 -322 271 -7 0 -13 5 -13 10 0 6 -6 10 -14 10 -8 0 -21 6 -28
14 -21 20 -233 116 -273 122 -5 1 -35 9 -65 17 -51 15 -92 23 -165 34 -45 6
-321 14 -326 9z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -16,13 +16,9 @@ You will find two files in that project:
## Translating the blocks and reference documentation
The project below contains the resources from the blocks and functions using in the https://codethemicrobit.com.
You will find package files under ``/microbit`` , one for the block definition and one for the descriptions:
* [https://crowdin.com/project/pxt-microbit](https://crowdin.com/project/pxt-microbit)
You will find two files for each package available in the micro:bit, one for the block definition and one for the descriptions:
* ``microbit-strings.json``: contains the block definitions
* ``microbit-jsdoc-strings.json``: contains the descriptions
* ``core-strings.json``: contains the block definitions
* ``core-jsdoc-strings.json``: contains the descriptions
The block definition should be carefully translated using the [block definition syntax](https://www.pxt.io/defining-blocks).

View File

@ -4,22 +4,6 @@
using namespace pxt;
enum Delimiters {
//% block="new line"
NewLine = 1,
//% block=","
Comma = 2,
//% block="$"
Dollar = 3,
//% block=":"
Colon = 4,
//% block="."
Fullstop = 5,
//% block="#"
Hash = 6,
};
/**
* Support for additional Bluetooth services.
*/
@ -27,52 +11,13 @@ enum Delimiters {
namespace bluetooth {
MicroBitUARTService *uart = NULL;
/**
* Starts the Bluetooth IO pin service.
*/
//% help=bluetooth/start-io-pin-service
//% blockId=bluetooth_start_io_pin_service block="bluetooth io pin service" blockGap=8
//% parts="bluetooth"
void startIOPinService() {
new MicroBitIOPinService(*uBit.ble, uBit.io);
}
/**
* Starts the Bluetooth LED service
*/
//% help=bluetooth/start-led-service
//% blockId=bluetooth_start_led_service block="bluetooth led service" blockGap=8
//% parts="bluetooth"
void startLEDService() {
new MicroBitLEDService(*uBit.ble, uBit.display);
}
/**
* Starts the Bluetooth temperature service
*/
//% help=bluetooth/start-temperature-service
//% blockId=bluetooth_start_temperature_service block="bluetooth temperature service" blockGap=8
//% parts="bluetooth"
void startTemperatureService() {
new MicroBitTemperatureService(*uBit.ble, uBit.thermometer);
}
/**
* Starts the Bluetooth magnetometer service
*/
//% help=bluetooth/start-magnetometer-service
//% blockId=bluetooth_start_magnetometer_service block="bluetooth magnetometer service" blockGap=8
//% parts="bluetooth"
void startMagnetometerService() {
new MicroBitMagnetometerService(*uBit.ble, uBit.compass);
}
/**
* Starts the Bluetooth accelerometer service
*/
//% help=bluetooth/start-accelerometer-service
//% blockId=bluetooth_start_accelerometer_service block="bluetooth accelerometer service" blockGap=8
//% parts="bluetooth"
//% blockId=bluetooth_start_accelerometer_service block="bluetooth accelerometer service"
//% parts="bluetooth" weight=90 blockGap=8
void startAccelerometerService() {
new MicroBitAccelerometerService(*uBit.ble, uBit.accelerometer);
}
@ -82,17 +27,58 @@ namespace bluetooth {
*/
//% help=bluetooth/start-button-service
//% blockId=bluetooth_start_button_service block="bluetooth button service" blockGap=8
//% parts="bluetooth"
//% parts="bluetooth" weight=89
void startButtonService() {
new MicroBitButtonService(*uBit.ble);
}
/**
* Starts the Bluetooth IO pin service.
*/
//% help=bluetooth/start-io-pin-service
//% blockId=bluetooth_start_io_pin_service block="bluetooth io pin service" blockGap=8
//% parts="bluetooth" weight=88
void startIOPinService() {
new MicroBitIOPinService(*uBit.ble, uBit.io);
}
/**
* Starts the Bluetooth LED service
*/
//% help=bluetooth/start-led-service
//% blockId=bluetooth_start_led_service block="bluetooth led service" blockGap=8
//% parts="bluetooth" weight=87
void startLEDService() {
new MicroBitLEDService(*uBit.ble, uBit.display);
}
/**
* Starts the Bluetooth temperature service
*/
//% help=bluetooth/start-temperature-service
//% blockId=bluetooth_start_temperature_service block="bluetooth temperature service" blockGap=8
//% parts="bluetooth" weight=86
void startTemperatureService() {
new MicroBitTemperatureService(*uBit.ble, uBit.thermometer);
}
/**
* Starts the Bluetooth magnetometer service
*/
//% help=bluetooth/start-magnetometer-service
//% blockId=bluetooth_start_magnetometer_service block="bluetooth magnetometer service"
//% parts="bluetooth" weight=85
void startMagnetometerService() {
new MicroBitMagnetometerService(*uBit.ble, uBit.compass);
}
/**
* Starts the Bluetooth UART service
*/
//% help=bluetooth/start-uart-service
//% blockId=bluetooth_start_uart_service block="bluetooth uart service" blockGap=8
//% parts="bluetooth"
//% blockId=bluetooth_start_uart_service block="bluetooth uart service"
//% parts="bluetooth" advanced=true
void startUartService() {
if (uart) return;
// 61 octet buffer size is 3 x (MTU - 3) + 1
@ -102,13 +88,13 @@ namespace bluetooth {
}
//%
void uartWrite(StringData *data) {
void uartWriteString(StringData *data) {
startUartService();
uart->send(ManagedString(data));
}
//%
StringData* uartRead(StringData *del) {
StringData* uartReadUntil(StringData *del) {
startUartService();
return uart->readUntil(ManagedString(del)).leakData();
}
@ -134,6 +120,4 @@ namespace bluetooth {
void onBluetoothDisconnected(Action body) {
registerWithDal(MICROBIT_ID_BLE, MICROBIT_BLE_EVT_DISCONNECTED, body);
}
}

View File

@ -1,42 +1,48 @@
namespace bluetooth {
/**
* Returns the delimiter corresponding string
/**
* Support for additional Bluetooth services.
*/
//% blockId="bluetooth_uart_delimiter_conv" block="%del"
//% weight=1 parts="bluetooth"
export function delimiters(del: Delimiters): string {
// even though it might not look like, this is more
// (memory) efficient than the C++ implementation, because the
// strings are statically allocated and take no RAM
switch (del) {
case Delimiters.NewLine: return "\n"
case Delimiters.Comma: return ","
case Delimiters.Dollar: return "$"
case Delimiters.Colon: return ":"
case Delimiters.Fullstop: return "."
case Delimiters.Hash: return "#"
default: return "\n"
}
}
//% color=#0082FB weight=20
namespace bluetooth {
/**
* Writes to the Bluetooth UART service buffer. From there the data is transmitted over Bluetooth to a connected device.
*/
//% help=bluetooth/uart-write
//% blockId=bluetooth_uart_write block="bluetooth uart write %data" blockGap=8
//% parts="bluetooth" shim=bluetooth::uartWrite
export function uartWrite(data: string): void {
//% help=bluetooth/uart-write-string weight=80
//% blockId=bluetooth_uart_write block="bluetooth uart|write string %data" blockGap=8
//% parts="bluetooth" shim=bluetooth::uartWriteString advanced=true
export function uartWriteString(data: string): void {
// dummy implementation for simulator
console.log("UART Write: " + data)
}
/**
* Prints a numeric value to the serial
*/
//% help=bluetooth/uart-write-number weight=79
//% weight=89 blockGap=8 advanced=true
//% blockId=bluetooth_uart_writenumber block="bluetooth uart|write number %value"
export function uartWriteNumber(value: number): void {
uartWriteString(value.toString());
}
/**
* Writes a ``name: value`` pair line to the serial.
* @param name name of the value stream, eg: x
* @param value to write
*/
//% weight=88 weight=78
//% help=bluetooth/uart-write-value advanced=true
//% blockId=bluetooth_uart_writevalue block="bluetooth uart|write value %name|= %value"
export function uartWriteValue(name: string, value: number): void {
uartWriteString(name + ":" + value + "\r\n");
}
/**
* Reads from the Bluetooth UART service buffer, returning its contents when the specified delimiter character is encountered.
*/
//% help=bluetooth/uart-read
//% blockId=bluetooth_uart_read block="bluetooth uart read %del=bluetooth_uart_delimiter_conv" blockGap=8
//% parts="bluetooth" shim=bluetooth::uartRead
export function uartRead(del: string): string {
//% help=bluetooth/uart-read-until weight=75
//% blockId=bluetooth_uart_read block="bluetooth uart|read until %del=serial_delimiter_conv"
//% parts="bluetooth" shim=bluetooth::uartReadUntil advanced=true
export function uartReadUntil(del: string): string {
// dummy implementation for simulator
return "???"
}

View File

@ -1,20 +1,4 @@
// Auto-generated. Do not edit.
declare enum Delimiters {
//% block="new line"
NewLine = 1,
//% block=","
Comma = 2,
//% block="$"
Dollar = 3,
//% block=":"
Colon = 4,
//% block="."
Fullstop = 5,
//% block="#"
Hash = 6,
}
declare namespace bluetooth {
}

View File

@ -7,44 +7,12 @@
//% color=#0082FB weight=20
declare namespace bluetooth {
/**
* Starts the Bluetooth IO pin service.
*/
//% help=bluetooth/start-io-pin-service
//% blockId=bluetooth_start_io_pin_service block="bluetooth io pin service" blockGap=8
//% parts="bluetooth" shim=bluetooth::startIOPinService
function startIOPinService(): void;
/**
* Starts the Bluetooth LED service
*/
//% help=bluetooth/start-led-service
//% blockId=bluetooth_start_led_service block="bluetooth led service" blockGap=8
//% parts="bluetooth" shim=bluetooth::startLEDService
function startLEDService(): void;
/**
* Starts the Bluetooth temperature service
*/
//% help=bluetooth/start-temperature-service
//% blockId=bluetooth_start_temperature_service block="bluetooth temperature service" blockGap=8
//% parts="bluetooth" shim=bluetooth::startTemperatureService
function startTemperatureService(): void;
/**
* Starts the Bluetooth magnetometer service
*/
//% help=bluetooth/start-magnetometer-service
//% blockId=bluetooth_start_magnetometer_service block="bluetooth magnetometer service" blockGap=8
//% parts="bluetooth" shim=bluetooth::startMagnetometerService
function startMagnetometerService(): void;
/**
* Starts the Bluetooth accelerometer service
*/
//% help=bluetooth/start-accelerometer-service
//% blockId=bluetooth_start_accelerometer_service block="bluetooth accelerometer service" blockGap=8
//% parts="bluetooth" shim=bluetooth::startAccelerometerService
//% blockId=bluetooth_start_accelerometer_service block="bluetooth accelerometer service"
//% parts="bluetooth" weight=90 blockGap=8 shim=bluetooth::startAccelerometerService
function startAccelerometerService(): void;
/**
@ -52,15 +20,47 @@ declare namespace bluetooth {
*/
//% help=bluetooth/start-button-service
//% blockId=bluetooth_start_button_service block="bluetooth button service" blockGap=8
//% parts="bluetooth" shim=bluetooth::startButtonService
//% parts="bluetooth" weight=89 shim=bluetooth::startButtonService
function startButtonService(): void;
/**
* Starts the Bluetooth IO pin service.
*/
//% help=bluetooth/start-io-pin-service
//% blockId=bluetooth_start_io_pin_service block="bluetooth io pin service" blockGap=8
//% parts="bluetooth" weight=88 shim=bluetooth::startIOPinService
function startIOPinService(): void;
/**
* Starts the Bluetooth LED service
*/
//% help=bluetooth/start-led-service
//% blockId=bluetooth_start_led_service block="bluetooth led service" blockGap=8
//% parts="bluetooth" weight=87 shim=bluetooth::startLEDService
function startLEDService(): void;
/**
* Starts the Bluetooth temperature service
*/
//% help=bluetooth/start-temperature-service
//% blockId=bluetooth_start_temperature_service block="bluetooth temperature service" blockGap=8
//% parts="bluetooth" weight=86 shim=bluetooth::startTemperatureService
function startTemperatureService(): void;
/**
* Starts the Bluetooth magnetometer service
*/
//% help=bluetooth/start-magnetometer-service
//% blockId=bluetooth_start_magnetometer_service block="bluetooth magnetometer service"
//% parts="bluetooth" weight=85 shim=bluetooth::startMagnetometerService
function startMagnetometerService(): void;
/**
* Starts the Bluetooth UART service
*/
//% help=bluetooth/start-uart-service
//% blockId=bluetooth_start_uart_service block="bluetooth uart service" blockGap=8
//% parts="bluetooth" shim=bluetooth::startUartService
//% blockId=bluetooth_start_uart_service block="bluetooth uart service"
//% parts="bluetooth" advanced=true shim=bluetooth::startUartService
function startUartService(): void;
/**

View File

@ -1,4 +1,4 @@
basic.showString("RGB")
/*basic.showString("RGB")
basic.setLedColor(Colors.Blue)
basic.pause(500)
basic.setLedColor(Colors.Red)
@ -39,4 +39,16 @@ input.onGesture(Gesture.ThreeG, () => {
input.onGesture(Gesture.SixG, () => {
basic.showString("6")
})
*/
input.onPinPressed(TouchPin.P0, () => {
basic.showNumber(0)
})
input.onPinPressed(TouchPin.P1, () => {
basic.showNumber(1)
})
input.onPinPressed(TouchPin.P2, () => {
basic.showNumber(2)
})
input.onPinPressed(TouchPin.P3, () => {
basic.showNumber(3)
})

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

@ -145,13 +145,14 @@ declare const enum DAL {
MICROBIT_ID_RADIO_DATA_READY = 30,
MICROBIT_ID_MULTIBUTTON_ATTACH = 31,
MICROBIT_ID_SERIAL = 32,
CALLIOPE_ID_IO_P0 = 33,
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,
MICROBIT_ID_MESSAGE_BUS_LISTENER = 1021,
MICROBIT_ID_NOTIFY_ONE = 1022,
MICROBIT_ID_NOTIFY = 1023,

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

@ -37,6 +37,7 @@ declare namespace basic {
P0 = 7, // MICROBIT_ID_IO_P0
P1 = 8, // MICROBIT_ID_IO_P1
P2 = 9, // MICROBIT_ID_IO_P2
P3 = 33, // CALLIOPE_ID_IO_P3
}
@ -311,6 +312,22 @@ declare namespace motors {
//% block=9600
BaudRate9600 = 9600,
}
declare enum Delimiters {
//% block="new line"
NewLine = 1,
//% block=","
Comma = 2,
//% block="$"
Dollar = 3,
//% block=":"
Colon = 4,
//% block="."
Fullstop = 5,
//% block="#"
Hash = 6,
}
declare namespace serial {
}

View File

@ -29,6 +29,7 @@ enum class TouchPin {
P0 = MICROBIT_ID_IO_P0,
P1 = MICROBIT_ID_IO_P1,
P2 = MICROBIT_ID_IO_P2,
P3 = CALLIOPE_ID_IO_P3
};
enum class AcceleratorRange {

View File

@ -66,6 +66,14 @@ MicroBitPin *getPin(int id) {
//case MICROBIT_ID_IO_P16: return &uBit.io.P16;
case MICROBIT_ID_IO_P19: return &uBit.io.P19;
case MICROBIT_ID_IO_P20: return &uBit.io.P20;
case CALLIOPE_ID_IO_P3: return &uBit.io.CAL_P3;
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;
default: return NULL;
}
}

View File

@ -1,6 +1,6 @@
#include "ksbit.h"
enum class SerialPin {
enum SerialPin {
P0 = MICROBIT_ID_IO_P0,
P1 = MICROBIT_ID_IO_P1,
P2 = MICROBIT_ID_IO_P2,
@ -12,36 +12,52 @@ enum class SerialPin {
//P16 = MICROBIT_ID_IO_P16
};
enum class BaudRate {
enum BaudRate {
//% block=115200
BaudRate115200 = 115200,
//% block=9600
BaudRate9600 = 9600
};
enum Delimiters {
//% block="new line"
NewLine = 1,
//% block=","
Comma = 2,
//% block="$"
Dollar = 3,
//% block=":"
Colon = 4,
//% block="."
Fullstop = 5,
//% block="#"
Hash = 6,
};
//% weight=2 color=30
//% advanced=true
namespace serial {
// note that at least one // followed by % is needed per declaration!
/**
* Reads a line of text from the serial port.
* Reads a line of text from the serial port and returns the buffer when the delimiter is met.
* @param delimiter text delimiter that separates each text chunk
*/
//% help=serial/read-line
//% blockId=serial_read_line block="serial read line"
//% weight=20
StringData* readLine() {
return uBit.serial.readUntil(ManagedString("\n")).leakData();
//% help=serial/read-until
//% blockId=serial_read_until block="serial|read until %delimiter=serial_delimiter_conv"
//% weight=19
StringData* readUntil(StringData* delimiter) {
return uBit.serial.readUntil(ManagedString(delimiter)).leakData();
}
/**
* Sends a piece of text through Serial connection.
* Reads a line of text from the serial port.
*/
//% help=serial/write-string
//% weight=87
//% blockId=serial_writestring block="serial write string %text"
void writeString(StringData *text) {
uBit.serial.send(ManagedString(text));
//% help=serial/read-line
//% blockId=serial_read_line block="serial|read line"
//% weight=20 blockGap=8
StringData* readLine() {
return readUntil(ManagedString("\n").leakData());
}
/**
@ -49,12 +65,22 @@ namespace serial {
* @param delimiters the characters to match received characters against. eg:"\n"
*/
// help=serial/on-data-received
// weight=19
// weight=18
void onDataReceived(StringData* delimiters, Action body) {
uBit.serial.eventOn(ManagedString(delimiters));
registerWithDal(MICROBIT_ID_SERIAL, MICROBIT_SERIAL_EVT_DELIM_MATCH, body);
}
/**
* Sends a piece of text through Serial connection.
*/
//% help=serial/write-string
//% weight=87
//% blockId=serial_writestring block="serial|write string %text"
void writeString(StringData *text) {
uBit.serial.send(ManagedString(text));
}
/**
* Dynamically configuring the serial instance to use pins other than USBTX and USBRX.
* @param tx the new transmission pins
@ -63,7 +89,7 @@ namespace serial {
*/
//% weight=10
//% help=serial/redirect-to
//% blockId=serial_redirect block="serial redirect to|TX %tx|RX %rx|at baud rate %rate"
//% blockId=serial_redirect block="serial|redirect to|TX %tx|RX %rx|at baud rate %rate"
//% blockExternalInputs=1
void redirect(SerialPin tx, SerialPin rx, BaudRate rate) {
uBit.serial.redirect((PinName)tx, (PinName)rx);

View File

@ -46,4 +46,24 @@ namespace serial {
export function onLineReceived(body: Action): void {
// serial.onDataReceived("\n", body);
}
/**
* Returns the delimiter corresponding string
*/
//% blockId="serial_delimiter_conv" block="%del"
//% weight=1
export function delimiters(del: Delimiters): string {
// even though it might not look like, this is more
// (memory) efficient than the C++ implementation, because the
// strings are statically allocated and take no RAM
switch (del) {
case Delimiters.NewLine: return "\n"
case Delimiters.Comma: return ","
case Delimiters.Dollar: return "$"
case Delimiters.Colon: return ":"
case Delimiters.Fullstop: return "."
case Delimiters.Hash: return "#"
default: return "\n"
}
}
}

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

@ -671,12 +671,21 @@ declare namespace pins {
//% advanced=true
declare namespace serial {
/**
* Reads a line of text from the serial port and returns the buffer when the delimiter is met.
* @param delimiter text delimiter that separates each text chunk
*/
//% help=serial/read-until
//% blockId=serial_read_until block="serial|read until %delimiter=serial_delimiter_conv"
//% weight=19 shim=serial::readUntil
function readUntil(delimiter: string): string;
/**
* Reads a line of text from the serial port.
*/
//% help=serial/read-line
//% blockId=serial_read_line block="serial read line"
//% weight=20 shim=serial::readLine
//% blockId=serial_read_line block="serial|read line"
//% weight=20 blockGap=8 shim=serial::readLine
function readLine(): string;
/**
@ -684,7 +693,7 @@ declare namespace serial {
*/
//% help=serial/write-string
//% weight=87
//% blockId=serial_writestring block="serial write string %text" shim=serial::writeString
//% blockId=serial_writestring block="serial|write string %text" shim=serial::writeString
function writeString(text: string): void;
/**
@ -695,7 +704,7 @@ declare namespace serial {
*/
//% weight=10
//% help=serial/redirect-to
//% blockId=serial_redirect block="serial redirect to|TX %tx|RX %rx|at baud rate %rate"
//% blockId=serial_redirect block="serial|redirect to|TX %tx|RX %rx|at baud rate %rate"
//% blockExternalInputs=1 shim=serial::redirect
function redirect(tx: SerialPin, rx: SerialPin, rate: BaudRate): void;
}

View File

@ -1,6 +1,6 @@
{
"name": "pxt-calliope",
"version": "0.5.23",
"version": "0.5.29",
"description": "calliope target for PXT",
"keywords": [
"JavaScript",
@ -29,6 +29,8 @@
"typescript": "^1.8.7"
},
"dependencies": {
"pxt-core": "0.4.63"
"pxt-core": "0.4.71",
"less": "^2.6.0",
"semantic-ui-less": "^2.2.4"
}
}

View File

@ -80,6 +80,13 @@
"microbit-pins": "",
"microbit-serial": ""
}
},
{
"type": "api",
"map": {
"bluetooth\\.uartRead\\((.*?)\\)" : "bluetooth.uartReadUntil($1)",
"bluetooth\\.uartWrite\\((.*?)\\)" : "bluetooth.uartWriteUntil($1)"
}
}
]
},
@ -202,7 +209,7 @@
"yottaTarget": "bbc-microbit-classic-gcc",
"yottaCorePackage": "pxt-calliope-core",
"githubCorePackage": "microsoft/pxt-calliope-core",
"gittag": "v0.5.11",
"gittag": "v0.5.12",
"serviceId": "calliope"
},
"serial": {
@ -212,6 +219,7 @@
},
"appTheme": {
"accentColor": "#249899",
"downloadClass": "orange",
"invertedMenu": true,
"defaultLocale": "de",
"logoUrl": "https://calliope.cc/about",

View File

@ -168,7 +168,7 @@ namespace pxsim.bluetooth {
export function uartWrite(s : string): void {
// TODO
}
export function uartRead(): string {
export function uartReadUntil(del: string): string {
// TODO
return ""
}

View File

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

View File

@ -0,0 +1,3 @@
/*******************************
Site Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
Site Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
Site Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
User Variable Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
Site Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
User Variable Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
Site Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
User Variable Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
Site Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
User Variable Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
Site Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
User Variable Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
Site Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
User Variable Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
Site Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
User Variable Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
Site Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
User Variable Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
Site Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*-------------------
Flag Variables
--------------------*/

View File

@ -0,0 +1,3 @@
/*******************************
Site Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
User Variable Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
Site Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
User Variable Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
Site Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
User Variable Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
Site Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
User Variable Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
Site Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
User Variable Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
User Variable Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
User Variable Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
Site Overrides
*******************************/

View File

@ -0,0 +1,3 @@
/*******************************
User Variable Overrides
*******************************/

Some files were not shown because too many files have changed in this diff Show More