Compare commits
13 Commits
v2.1.30
...
githubacti
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e41d90a66e | ||
|
|
df1dc64b72 | ||
|
|
6774193c54 | ||
|
|
cdecc711d4 | ||
|
|
37a531880b | ||
|
|
f60daf0e68 | ||
|
|
224a028a61 | ||
|
|
f6388ae7ab | ||
|
|
08ce23df9f | ||
|
|
c306db5478 | ||
|
|
a8d2466da6 | ||
|
|
7bc2352d38 | ||
|
|
c92bd90bd0 |
35
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
Add screenshots to help explain your problem. You can copy paste the screenshot in the github report. The .gif screen recording is very useful as well.
|
||||||
|
|
||||||
|
**Desktop (please complete the following information):**
|
||||||
|
- OS: [e.g. iOS]
|
||||||
|
- Browser [e.g. chrome, safari]
|
||||||
|
- Version [e.g. 22]
|
||||||
|
|
||||||
|
**Smartphone (please complete the following information):**
|
||||||
|
- Device: [e.g. iPhone6]
|
||||||
|
- OS: [e.g. iOS8.1]
|
||||||
|
- Browser [e.g. stock browser, safari]
|
||||||
|
- Version [e.g. 22]
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
||||||
17
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
75
.github/lock.yml
vendored
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
# Configuration for Lock Threads - https://github.com/dessant/lock-threads
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Number of days of inactivity before a closed issue or pull request is locked
|
||||||
|
|
||||||
|
daysUntilLock: 365
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Skip issues and pull requests created before a given timestamp. Timestamp must
|
||||||
|
|
||||||
|
# follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable
|
||||||
|
|
||||||
|
skipCreatedBefore: false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Issues and pull requests with these labels will be ignored. Set to `[]` to disable
|
||||||
|
|
||||||
|
exemptLabels: []
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Label to add before locking, such as `outdated`. Set to `false` to disable
|
||||||
|
|
||||||
|
lockLabel: false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Comment to post before locking. Set to `false` to disable
|
||||||
|
|
||||||
|
lockComment: >
|
||||||
|
|
||||||
|
This thread has been automatically locked since there has not been
|
||||||
|
|
||||||
|
any recent activity after it was closed. Please open a new issue for
|
||||||
|
|
||||||
|
related bugs.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Assign `resolved` as the reason for locking. Set to `false` to disable
|
||||||
|
|
||||||
|
setLockReason: true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Limit to only `issues` or `pulls`
|
||||||
|
|
||||||
|
# only: issues
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Optionally, specify configuration settings just for `issues` or `pulls`
|
||||||
|
|
||||||
|
# issues:
|
||||||
|
|
||||||
|
# exemptLabels:
|
||||||
|
|
||||||
|
# - help-wanted
|
||||||
|
|
||||||
|
# lockLabel: outdated
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# pulls:
|
||||||
|
|
||||||
|
# daysUntilLock: 30
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Repository to extend settings from
|
||||||
|
|
||||||
|
# _extends: repo
|
||||||
31
.github/workflows/pxt-buildpr.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
name: pxt-buildpr
|
||||||
|
|
||||||
|
on: [pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [8.x]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
- name: npm install
|
||||||
|
run: |
|
||||||
|
sudo apt-get install xvfb
|
||||||
|
sudo npm install -g pxt
|
||||||
|
npm install
|
||||||
|
- name: pxt ci
|
||||||
|
run: |
|
||||||
|
pxt ci
|
||||||
|
env:
|
||||||
|
CHROME_BIN: chromium-browser
|
||||||
|
DISPLAY: :99.0
|
||||||
|
CI: true
|
||||||
37
.github/workflows/pxt-buildtarget.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
name: pxt-buildtarget
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [8.x]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
- name: npm install
|
||||||
|
run: |
|
||||||
|
sudo apt-get install xvfb
|
||||||
|
sudo npm install -g pxt
|
||||||
|
npm install
|
||||||
|
- name: pxt ci
|
||||||
|
run: |
|
||||||
|
pxt ci
|
||||||
|
env:
|
||||||
|
CROWDIN_KEY: ${{ secrets.CROWDIN_KEY }}
|
||||||
|
PXT_ACCESS_TOKEN: ${{ secrets.PXT_ACCESS_TOKEN }}
|
||||||
|
PXT_RELEASE_REPO: ${{ secrets.PXT_RELEASE_REPO }}
|
||||||
|
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
|
||||||
|
CHROME_BIN: chromium-browser
|
||||||
|
DISPLAY: :99.0
|
||||||
|
CI: true
|
||||||
6
.gitignore
vendored
@@ -15,8 +15,10 @@ clients/win10/app/bld
|
|||||||
clients/win10/*.opendb
|
clients/win10/*.opendb
|
||||||
clients/**/bin/**
|
clients/**/bin/**
|
||||||
clients/**/obj/**
|
clients/**/obj/**
|
||||||
clients/electron/projects
|
electron-out
|
||||||
hexcache
|
hexcache
|
||||||
|
build
|
||||||
|
crowdinstats.csv
|
||||||
|
|
||||||
*.user
|
*.user
|
||||||
*.sw?
|
*.sw?
|
||||||
@@ -31,4 +33,4 @@ hexcache
|
|||||||
*.iml
|
*.iml
|
||||||
.vscode/.BROWSE.VC.DB-shm
|
.vscode/.BROWSE.VC.DB-shm
|
||||||
.vscode/.BROWSE.VC.DB-wal
|
.vscode/.BROWSE.VC.DB-wal
|
||||||
package-lock.json
|
package-lock.json
|
||||||
46
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Launch",
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceRoot}/../pxt/built/pxt.js",
|
||||||
|
"stopOnEntry": false,
|
||||||
|
"args": ["serve"],
|
||||||
|
"cwd": "${workspaceRoot}",
|
||||||
|
"preLaunchTask": null,
|
||||||
|
"runtimeExecutable": null,
|
||||||
|
"runtimeArgs": [
|
||||||
|
"--nolazy"
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"NODE_ENV": "development"
|
||||||
|
},
|
||||||
|
"console": "internalConsole",
|
||||||
|
"sourceMaps": false,
|
||||||
|
"outDir": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Attach",
|
||||||
|
"type": "node",
|
||||||
|
"request": "attach",
|
||||||
|
"port": 5858,
|
||||||
|
"address": "localhost",
|
||||||
|
"restart": false,
|
||||||
|
"sourceMaps": false,
|
||||||
|
"outDir": null,
|
||||||
|
"localRoot": "${workspaceRoot}",
|
||||||
|
"remoteRoot": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Attach to Process",
|
||||||
|
"type": "node",
|
||||||
|
"request": "attach",
|
||||||
|
"processId": "${command.PickProcess}",
|
||||||
|
"port": 5858,
|
||||||
|
"sourceMaps": false,
|
||||||
|
"outDir": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
2
.vscode/settings.json
vendored
@@ -1,6 +1,6 @@
|
|||||||
// Place your settings in this file to overwrite default and user settings.
|
// Place your settings in this file to overwrite default and user settings.
|
||||||
{
|
{
|
||||||
"file.autoSave": "afterDelay",
|
"files.autoSave": "afterDelay",
|
||||||
"files.watcherExclude": {
|
"files.watcherExclude": {
|
||||||
"**/.git/objects/**": true,
|
"**/.git/objects/**": true,
|
||||||
"**/built/**": true,
|
"**/built/**": true,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Calliope target for Microsoft MakeCode [](https://travis-ci.org/microsoft/pxt-calliope)
|
# Calliope target for Microsoft MakeCode
|
||||||
|
|
||||||
This editor is hosted at https://makecode.calliope.cc.
|
This editor is hosted at https://makecode.calliope.cc.
|
||||||
|
|
||||||
|
|||||||
4
docs/extensions.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# @extends
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
"largeImageUrl": "/docs/calliope/firststeps/firstSteps.jpg"
|
"largeImageUrl": "/docs/calliope/firststeps/firstSteps.jpg"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Turorials",
|
"name": "Tutorials",
|
||||||
"url": "/calliope/tutorials",
|
"url": "/calliope/tutorials",
|
||||||
"imageUrl": "/docs/calliope/tutorials/01_flashing_heart.gif"
|
"imageUrl": "/docs/calliope/tutorials/01_flashing_heart.gif"
|
||||||
},
|
},
|
||||||
@@ -24,6 +24,6 @@
|
|||||||
## See Also
|
## See Also
|
||||||
|
|
||||||
[First Steps](/calliope/firststeps),
|
[First Steps](/calliope/firststeps),
|
||||||
[Turorials](/calliope/tutorials),
|
[Tutorials](/calliope/tutorials),
|
||||||
[Calliope Links](/calliope/links)
|
[Calliope Links](/calliope/links)
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
* [Output](/calliope/firststeps/Output)
|
* [Output](/calliope/firststeps/Output)
|
||||||
* [Decisions](/calliope/firststeps/Decisions)
|
* [Decisions](/calliope/firststeps/Decisions)
|
||||||
* [Variables](/calliope/firststeps/Variables)
|
* [Variables](/calliope/firststeps/Variables)
|
||||||
* [Turorials](/calliope/tutorials)
|
* [Tutorials](/calliope/tutorials)
|
||||||
* [Flashing Heart](/projects/flashing-heart)
|
* [Flashing Heart](/projects/flashing-heart)
|
||||||
* [Name Tag](/projects/name-tag)
|
* [Name Tag](/projects/name-tag)
|
||||||
* [Smiley Buttons](/projects/smiley-buttons)
|
* [Smiley Buttons](/projects/smiley-buttons)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ basic.showIcon(IconNames.Heart)
|
|||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
* ``icon``, the identifier of the icon to display
|
* ``icon``, the identifier of the icon to display
|
||||||
* ``interval`` (optional), the time to display in milliseconds. default is 400.
|
* ``interval`` (optional), the time to display in milliseconds. default is 600.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
@@ -21,6 +21,38 @@ basic.pause(1000)
|
|||||||
basic.showIcon(IconNames.Sad)
|
basic.showIcon(IconNames.Sad)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Beating Heart
|
||||||
|
|
||||||
|
You can create a beating heart by using the forever block as follows:
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
basic.forever(function () {
|
||||||
|
basic.showIcon(IconNames.Heart)
|
||||||
|
basic.showIcon(IconNames.SmallHeart)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
## Fast Beating Heart
|
||||||
|
|
||||||
|
You could slow down the previous animation by inserting a pause block:
|
||||||
|
|
||||||
|
```block
|
||||||
|
basic.pause(1000)
|
||||||
|
```
|
||||||
|
|
||||||
|
...but how would you speed it up?
|
||||||
|
|
||||||
|
You can change the default pause value, which is set in the ``interval`` parameter, to be smaller than `600` by changing it in the JavaScript editor.
|
||||||
|
|
||||||
|
This JavaScript code creates a crazy fast heart beat! Did you know that a hamster's heart beats at a rate this fast?
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
basic.forever(function () {
|
||||||
|
basic.showIcon(IconNames.Heart, 60)
|
||||||
|
basic.showIcon(IconNames.SmallHeart, 60)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
## See also
|
## See also
|
||||||
|
|
||||||
[showLeds](/reference/basic/show-leds)
|
[showLeds](/reference/basic/show-leds)
|
||||||
|
|||||||
@@ -30,4 +30,4 @@ input.onButtonPressed(Button.AB, () => {
|
|||||||
|
|
||||||
## See also
|
## See also
|
||||||
|
|
||||||
[compassHeading](/reference/input/compass-heading)
|
[compass heading](/reference/input/compass-heading)
|
||||||
|
|||||||
@@ -56,10 +56,11 @@ basic.forever(() => {
|
|||||||
|
|
||||||
## Calibration
|
## Calibration
|
||||||
|
|
||||||
Every time you start to use the compass (for example, if you have just
|
Every time you start to use the compass (for example, if you have just turned the @boardname@ on),
|
||||||
turned the @boardname@ on), the @boardname@ will start to [calibrateCompass](/reference/input/calibrate-compass)
|
the @boardname@ will start a [calibrate compass](/reference/input/calibrate-compass)
|
||||||
(adjust itself). It will ask you to draw a circle by tilting the
|
(adjust itself).
|
||||||
@boardname@.
|
The [calibration step](https://support.microbit.org/support/solutions/articles/19000008874-calibrating-the-micro-bit-compass)
|
||||||
|
will ask you to draw a fill pattern on the screen by tilting the @boardname@.
|
||||||
|
|
||||||
If you are calibrating or using the compass near metal, it might
|
If you are calibrating or using the compass near metal, it might
|
||||||
confuse the @boardname@.
|
confuse the @boardname@.
|
||||||
@@ -78,4 +79,4 @@ input.onButtonPressed(Button.AB, () => {
|
|||||||
|
|
||||||
## See also
|
## See also
|
||||||
|
|
||||||
[acceleration](/reference/input/acceleration), [calibrateCompass](/reference/input/calibrate-compass)
|
[acceleration](/reference/input/acceleration), [calibrate compass](/reference/input/calibrate-compass)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Magnetic Force
|
# Magnetic Force
|
||||||
|
|
||||||
Find the amount of magnetic force (the strength of a magnet) in the direction you say.
|
Find the amount of magnetic force (the strength of a magnet) in one of the three directions.
|
||||||
|
|
||||||
```sig
|
```sig
|
||||||
input.magneticForce(Dimension.X);
|
input.magneticForce(Dimension.X);
|
||||||
@@ -10,12 +10,14 @@ input.magneticForce(Dimension.X);
|
|||||||
|
|
||||||
The @boardname@ measures magnetic force with **microteslas**.
|
The @boardname@ measures magnetic force with **microteslas**.
|
||||||
|
|
||||||
## ~
|
You are asked to [calibrate](https://support.microbit.org/support/solutions/articles/19000008874-calibrating-the-micro-bit-compass) the compass the first time run a program
|
||||||
|
that uses the compass.
|
||||||
|
|
||||||
|
## ~
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
* ``dimension`` means which direction the @boardname@ should measure
|
* **dimension**: this is the direction the @boardname@ should measure
|
||||||
magnetic force in: either `Dimension.X` (the left-right direction),
|
magnetic force in: either `Dimension.X` (the left-right direction),
|
||||||
`Dimension.Y` (the forward/backward direction), or `Dimension.Z`
|
`Dimension.Y` (the forward/backward direction), or `Dimension.Z`
|
||||||
(the up/down direction)
|
(the up/down direction)
|
||||||
@@ -24,16 +26,14 @@ The @boardname@ measures magnetic force with **microteslas**.
|
|||||||
|
|
||||||
* a [number](/types/number) of microteslas that means the strength of the magnet
|
* a [number](/types/number) of microteslas that means the strength of the magnet
|
||||||
|
|
||||||
## Example: metal detector
|
## Example
|
||||||
|
|
||||||
This program makes the center LED of the @boardname@ get brighter when
|
Create a metal detector my measuring the strength of magnetic force in the `X` direction.
|
||||||
the magnetic force is stronger, and dimmer when it is weaker.
|
Display a bar graph to show the current level of magnetic force measured by the magnetometer.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
led.plot(2, 2)
|
basic.forever(function() {
|
||||||
basic.forever(() => {
|
led.plotBarGraph(input.magneticForce(Dimension.X) / 2000, 0)
|
||||||
let f = input.magneticForce(Dimension.X)
|
|
||||||
led.setBrightness(f / 2000)
|
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
BIN
docs/static/hero.jpg
vendored
Normal file
|
After Width: | Height: | Size: 243 KiB |
2
docs/static/packages/packageicon.svg
vendored
@@ -17,7 +17,7 @@
|
|||||||
height="176"
|
height="176"
|
||||||
viewBox="0 0 286 176"
|
viewBox="0 0 286 176"
|
||||||
sodipodi:docname="packageicon.svg"
|
sodipodi:docname="packageicon.svg"
|
||||||
inkscape:export-filename="/Users/sammysam/Work/pxt-microbit/docs/static/hero.png"
|
inkscape:export-filename="/Users/sammysam/Work/pxt-microbit/docs/static/hero.jpg"
|
||||||
inkscape:export-xdpi="100.04"
|
inkscape:export-xdpi="100.04"
|
||||||
inkscape:export-ydpi="100.04">
|
inkscape:export-ydpi="100.04">
|
||||||
<metadata
|
<metadata
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 92 KiB |
6
docs/static/testfilelogo.svg
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" id="svg4487" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.4" clip-rule="evenodd" version="1.1" width="32" height="32" viewBox="0 0 32 32">
|
||||||
|
<path id="path4485" fill="#696969" d="M16.1 2.7a13.8 13.8 0 00-4.4 27c.7 0 1-.4 1-.7v-2.4c-3.9.9-4.7-1.8-4.7-1.8-.6-1.6-1.5-2-1.5-2-1.3-1 0-.9 0-.9 1.4.1 2.2 1.4 2.2 1.4 1.2 2.1 3.2 1.5 4 1.2a3 3 0 01.9-1.9c-3.1-.3-6.3-1.5-6.3-6.8 0-1.5.5-2.7 1.4-3.7a5 5 0 01.1-3.7s1.2-.3 3.8 1.4a13.2 13.2 0 013.5-.4c1.2 0 2.4.1 3.5.4 2.6-1.7 3.8-1.4 3.8-1.4a5 5 0 01.1 3.7c.9 1 1.4 2.2 1.4 3.7 0 5.3-3.2 6.5-6.3 6.8.5.5 1 1.3 1 2.6V29c0 .4.2.8.9.6a13.8 13.8 0 00-4.4-27"/>
|
||||||
|
<g id="text4497" fill="#000" fill-opacity="1" stroke="none" stroke-width=".7" aria-label="v" font-family="consolas" font-size="26.6" font-stretch="normal" font-style="normal" font-variant="normal" font-weight="400" letter-spacing="0" style="line-height:1.25;-inkscape-font-specification:consolas" transform="rotate(14.1)" word-spacing="0">
|
||||||
|
<path id="path4499" stroke-width=".7" d="M21.4-1.7l2.9 8 3-8.3.8-1.5q.4-.4 1-.4.8 0 1.2.5.5.4.5 1v.6l-.3.5-.2.7-3.4 8.4-.4 1-.5 1-.7.5q-.4.2-1 .2-.8 0-1.2-.3-.5-.3-.7-.8l-.7-1.6-3.4-8.3q0-.4-.2-.7l-.2-.6-.1-.6.2-.7.6-.6q.4-.2.9-.2.9 0 1.2.5l.7 1.7z" font-family="Arial Rounded MT Bold" font-stretch="normal" font-style="normal" font-variant="normal" font-weight="400" style="-inkscape-font-specification:'Arial Rounded MT Bold, '"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.4 KiB |
0
external/sha/buildflash.sh
vendored
Normal file → Executable file
@@ -55,6 +55,7 @@
|
|||||||
"Buffer.getNumber": "Read a number in specified format from the buffer.",
|
"Buffer.getNumber": "Read a number in specified format from the buffer.",
|
||||||
"Buffer.getUint8": "Reads an unsigned byte at a particular location",
|
"Buffer.getUint8": "Reads an unsigned byte at a particular location",
|
||||||
"Buffer.indexOf": "Return position of other buffer in current buffer",
|
"Buffer.indexOf": "Return position of other buffer in current buffer",
|
||||||
|
"Buffer.isReadOnly": "Returns false when the buffer can be written to.",
|
||||||
"Buffer.length": "Returns the length of a Buffer object.",
|
"Buffer.length": "Returns the length of a Buffer object.",
|
||||||
"Buffer.rotate": "Rotate buffer left in place.\n\n\n\nstart. eg: -1",
|
"Buffer.rotate": "Rotate buffer left in place.\n\n\n\nstart. eg: -1",
|
||||||
"Buffer.rotate|param|length": "number of elements in buffer. If negative, length is set as the buffer length minus",
|
"Buffer.rotate|param|length": "number of elements in buffer. If negative, length is set as the buffer length minus",
|
||||||
@@ -472,18 +473,35 @@
|
|||||||
"parseFloat": "Convert a string to a number.",
|
"parseFloat": "Convert a string to a number.",
|
||||||
"parseInt": "Convert a string to an integer.",
|
"parseInt": "Convert a string to an integer.",
|
||||||
"pins": "Control currents in Pins for analog/digital signals, servos, i2c, ...",
|
"pins": "Control currents in Pins for analog/digital signals, servos, i2c, ...",
|
||||||
|
"pins.C10": "Pin C10",
|
||||||
|
"pins.C11": "Pin C11",
|
||||||
|
"pins.C12": "Pin C12",
|
||||||
|
"pins.C16": "Pin C16",
|
||||||
|
"pins.C17": "Pin C17",
|
||||||
|
"pins.C18": "Pin C18",
|
||||||
|
"pins.C19": "Pin C19",
|
||||||
|
"pins.C4": "Pin C4",
|
||||||
|
"pins.C5": "Pin C5",
|
||||||
|
"pins.C6": "Pin C6",
|
||||||
|
"pins.C7": "Pin C7",
|
||||||
|
"pins.C8": "Pin C8",
|
||||||
|
"pins.C9": "Pin C9",
|
||||||
|
"pins.P0": "Pin P0",
|
||||||
|
"pins.P1": "Pin P1",
|
||||||
|
"pins.P2": "Pin P2",
|
||||||
|
"pins.P3": "Pin P3",
|
||||||
"pins.analogPitch": "Emit a plse-width modulation (PWM) signal to the current pitch pin. Use `analog set pitch pin` to define the pitch pin.",
|
"pins.analogPitch": "Emit a plse-width modulation (PWM) signal to the current pitch pin. Use `analog set pitch pin` to define the pitch pin.",
|
||||||
"pins.analogPitch|param|frequency": "frequency to modulate in Hz.",
|
"pins.analogPitch|param|frequency": "frequency to modulate in Hz.",
|
||||||
"pins.analogPitch|param|ms": "duration of the pitch in milli seconds.",
|
"pins.analogPitch|param|ms": "duration of the pitch in milli seconds.",
|
||||||
"pins.analogReadPin": "Read the connector value as analog, that is, as a value comprised between 0 and 1023.",
|
"pins.analogReadPin": "Read the connector value as analog, that is, as a value comprised between 0 and 1023.",
|
||||||
"pins.analogReadPin|param|name": "pin to write to, eg: AnalogPin.P0",
|
"pins.analogReadPin|param|name": "pin to write to, eg: AnalogPin.P1",
|
||||||
"pins.analogSetPeriod": "Configure the pulse-width modulation (PWM) period of the analog output in microseconds.\nIf this pin is not configured as an analog output (using `analog write pin`), the operation has no effect.",
|
"pins.analogSetPeriod": "Configure the pulse-width modulation (PWM) period of the analog output in microseconds.\nIf this pin is not configured as an analog output (using `analog write pin`), the operation has no effect.",
|
||||||
"pins.analogSetPeriod|param|micros": "period in micro seconds. eg:20000",
|
"pins.analogSetPeriod|param|micros": "period in micro seconds. eg:20000",
|
||||||
"pins.analogSetPeriod|param|name": "analog pin to set period to, eg: AnalogPin.P0",
|
"pins.analogSetPeriod|param|name": "analog pin to set period to, eg: AnalogPin.P1",
|
||||||
"pins.analogSetPitchPin": "Set the pin used when using analog pitch or music.",
|
"pins.analogSetPitchPin": "Set the pin used when using analog pitch or music.",
|
||||||
"pins.analogSetPitchPin|param|name": "pin to modulate pitch from",
|
"pins.analogSetPitchPin|param|name": "pin to modulate pitch from",
|
||||||
"pins.analogWritePin": "Set the connector value as analog. Value must be comprised between 0 and 1023.",
|
"pins.analogWritePin": "Set the connector value as analog. Value must be comprised between 0 and 1023.",
|
||||||
"pins.analogWritePin|param|name": "pin name to write to, eg: AnalogPin.P0",
|
"pins.analogWritePin|param|name": "pin name to write to, eg: AnalogPin.P1",
|
||||||
"pins.analogWritePin|param|value": "value to write to the pin between ``0`` and ``1023``. eg:1023,0",
|
"pins.analogWritePin|param|value": "value to write to the pin between ``0`` and ``1023``. eg:1023,0",
|
||||||
"pins.createBuffer": "Create a new zero-initialized buffer.",
|
"pins.createBuffer": "Create a new zero-initialized buffer.",
|
||||||
"pins.createBufferFromArray": "Create a new buffer initalized to bytes from given array.",
|
"pins.createBufferFromArray": "Create a new buffer initalized to bytes from given array.",
|
||||||
@@ -515,7 +533,7 @@
|
|||||||
"pins.servoSetPulse|param|micros": "pulse duration in micro seconds, eg:1500",
|
"pins.servoSetPulse|param|micros": "pulse duration in micro seconds, eg:1500",
|
||||||
"pins.servoSetPulse|param|name": "pin name",
|
"pins.servoSetPulse|param|name": "pin name",
|
||||||
"pins.servoWritePin": "Write a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).",
|
"pins.servoWritePin": "Write a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).",
|
||||||
"pins.servoWritePin|param|name": "pin to write to, eg: AnalogPin.P0",
|
"pins.servoWritePin|param|name": "pin to write to, eg: AnalogPin.P1",
|
||||||
"pins.servoWritePin|param|value": "angle or rotation speed, eg:180,90,0",
|
"pins.servoWritePin|param|value": "angle or rotation speed, eg:180,90,0",
|
||||||
"pins.setEvents": "Configure the events emitted by this pin. Events can be subscribed to\nusing ``control.onEvent()``.",
|
"pins.setEvents": "Configure the events emitted by this pin. Events can be subscribed to\nusing ``control.onEvent()``.",
|
||||||
"pins.setEvents|param|name": "pin to set the event mode on, eg: DigitalPin.P0",
|
"pins.setEvents|param|name": "pin to set the event mode on, eg: DigitalPin.P0",
|
||||||
|
|||||||
@@ -215,6 +215,10 @@
|
|||||||
"Note.GSharp|block": "G#",
|
"Note.GSharp|block": "G#",
|
||||||
"Number|block": "Number",
|
"Number|block": "Number",
|
||||||
"Object|block": "Object",
|
"Object|block": "Object",
|
||||||
|
"PinEvent.Fall|block": "fall",
|
||||||
|
"PinEvent.PulseHigh|block": "pulse high",
|
||||||
|
"PinEvent.PulseLow|block": "pulse low",
|
||||||
|
"PinEvent.Rise|block": "rise",
|
||||||
"PinEventType.Edge|block": "edge",
|
"PinEventType.Edge|block": "edge",
|
||||||
"PinEventType.None|block": "none",
|
"PinEventType.None|block": "none",
|
||||||
"PinEventType.Pulse|block": "pulse",
|
"PinEventType.Pulse|block": "pulse",
|
||||||
@@ -384,6 +388,8 @@
|
|||||||
"serial.writeString|block": "serial|write string %text",
|
"serial.writeString|block": "serial|write string %text",
|
||||||
"serial.writeValue|block": "serial|write value %name|= %value",
|
"serial.writeValue|block": "serial|write value %name|= %value",
|
||||||
"serial|block": "serial",
|
"serial|block": "serial",
|
||||||
|
"{id:category}AnalogInPin": "AnalogInPin",
|
||||||
|
"{id:category}AnalogOutPin": "AnalogOutPin",
|
||||||
"{id:category}Array": "Array",
|
"{id:category}Array": "Array",
|
||||||
"{id:category}Arrays": "Arrays",
|
"{id:category}Arrays": "Arrays",
|
||||||
"{id:category}Basic": "Basic",
|
"{id:category}Basic": "Basic",
|
||||||
@@ -391,6 +397,7 @@
|
|||||||
"{id:category}Buffer": "Buffer",
|
"{id:category}Buffer": "Buffer",
|
||||||
"{id:category}Console": "Console",
|
"{id:category}Console": "Console",
|
||||||
"{id:category}Control": "Control",
|
"{id:category}Control": "Control",
|
||||||
|
"{id:category}DigitalInOutPin": "DigitalInOutPin",
|
||||||
"{id:category}Fx": "Fx",
|
"{id:category}Fx": "Fx",
|
||||||
"{id:category}Fx8": "Fx8",
|
"{id:category}Fx8": "Fx8",
|
||||||
"{id:category}Game": "Game",
|
"{id:category}Game": "Game",
|
||||||
@@ -400,12 +407,14 @@
|
|||||||
"{id:category}Input": "Input",
|
"{id:category}Input": "Input",
|
||||||
"{id:category}Led": "Led",
|
"{id:category}Led": "Led",
|
||||||
"{id:category}Math": "Math",
|
"{id:category}Math": "Math",
|
||||||
|
"{id:category}MicrobitPin": "MicrobitPin",
|
||||||
"{id:category}Motors": "Motors",
|
"{id:category}Motors": "Motors",
|
||||||
"{id:category}Msgpack": "Msgpack",
|
"{id:category}Msgpack": "Msgpack",
|
||||||
"{id:category}Music": "Music",
|
"{id:category}Music": "Music",
|
||||||
"{id:category}Number": "Number",
|
"{id:category}Number": "Number",
|
||||||
"{id:category}Object": "Object",
|
"{id:category}Object": "Object",
|
||||||
"{id:category}Pins": "Pins",
|
"{id:category}Pins": "Pins",
|
||||||
|
"{id:category}PwmOnlyPin": "PwmOnlyPin",
|
||||||
"{id:category}Serial": "Serial",
|
"{id:category}Serial": "Serial",
|
||||||
"{id:category}String": "String",
|
"{id:category}String": "String",
|
||||||
"{id:category}Text": "Text"
|
"{id:category}Text": "Text"
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ void platform_init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initMicrobitGC() {
|
void initMicrobitGC() {
|
||||||
|
uBit.init();
|
||||||
if (device_heap_size(1) > NON_GC_HEAP_RESERVATION + 4)
|
if (device_heap_size(1) > NON_GC_HEAP_RESERVATION + 4)
|
||||||
gcPreAllocateBlock(device_heap_size(1) - NON_GC_HEAP_RESERVATION);
|
gcPreAllocateBlock(device_heap_size(1) - NON_GC_HEAP_RESERVATION);
|
||||||
}
|
}
|
||||||
@@ -43,9 +44,6 @@ struct FreeList {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void initCodal() {
|
static void initCodal() {
|
||||||
|
|
||||||
uBit.init();
|
|
||||||
|
|
||||||
// repeat error 4 times and restart as needed
|
// repeat error 4 times and restart as needed
|
||||||
microbit_panic_timeout(4);
|
microbit_panic_timeout(4);
|
||||||
}
|
}
|
||||||
@@ -224,7 +222,6 @@ void sendSerial(const char *data, int len) {
|
|||||||
logwriten(data, len);
|
logwriten(data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PXT_GC
|
|
||||||
ThreadContext *getThreadContext() {
|
ThreadContext *getThreadContext() {
|
||||||
if (!currentFiber)
|
if (!currentFiber)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -275,6 +272,5 @@ void gcProcessStacks(int flags) {
|
|||||||
}
|
}
|
||||||
xfree(fibers);
|
xfree(fibers);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace pxt
|
} // namespace pxt
|
||||||
|
|||||||
15
libs/core/enums.d.ts
vendored
@@ -512,15 +512,12 @@ declare namespace motors {
|
|||||||
|
|
||||||
|
|
||||||
declare const enum SerialPin {
|
declare const enum SerialPin {
|
||||||
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
|
||||||
P8 = 15, // MICROBIT_ID_IO_P8
|
P3 = 23, // MICROBIT_ID_IO_P16
|
||||||
P12 = 19, // MICROBIT_ID_IO_P12
|
C16 = 9, // MICROBIT_ID_IO_P2
|
||||||
P13 = 20, // MICROBIT_ID_IO_P13
|
C17 = 15, // MICROBIT_ID_IO_P8
|
||||||
P14 = 21, // MICROBIT_ID_IO_P14
|
|
||||||
P15 = 22, // MICROBIT_ID_IO_P15
|
|
||||||
P16 = 23, // MICROBIT_ID_IO_P16
|
|
||||||
USB_TX = 1001,
|
USB_TX = 1001,
|
||||||
USB_RX = 1002,
|
USB_RX = 1002,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ namespace pins {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the connector value as analog, that is, as a value comprised between 0 and 1023.
|
* Read the connector value as analog, that is, as a value comprised between 0 and 1023.
|
||||||
* @param name pin to write to, eg: AnalogPin.P0
|
* @param name pin to write to, eg: AnalogPin.P1
|
||||||
*/
|
*/
|
||||||
//% help=pins/analog-read-pin weight=25
|
//% 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"
|
||||||
@@ -146,7 +146,7 @@ namespace pins {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the connector value as analog. Value must be comprised between 0 and 1023.
|
* Set the connector value as analog. Value must be comprised between 0 and 1023.
|
||||||
* @param name pin name to write to, eg: AnalogPin.P0
|
* @param name pin name to write to, eg: AnalogPin.P1
|
||||||
* @param value value to write to the pin between ``0`` and ``1023``. eg:1023,0
|
* @param value value to write to the pin between ``0`` and ``1023``. eg:1023,0
|
||||||
*/
|
*/
|
||||||
//% help=pins/analog-write-pin weight=24
|
//% help=pins/analog-write-pin weight=24
|
||||||
@@ -161,7 +161,7 @@ namespace pins {
|
|||||||
/**
|
/**
|
||||||
* Configure the pulse-width modulation (PWM) period of the analog output in microseconds.
|
* Configure the pulse-width modulation (PWM) period of the analog output in microseconds.
|
||||||
* If this pin is not configured as an analog output (using `analog write pin`), the operation has no effect.
|
* If this pin is not configured as an analog output (using `analog write pin`), the operation has no effect.
|
||||||
* @param name analog pin to set period to, eg: AnalogPin.P0
|
* @param name analog pin to set period to, eg: AnalogPin.P1
|
||||||
* @param micros period in micro seconds. eg:20000
|
* @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
|
||||||
@@ -244,7 +244,7 @@ namespace pins {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).
|
* Write a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).
|
||||||
* @param name pin to write to, eg: AnalogPin.P0
|
* @param name pin to write to, eg: AnalogPin.P1
|
||||||
* @param value angle or rotation speed, eg:180,90,0
|
* @param value angle or rotation speed, eg:180,90,0
|
||||||
*/
|
*/
|
||||||
//% help=pins/servo-write-pin weight=20
|
//% help=pins/servo-write-pin weight=20
|
||||||
|
|||||||
220
libs/core/pinscompat.ts
Normal file
@@ -0,0 +1,220 @@
|
|||||||
|
const enum PinEvent {
|
||||||
|
//% block="pulse high"
|
||||||
|
PulseHigh = DAL.MICROBIT_PIN_EVT_PULSE_HI, // DEVICE_PIN_EVT_PULSE_HI
|
||||||
|
//% block="pulse low"
|
||||||
|
PulseLow = DAL.MICROBIT_PIN_EVT_PULSE_LO, // DEVICE_PIN_EVT_PULSE_LO
|
||||||
|
//% block="rise"
|
||||||
|
Rise = DAL.MICROBIT_PIN_EVT_RISE, // DEVICE_PIN_EVT_RISE
|
||||||
|
//% block="fall"
|
||||||
|
Fall = DAL.MICROBIT_PIN_EVT_FALL, // DEVICE_PIN_EVT_FALL
|
||||||
|
}
|
||||||
|
|
||||||
|
//% noRefCounting fixedInstances
|
||||||
|
interface DigitalInOutPin {
|
||||||
|
digitalRead(): boolean;
|
||||||
|
|
||||||
|
digitalWrite(value: boolean): void;
|
||||||
|
|
||||||
|
onPulsed(pulse: PulseValue, body: () => void): void;
|
||||||
|
|
||||||
|
onEvent(event: PinEvent, body: () => void): void;
|
||||||
|
|
||||||
|
pulseIn(value: PulseValue, maxDuration?: number): number;
|
||||||
|
|
||||||
|
setPull(pull: PinPullMode): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
//% noRefCounting fixedInstances
|
||||||
|
interface AnalogInPin extends DigitalInOutPin {
|
||||||
|
analogRead(): number;
|
||||||
|
}
|
||||||
|
|
||||||
|
//% noRefCounting fixedInstances
|
||||||
|
interface AnalogOutPin extends DigitalInOutPin {
|
||||||
|
analogWrite(value: number): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
//% noRefCounting fixedInstances
|
||||||
|
interface AnalogInOutPin extends AnalogInPin, AnalogOutPin {
|
||||||
|
}
|
||||||
|
|
||||||
|
//% noRefCounting fixedInstances
|
||||||
|
interface PwmOnlyPin extends DigitalInOutPin, AnalogOutPin {
|
||||||
|
//% parts=microservo trackArgs=0
|
||||||
|
analogSetPeriod(period: number): void;
|
||||||
|
|
||||||
|
//% parts=microservo trackArgs=0
|
||||||
|
servoWrite(value: number): void;
|
||||||
|
|
||||||
|
//% parts=microservo trackArgs=0
|
||||||
|
servoSetPulse(duration: number): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
//% noRefCounting fixedInstances
|
||||||
|
interface PwmPin extends PwmOnlyPin, DigitalInOutPin, AnalogInPin {
|
||||||
|
}
|
||||||
|
|
||||||
|
//% noRefCounting fixedInstances
|
||||||
|
class MicrobitPin implements AnalogInPin, AnalogOutPin, AnalogInOutPin, PwmOnlyPin {
|
||||||
|
public id: number;
|
||||||
|
constructor(id: number) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected digitalId(): DigitalPin {
|
||||||
|
return <DigitalPin>this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected analogId(): AnalogPin {
|
||||||
|
return <AnalogPin>this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
digitalRead(): boolean {
|
||||||
|
return pins.digitalReadPin(this.digitalId()) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
digitalWrite(value: boolean): void {
|
||||||
|
pins.digitalWritePin(this.digitalId(), value ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
onPulsed(pulse: PulseValue, body: () => void): void {
|
||||||
|
pins.onPulsed(this.digitalId(), pulse, body);
|
||||||
|
}
|
||||||
|
|
||||||
|
onEvent(event: PinEvent, body: () => void): void {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
pulseIn(value: PulseValue, maxDuration?: number): number {
|
||||||
|
return pins.pulseIn(this.digitalId(), value, maxDuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
setPull(pull: PinPullMode): void {
|
||||||
|
pins.setPull(this.digitalId(), pull);
|
||||||
|
}
|
||||||
|
|
||||||
|
analogRead(): number {
|
||||||
|
return pins.analogReadPin(this.analogId());
|
||||||
|
}
|
||||||
|
|
||||||
|
analogWrite(value: number): void {
|
||||||
|
pins.analogWritePin(this.analogId(), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
analogSetPeriod(period: number): void {
|
||||||
|
pins.analogSetPeriod(this.analogId(), period);
|
||||||
|
}
|
||||||
|
|
||||||
|
servoWrite(value: number): void {
|
||||||
|
pins.servoWritePin(this.analogId(), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
servoSetPulse(duration: number): void {
|
||||||
|
pins.servoSetPulse(this.analogId(), duration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace pins {
|
||||||
|
/**
|
||||||
|
* Pin P0
|
||||||
|
*/
|
||||||
|
//% fixedInstance whenUsed
|
||||||
|
export const P0: PwmPin = new MicrobitPin(DigitalPin.P0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pin P1
|
||||||
|
*/
|
||||||
|
//% fixedInstance whenUsed
|
||||||
|
export const P1: PwmPin = new MicrobitPin(DigitalPin.P1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pin P2
|
||||||
|
*/
|
||||||
|
//% fixedInstance whenUsed
|
||||||
|
export const P2: PwmPin = new MicrobitPin(DigitalPin.P2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pin P3
|
||||||
|
*/
|
||||||
|
//% fixedInstance whenUsed
|
||||||
|
export const P3: PwmPin = new MicrobitPin(DigitalPin.P3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pin C4
|
||||||
|
*/
|
||||||
|
//% fixedInstance whenUsed
|
||||||
|
export const C4: AnalogInPin = new MicrobitPin(DigitalPin.C4);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pin C5
|
||||||
|
*/
|
||||||
|
//% fixedInstance whenUsed
|
||||||
|
export const C5: AnalogInPin = new MicrobitPin(DigitalPin.C5);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pin C6
|
||||||
|
*/
|
||||||
|
//% fixedInstance whenUsed
|
||||||
|
export const C6: AnalogInPin = new MicrobitPin(DigitalPin.C6);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pin C7
|
||||||
|
*/
|
||||||
|
//% fixedInstance whenUsed
|
||||||
|
export const C7: DigitalInOutPin = new MicrobitPin(DigitalPin.C7);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pin C8
|
||||||
|
*/
|
||||||
|
//% fixedInstance whenUsed
|
||||||
|
export const C8: DigitalInOutPin = new MicrobitPin(DigitalPin.C8);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pin C9
|
||||||
|
*/
|
||||||
|
//% fixedInstance whenUsed
|
||||||
|
export const C9: DigitalInOutPin = new MicrobitPin(DigitalPin.C9);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pin C10
|
||||||
|
*/
|
||||||
|
//% fixedInstance whenUsed
|
||||||
|
export const C10: DigitalInOutPin = new MicrobitPin(DigitalPin.C10);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pin C11
|
||||||
|
*/
|
||||||
|
//% fixedInstance whenUsed
|
||||||
|
export const C11: DigitalInOutPin = new MicrobitPin(DigitalPin.C11);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pin C12
|
||||||
|
*/
|
||||||
|
//% fixedInstance whenUsed
|
||||||
|
export const C12: DigitalInOutPin = new MicrobitPin(DigitalPin.C12);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pin C16
|
||||||
|
*/
|
||||||
|
//% fixedInstance whenUsed
|
||||||
|
export const C16: AnalogInPin = new MicrobitPin(DigitalPin.C16);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pin C17
|
||||||
|
*/
|
||||||
|
//% fixedInstance whenUsed
|
||||||
|
export const C17: AnalogInPin = new MicrobitPin(DigitalPin.C17);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pin C18
|
||||||
|
*/
|
||||||
|
//% fixedInstance whenUsed
|
||||||
|
export const C18: DigitalInOutPin = new MicrobitPin(DigitalPin.C18);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pin C19
|
||||||
|
*/
|
||||||
|
//% fixedInstance whenUsed
|
||||||
|
export const C19: DigitalInOutPin = new MicrobitPin(DigitalPin.C19);
|
||||||
|
}
|
||||||
@@ -13,10 +13,11 @@
|
|||||||
"dal.d.ts",
|
"dal.d.ts",
|
||||||
"enums.d.ts",
|
"enums.d.ts",
|
||||||
"shims.d.ts",
|
"shims.d.ts",
|
||||||
"pxt-core.d.ts",
|
"pxt-core.d.ts",
|
||||||
"core.cpp",
|
"core.cpp",
|
||||||
"pxt-helpers.ts",
|
"pxt-helpers.ts",
|
||||||
"helpers.ts",
|
"helpers.ts",
|
||||||
|
"pinscompat.ts",
|
||||||
"configkeys.h",
|
"configkeys.h",
|
||||||
"gc.cpp",
|
"gc.cpp",
|
||||||
"codal.cpp",
|
"codal.cpp",
|
||||||
|
|||||||
@@ -4,15 +4,12 @@
|
|||||||
|
|
||||||
// make sure USB_TX and USB_RX don't overlap with other pin ids
|
// make sure USB_TX and USB_RX don't overlap with other pin ids
|
||||||
enum SerialPin {
|
enum SerialPin {
|
||||||
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,
|
||||||
P8 = MICROBIT_ID_IO_P8,
|
P3 = MICROBIT_ID_IO_P16,
|
||||||
P12 = MICROBIT_ID_IO_P12,
|
C16 = MICROBIT_ID_IO_P2,
|
||||||
P13 = MICROBIT_ID_IO_P13,
|
C17 = MICROBIT_ID_IO_P8,
|
||||||
P14 = MICROBIT_ID_IO_P14,
|
|
||||||
P15 = MICROBIT_ID_IO_P15,
|
|
||||||
P16 = MICROBIT_ID_IO_P16,
|
|
||||||
USB_TX = 1001,
|
USB_TX = 1001,
|
||||||
USB_RX = 1002
|
USB_RX = 1002
|
||||||
};
|
};
|
||||||
|
|||||||
14
libs/core/shims.d.ts
vendored
@@ -653,7 +653,7 @@ declare namespace pins {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the connector value as analog, that is, as a value comprised between 0 and 1023.
|
* Read the connector value as analog, that is, as a value comprised between 0 and 1023.
|
||||||
* @param name pin to write to, eg: AnalogPin.P0
|
* @param name pin to write to, eg: AnalogPin.P1
|
||||||
*/
|
*/
|
||||||
//% help=pins/analog-read-pin weight=25
|
//% 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"
|
||||||
@@ -663,7 +663,7 @@ declare namespace pins {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the connector value as analog. Value must be comprised between 0 and 1023.
|
* Set the connector value as analog. Value must be comprised between 0 and 1023.
|
||||||
* @param name pin name to write to, eg: AnalogPin.P0
|
* @param name pin name to write to, eg: AnalogPin.P1
|
||||||
* @param value value to write to the pin between ``0`` and ``1023``. eg:1023,0
|
* @param value value to write to the pin between ``0`` and ``1023``. eg:1023,0
|
||||||
*/
|
*/
|
||||||
//% help=pins/analog-write-pin weight=24
|
//% help=pins/analog-write-pin weight=24
|
||||||
@@ -676,7 +676,7 @@ declare namespace pins {
|
|||||||
/**
|
/**
|
||||||
* Configure the pulse-width modulation (PWM) period of the analog output in microseconds.
|
* Configure the pulse-width modulation (PWM) period of the analog output in microseconds.
|
||||||
* If this pin is not configured as an analog output (using `analog write pin`), the operation has no effect.
|
* If this pin is not configured as an analog output (using `analog write pin`), the operation has no effect.
|
||||||
* @param name analog pin to set period to, eg: AnalogPin.P0
|
* @param name analog pin to set period to, eg: AnalogPin.P1
|
||||||
* @param micros period in micro seconds. eg:20000
|
* @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
|
||||||
@@ -719,7 +719,7 @@ declare namespace pins {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).
|
* Write a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).
|
||||||
* @param name pin to write to, eg: AnalogPin.P0
|
* @param name pin to write to, eg: AnalogPin.P1
|
||||||
* @param value angle or rotation speed, eg:180,90,0
|
* @param value angle or rotation speed, eg:180,90,0
|
||||||
*/
|
*/
|
||||||
//% help=pins/servo-write-pin weight=20
|
//% help=pins/servo-write-pin weight=20
|
||||||
@@ -950,6 +950,12 @@ declare interface Buffer {
|
|||||||
//% shim=BufferMethods::getUint8
|
//% shim=BufferMethods::getUint8
|
||||||
getUint8(off: int32): int32;
|
getUint8(off: int32): int32;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns false when the buffer can be written to.
|
||||||
|
*/
|
||||||
|
//% shim=BufferMethods::isReadOnly
|
||||||
|
isReadOnly(): boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes an unsigned byte at a particular location
|
* Writes an unsigned byte at a particular location
|
||||||
*/
|
*/
|
||||||
|
|||||||
3
libs/servo/pxt.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/servo"
|
||||||
|
}
|
||||||
8
libs/servo/targetoverrides.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace servos {
|
||||||
|
//% block="servo P0" fixedInstance whenUsed
|
||||||
|
export const P0 = new servos.PinServo(pins.P0);
|
||||||
|
//% block="servo P1" fixedInstance whenUsed
|
||||||
|
export const P1 = new servos.PinServo(pins.P1);
|
||||||
|
//% block="servo P2" fixedInstance whenUsed
|
||||||
|
export const P2 = new servos.PinServo(pins.P2);
|
||||||
|
}
|
||||||
3722
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pxt-calliope",
|
"name": "pxt-calliope",
|
||||||
"version": "2.1.30",
|
"version": "2.1.34",
|
||||||
"description": "micro:bit target for Microsoft MakeCode (PXT)",
|
"description": "micro:bit target for Microsoft MakeCode (PXT)",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"JavaScript",
|
"JavaScript",
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
"typescript": "2.6.1"
|
"typescript": "2.6.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pxt-common-packages": "6.17.1",
|
"pxt-common-packages": "6.18.2",
|
||||||
"pxt-core": "5.30.28"
|
"pxt-core": "5.31.18"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,7 +284,7 @@
|
|||||||
"organizationUrl": "https://makecode.com/",
|
"organizationUrl": "https://makecode.com/",
|
||||||
"organizationLogo": "./static/Microsoft-logo_rgb_c-gray-square.png",
|
"organizationLogo": "./static/Microsoft-logo_rgb_c-gray-square.png",
|
||||||
"organizationWideLogo": "./static/Microsoft-logo_rgb_c-white.png",
|
"organizationWideLogo": "./static/Microsoft-logo_rgb_c-white.png",
|
||||||
"homeScreenHero": "./static/hero.png",
|
"homeScreenHero": "./static/hero.jpg",
|
||||||
"homeUrl": "https://makecode.calliope.cc/",
|
"homeUrl": "https://makecode.calliope.cc/",
|
||||||
"embedUrl": "https://makecode.calliope.cc/",
|
"embedUrl": "https://makecode.calliope.cc/",
|
||||||
"shareUrl": "https://makecode.calliope.cc/",
|
"shareUrl": "https://makecode.calliope.cc/",
|
||||||
@@ -427,5 +427,6 @@
|
|||||||
"hideMenuBar": true
|
"hideMenuBar": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"disableDocsUpload": true
|
||||||
}
|
}
|
||||||
0
resources/gestures/BackSideUp.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 650 B After Width: | Height: | Size: 650 B |
0
resources/gestures/FreeFall.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
0
resources/gestures/FrontSideUp.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
0
resources/gestures/Impact3G.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
0
resources/gestures/Impact6G.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
0
resources/gestures/Impact8G.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
0
resources/gestures/Shake.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
0
resources/gestures/TiltBackward.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
0
resources/gestures/TiltForward.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
0
resources/gestures/TiltLeft.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
0
resources/gestures/TiltRight.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
@@ -179,7 +179,13 @@
|
|||||||
"assirati/pxt-inventura",
|
"assirati/pxt-inventura",
|
||||||
"Veilkrand/pxt-RobotCar",
|
"Veilkrand/pxt-RobotCar",
|
||||||
"4tronix/DriveBit",
|
"4tronix/DriveBit",
|
||||||
"Freenove/Makecode-Extension-Starter-Kit"
|
"Freenove/Makecode-Extension-Starter-Kit",
|
||||||
|
"sphero-inc/sphero-sdk-microbit-makecode",
|
||||||
|
"BrightWearables/pxt-microbit-brightboard",
|
||||||
|
"EBOTICS/pxt-eboticsMIBO",
|
||||||
|
"KitronikLtd/pxt-kitronik-halohd",
|
||||||
|
"dugbraden/pxt-climate-action-kit",
|
||||||
|
"alsrobot-microbit-makecode-packages/MiniCruise"
|
||||||
],
|
],
|
||||||
"preferredRepos": [
|
"preferredRepos": [
|
||||||
"Microsoft/pxt-neopixel",
|
"Microsoft/pxt-neopixel",
|
||||||
@@ -222,7 +228,7 @@
|
|||||||
],
|
],
|
||||||
"galleries": {
|
"galleries": {
|
||||||
"First Steps": "calliope/firststeps",
|
"First Steps": "calliope/firststeps",
|
||||||
"Turorials": "calliope/tutorials",
|
"Tutorials": "calliope/tutorials",
|
||||||
"Calliope Links": "calliope/links"
|
"Calliope Links": "calliope/links"
|
||||||
},
|
},
|
||||||
"electronManifest": {
|
"electronManifest": {
|
||||||
|
|||||||