Compare commits

...

35 Commits

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

View File

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

View File

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

32
jenkins.groovy Normal file
View File

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

55
jenkins.sh Normal file
View File

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

View File

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

View File

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

View File

@ -230,6 +230,9 @@
"pins.servoWritePin": "Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).",
"pins.servoWritePin|param|name": "pin to write to",
"pins.servoWritePin|param|value": "angle or rotation speed, eg:180,90,0",
"pins.setEvents": "Configures the events emitted by this pin. Events can be subscribed to\nusing ``control.onEvent()``.",
"pins.setEvents|param|name": "pin to set the event mode on, eg: DigitalPin.P0",
"pins.setEvents|param|type": "the type of events for this pin to emit, eg: PinEventType.Edge",
"pins.setPull": "Configures the pull of this pin.",
"pins.setPull|param|name": "pin to set the pull mode on",
"pins.setPull|param|pull": "one of the mbed pull configurations: PullUp, PullDown, PullNone ",

View File

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

View File

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

View File

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

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

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

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

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

View File

@ -43,9 +43,9 @@ namespace ImageMethods {
*/
//% help=images/show-image weight=80 blockNamespace=images
//% blockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8
//% parts="ledmatrix"
void showImage(Image sprite, int xOffset) {
uBit.display.print(MicroBitImage(sprite), -xOffset, 0, 0);
//% parts="ledmatrix" async
void showImage(Image sprite, int xOffset, int interval = 400) {
uBit.display.print(MicroBitImage(sprite), -xOffset, 0, 0, interval);
}
/**
@ -150,7 +150,7 @@ namespace ImageMethods {
*/
//% weight=70 help=images/show-frame
//% parts="ledmatrix"
void showFrame(Image i, int frame) {
showImage(i, frame * 5);
void showFrame(Image i, int frame, int interval = 400) {
showImage(i, frame * 5, interval);
}
}

View File

@ -26,10 +26,10 @@ enum class Rotation {
};
enum class TouchPin {
P0 = MICROBIT_ID_IO_P0,
P1 = MICROBIT_ID_IO_P1,
P2 = MICROBIT_ID_IO_P2,
P3 = CALLIOPE_ID_IO_P22
P0 = MICROBIT_ID_IO_P12,
P1 = MICROBIT_ID_IO_P0,
P2 = MICROBIT_ID_IO_P1,
P3 = MICROBIT_ID_IO_P16
};
enum class AcceleratorRange {

View File

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

View File

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

View File

@ -1,15 +1,12 @@
#include "pxt.h"
enum SerialPin {
P0 = MICROBIT_ID_IO_P0,
P1 = MICROBIT_ID_IO_P1,
P2 = MICROBIT_ID_IO_P2,
//P8 = MICROBIT_ID_IO_P8,
//P12 = MICROBIT_ID_IO_P12,
//P13 = MICROBIT_ID_IO_P13,
//P14 = MICROBIT_ID_IO_P14,
//P15 = MICROBIT_ID_IO_P15,
//P16 = MICROBIT_ID_IO_P16
C16 = MICROBIT_ID_IO_P2,
C17 = MICROBIT_ID_IO_P8,
P0 = MICROBIT_ID_IO_P12,
P1 = MICROBIT_ID_IO_P0,
P2 = MICROBIT_ID_IO_P1,
P3 = MICROBIT_ID_IO_P16,
};
enum BaudRate {

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

@ -40,8 +40,8 @@ declare interface Image {
*/
//% help=images/show-image weight=80 blockNamespace=images
//% blockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8
//% parts="ledmatrix" shim=ImageMethods::showImage
showImage(xOffset: number): void;
//% parts="ledmatrix" async interval.defl=400 shim=ImageMethods::showImage
showImage(xOffset: number, interval?: number): void;
/**
* Draws the ``index``-th frame of the image on the screen.
@ -118,8 +118,8 @@ declare interface Image {
* @param frame TODO
*/
//% weight=70 help=images/show-frame
//% parts="ledmatrix" shim=ImageMethods::showFrame
showFrame(frame: number): void;
//% parts="ledmatrix" interval.defl=400 shim=ImageMethods::showFrame
showFrame(frame: number, interval?: number): void;
}
@ -651,7 +651,8 @@ declare namespace pins {
* Sets the pin used when using `pins->analog pitch`.
* @param name TODO
*/
//% help=pins/analog-set-pitch weight=12 shim=pins::analogSetPitchPin
//% blockId=device_analog_set_pitch_pin block="analog set pitch pin %name"
//% help=pins/analog-set-pitch weight=3 advanced=true shim=pins::analogSetPitchPin
function analogSetPitchPin(name: AnalogPin): void;
/**
@ -659,7 +660,8 @@ declare namespace pins {
* @param frequency TODO
* @param ms TODO
*/
//% help=pins/analog-pitch weight=14 async shim=pins::analogPitch
//% blockId=device_analog_pitch block="analog pitch %frequency|for (ms) %ms"
//% help=pins/analog-pitch weight=4 async advanced=true blockGap=8 shim=pins::analogPitch
function analogPitch(frequency: number, ms: number): void;
/**
@ -671,6 +673,16 @@ declare namespace pins {
//% blockId=device_set_pull block="set pull|pin %pin|to %pull" shim=pins::setPull
function setPull(name: DigitalPin, pull: PinPullMode): void;
/**
* Configures the events emitted by this pin. Events can be subscribed to
* using ``control.onEvent()``.
* @param name pin to set the event mode on, eg: DigitalPin.P0
* @param type the type of events for this pin to emit, eg: PinEventType.Edge
*/
//% help=pins/set-events weight=4 advanced=true
//% blockId=device_set_pin_events block="set pin %pin|to emit %type|events" shim=pins::setEvents
function setEvents(name: DigitalPin, type: PinEventType): void;
/**
* Create a new zero-initialized buffer.
* @param size number of bytes in the buffer

View File

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

View File

@ -15,13 +15,13 @@
"workspace": false,
"packages": true,
"sharing": true,
"publish": true,
"publishing": true,
"preferredPackages": [
],
"githubPackages": true
},
"compile": {
"isNative": false,
"isNative": true,
"hasHex": true,
"deployDrives": "MINI",
"driveName": "MINI",
@ -116,7 +116,7 @@
"C19": "C_P19",
"C20": "C_P20",
"EXT_PWR":"EXT_PWR",
"SPKR":"EXT_PWR",
"SPKR":"SPKR",
"BTN_A": "BTN_A",
"BTN_B": "BTN_B",
"MOTOR1": "M_OUT1",
@ -167,12 +167,12 @@
}
},
"compileService": {
"yottaTarget": "bbc-microbit-classic-gcc",
"yottaTarget": "calliope-mini-classic-gcc",
"yottaCorePackage": "microbit",
"githubCorePackage": "calliope-mini/microbit",
"gittag": "v1.0.3-calliope",
"serviceId": "microbit"
},
"gittag": "v2.0.0-rc7-calliope-p9",
"serviceId": "calliope"
},
"serial": {
"manufacturerFilter": "^mbed$",
"nameFilter": "^mbed Serial Port",
@ -189,10 +189,11 @@
"cardLogo": "./static/icons/apple-touch-icon.png",
"appLogo": "./static/icons/apple-touch-icon.png",
"homeUrl": "https://calliope.cc/",
"embedUrl": "https://calliope.cc/",
"embedUrl": "https://mini.pxt.io/",
"privacyUrl": "https://go.microsoft.com/fwlink/?LinkId=521839",
"termsOfUseUrl": "https://go.microsoft.com/fwlink/?LinkID=206977",
"githubUrl": "https://github.com/Microsoft/pxt-calliope",
"crowdinProject": "kindscript",
"organization": "Microsoft",
"organizationUrl": "https://pxt.io/",
"organizationLogo": "./static/Microsoft-logo_rgb_c-gray.png",

View File

@ -41,25 +41,26 @@ namespace pxsim {
DAL.MICROBIT_ID_IO_P5,
DAL.MICROBIT_ID_IO_P6,
DAL.MICROBIT_ID_IO_P7,
0, //DAL.MICROBIT_ID_IO_P8,
DAL.MICROBIT_ID_IO_P8,
DAL.MICROBIT_ID_IO_P9,
DAL.MICROBIT_ID_IO_P10,
DAL.MICROBIT_ID_IO_P11,
0, //DAL.MICROBIT_ID_IO_P12,
0, //DAL.MICROBIT_ID_IO_P13,
0, //DAL.MICROBIT_ID_IO_P14,
0, //DAL.MICROBIT_ID_IO_P15,
0, //DAL.MICROBIT_ID_IO_P16,
DAL.MICROBIT_ID_IO_P12,
DAL.MICROBIT_ID_IO_P13,
DAL.MICROBIT_ID_IO_P14,
DAL.MICROBIT_ID_IO_P15,
DAL.MICROBIT_ID_IO_P16,
0,
0,
DAL.MICROBIT_ID_IO_P19,
DAL.MICROBIT_ID_IO_P20
DAL.MICROBIT_ID_IO_P20,
DAL.MICROBIT_ID_IO_P21
],
servos: {
"P0": DAL.MICROBIT_ID_IO_P0,
"P1": DAL.MICROBIT_ID_IO_P1,
"P2": DAL.MICROBIT_ID_IO_P2,
"P3": DAL.MICROBIT_ID_IO_P3
"P0": DAL.MICROBIT_ID_IO_P12,
"P1": DAL.MICROBIT_ID_IO_P0,
"P2": DAL.MICROBIT_ID_IO_P1,
"P3": DAL.MICROBIT_ID_IO_P16
}
});
this.builtinParts["radio"] = this.radioState = new RadioState(runtime);

View File

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

View File

@ -129,10 +129,11 @@ namespace pxsim.images {
}
namespace pxsim.ImageMethods {
export function showImage(leds: Image, offset: number) {
export function showImage(leds: Image, offset: number, interval: number) {
pxtrt.nullCheck(leds)
leds.copyTo(offset, 5, board().ledMatrixState.image, 0)
runtime.queueDisplayUpdate()
basic.pause(interval);
}
export function plotImage(leds: Image, offset: number): void {
@ -155,8 +156,8 @@ namespace pxsim.ImageMethods {
ImageMethods.plotImage(leds, frame * Image.height);
}
export function showFrame(leds: Image, frame: number) {
ImageMethods.showImage(leds, frame * Image.height);
export function showFrame(leds: Image, frame: number, interval: number) {
ImageMethods.showImage(leds, frame * Image.height, interval);
}
export function pixel(leds: Image, x: number, y: number): number {

View File

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

View File

@ -51,36 +51,18 @@
Blockly
*******************************/
.blocklyTreeRow {
border-radius:5px;
}
/* Specifying top and bottom rounded toolbox borders. */
.blocklyTreeRow.blocklyTreeRowTop {
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.blocklyTreeRow.blocklyTreeRowBottom {
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
.blocklyTreeRow:hover {
background: @invertedBackground !important;
div.blocklyTreeRow {
border-radius:8px;
}
/* This removes any padding at the top of the toolbox */
.blocklyTreeRoot {
div.blocklyTreeRoot {
padding: 0px !important;
}
/* Blockly Text */
.blocklyTreeLabel {
div.blocklyTreeLabel {
font-family: @pageFont !important;
}
.blocklyTreeLabel {
font-size:1rem !important;
}
@ -89,25 +71,9 @@
}
.blocklyToolboxDiv {
/*left:30px !important;*/
padding:7px;
}
/* Blockly Toolbox Buttons */
.blocklyToolboxButtons .blocklyAddPackageButton {
&:extend(.ui.button all);
&:extend(.circular all);
background-color: rgba(0, 0, 0, 0.3);
color: white;
}
.blocklyToolboxButtons .blocklyUndoButton {
&:extend(.ui.button all);
&:extend(.circular all);
background-color: rgba(0, 0, 0, 0.3);
color: white;
}
.organization {
top: 1.6em;
}

View File

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