Compare commits

...

28 Commits
master ... v0

Author SHA1 Message Date
Matthias L. Jugel
4d9dbb8a66 surface repeated start functionality in i2c
(cherry picked from commit 213c52d)
2017-04-04 10:14:13 +02:00
Matthias L. Jugel
28aa7d451f add midi example and i2c test
(cherry picked from commit 436e376)
2017-04-04 10:14:02 +02:00
Peli de Halleux
7618996c0e lock mini/beta to v0xxx 2017-03-23 16:13:12 -07:00
Peli de Halleux
be5c478d9f 0.8.32 2017-03-23 16:08:29 -07:00
Peli de Halleux
80cc438fa8 updated to pxt-core 0.12.14 2017-03-23 16:08:17 -07:00
Peli de Halleux
8080cb2bfd updated pxt ref 2017-03-17 08:32:26 -07:00
Peli de Halleux
82c1717c4c 0.8.31 2017-03-08 04:17:33 -08:00
Peli de Halleux
d46748cd5a updated pxt reference 2017-03-08 04:17:18 -08:00
Peli de Halleux
d4197e2eb1 pointing to 0.8.30 2017-02-28 07:24:49 -08:00
Peli de Halleux
1514458823 0.8.30 2017-02-28 07:17:12 -08:00
Peli de Halleux
da72b09750 updated branch detection 2017-02-28 07:17:01 -08:00
Peli de Halleux
437ebb4fad 0.8.29 2017-02-28 07:07:22 -08:00
Peli de Halleux
b7c8709424 support for v0 branch build 2017-02-28 07:07:11 -08:00
Peli de Halleux
2325ffcd76 0.8.28 2017-02-28 06:54:52 -08:00
Peli de Halleux
a02476f025 Bump pxt-core to 0.11.55 2017-02-28 06:54:51 -08:00
Peli de Halleux
7d35519ca8 enabling sharing 2017-02-28 06:06:25 -08:00
Peli de Halleux
a45d46d4b4 0.8.27 2017-02-28 06:00:32 -08:00
Peli de Halleux
176771abfb updated to v0.8.26 2017-02-27 13:44:43 -08:00
Peli de Halleux
9db2687985 0.8.26 2017-02-27 13:36:32 -08:00
Matthias L. Jugel
910987fcea 0.8.25 2017-02-19 11:44:36 +01:00
Matthias L. Jugel
7c8c35a326 fix comments and parameter typo 2017-02-19 11:44:16 +01:00
thinkberg
7ad9a1cab8 0.8.24 2017-02-19 11:22:53 +01:00
thinkberg
97ba83f660 Merge branch 'calliope-mini-2016' of github.com:microsoft/pxt-calliope into calliope-mini-2016 2017-02-19 11:22:49 +01:00
thinkberg
d69bd0e0e4 fix play ringtone (#MINI-32) 2017-02-19 11:19:26 +01:00
Matthias L. Jugel
3e46d4c615 0.8.23 2017-02-18 15:42:01 +01:00
Matthias L. Jugel
2a3f2d4b11 fix 115200 string 2017-02-18 15:41:52 +01:00
Matthias L. Jugel
d9b3f2fbef add 57600 as baud selection 2017-02-18 15:32:21 +01:00
Matthias L. Jugel
978e0fd765 updated for Calliope mini board rev 0.3 (2016) 2017-02-18 15:25:12 +01:00
19 changed files with 108 additions and 26 deletions

View File

@ -1,3 +1,3 @@
{ {
"appref": "v" "appref": "v0"
} }

View File

@ -1,3 +1,3 @@
{ {
"appref": "v0.8.21" "appref": "v0.8.30"
} }

View File

@ -13,6 +13,7 @@ echo isPR: $1
originRegex="^origin/.*" originRegex="^origin/.*"
branchRegex="^origin/\K.*(?=$)" branchRegex="^origin/\K.*(?=$)"
releaseBranchRegex = "^(master|v\d+)$"
if [[ "$GIT_BRANCH" =~ $originRegex ]]; then if [[ "$GIT_BRANCH" =~ $originRegex ]]; then
branchName=$(echo ${GIT_BRANCH} | grep -oP $branchRegex) branchName=$(echo ${GIT_BRANCH} | grep -oP $branchRegex)
@ -27,7 +28,7 @@ if [ "$1" == "false" ]; then
echo Setting TRAVIS_PULL_REQUEST to false echo Setting TRAVIS_PULL_REQUEST to false
export TRAVIS_PULL_REQUEST=false export TRAVIS_PULL_REQUEST=false
if [ $TRAVIS_BRANCH == "master" ]; then if [[ "$TRAVIS_BRANCH" =~ $releaseBranchRegex ]]; then
if [[ -z $PXT_RELEASE_REPO ]]; then if [[ -z $PXT_RELEASE_REPO ]]; then
echo Cannot find release repo; skipping tag checks echo Cannot find release repo; skipping tag checks
else else

23
libs/calliope-i2c/i2c.ts Normal file
View File

@ -0,0 +1,23 @@
import rgbw = basic.rgbw;
serial.writeLine("I2C");
// send to 0x44, register 0x00, value 0x46 (RESET ISL29125)
pins.i2cWriteNumber(0x44, 0x0046, NumberFormat.UInt16BE);
// send to 0x44, register 0x01, value 0x05 (GRB SAMPLING)
pins.i2cWriteNumber(0x44, 0x0105, NumberFormat.UInt16BE);
basic.forever(() => {
serial.writeString("[");
pins.i2cWriteNumber(0x44, 0x0A, NumberFormat.Int8BE);
let g = pins.i2cReadNumber(0x44, NumberFormat.UInt8BE);
serial.writeNumber(r);
serial.writeString(",");
pins.i2cWriteNumber(0x44, 0x0C, NumberFormat.UInt8BE);
let r = pins.i2cReadNumber(0x44, NumberFormat.UInt8BE);
serial.writeNumber(g);
serial.writeString(",");
pins.i2cWriteNumber(0x44, 0x0E, NumberFormat.UInt8BE);
let b = pins.i2cReadNumber(0x44, NumberFormat.UInt8LE);
serial.writeNumber(b);
serial.writeLine("]");
basic.setLedColor(basic.rgbw(r,g,b, 0));
basic.pause(1000);
});

View File

@ -0,0 +1,11 @@
{
"name": "calliope-i2c",
"description": "Calliope I2C test",
"files": [
"i2c.ts"
],
"public": true,
"dependencies": {
"core": "file:../core"
}
}

View File

@ -0,0 +1,23 @@
serial.redirect(
SerialPin.P0,
SerialPin.P1,
31250
);
basic.forever(() => {
for (let note = 0; note <= 90 - 1; note++) {
// Note on channel 1 (0x90), some note value (note),
// middle velocity (0x45):
serial.writeString(String.fromCharCode(144));
serial.writeString(String.fromCharCode(note));
serial.writeString(String.fromCharCode(69));
basic.pause(100);
// Note on channel 1 (0x90), some note value (note),
// silent velocity (0x00):
serial.writeString(String.fromCharCode(144));
serial.writeString(String.fromCharCode(note));
serial.writeString("\0");
basic.pause(100);
basic.pause(1000);
}
});

View File

@ -0,0 +1,11 @@
{
"name": "midi",
"description": "MIDI Example via Serial",
"files": [
"midi.ts"
],
"public": true,
"dependencies": {
"core": "file:../core"
}
}

View File

@ -180,6 +180,7 @@
"music.noteFrequency": "Gets the frequency of a note.", "music.noteFrequency": "Gets the frequency of a note.",
"music.noteFrequency|param|name": "the note name", "music.noteFrequency|param|name": "the note name",
"music.playTone": "Plays a tone through ``speaker`` for the given duration.", "music.playTone": "Plays a tone through ``speaker`` for the given duration.",
"music.playTone|param|frequency": "pitch of the tone to play in Hertz (Hz)",
"music.playTone|param|ms": "tone duration in milliseconds (ms)", "music.playTone|param|ms": "tone duration in milliseconds (ms)",
"music.rest": "Rests (plays nothing) for a specified time through pin ``P0``.", "music.rest": "Rests (plays nothing) for a specified time through pin ``P0``.",
"music.rest|param|ms": "rest duration in milliseconds (ms)", "music.rest|param|ms": "rest duration in milliseconds (ms)",

View File

@ -8,6 +8,7 @@
"AcceleratorRange.TwoG": "The accelerator measures forces up to 2 gravity", "AcceleratorRange.TwoG": "The accelerator measures forces up to 2 gravity",
"AcceleratorRange.TwoG|block": "2g", "AcceleratorRange.TwoG|block": "2g",
"BaudRate.BaudRate115200|block": "115200", "BaudRate.BaudRate115200|block": "115200",
"BaudRate.BaudRate56700|block": "57600",
"BaudRate.BaudRate9600|block": "9600", "BaudRate.BaudRate9600|block": "9600",
"BeatFraction.Eighth|block": "1/8", "BeatFraction.Eighth|block": "1/8",
"BeatFraction.Half|block": "1/2", "BeatFraction.Half|block": "1/2",
@ -94,9 +95,7 @@
"Rotation.Roll|block": "roll", "Rotation.Roll|block": "roll",
"String.charAt|block": "char from %this=text|at %pos", "String.charAt|block": "char from %this=text|at %pos",
"String.compare|block": "compare %this=text| to %that", "String.compare|block": "compare %this=text| to %that",
"String.concat|block": "join %this=text|%other",
"String.fromCharCode|block": "text from char code %code", "String.fromCharCode|block": "text from char code %code",
"String.isEmpty|block": "%this=text| is empty",
"String.length|block": "length of %VALUE", "String.length|block": "length of %VALUE",
"String.substr|block": "substring of %this=text|from %start|of length %length", "String.substr|block": "substring of %this=text|from %start|of length %length",
"String|block": "String", "String|block": "String",
@ -175,8 +174,8 @@
"pins.analogWritePin|block": "analog write|pin %name|to %value", "pins.analogWritePin|block": "analog write|pin %name|to %value",
"pins.digitalReadPin|block": "digital read|pin %name", "pins.digitalReadPin|block": "digital read|pin %name",
"pins.digitalWritePin|block": "digital write|pin %name|to %value", "pins.digitalWritePin|block": "digital write|pin %name|to %value",
"pins.i2cReadNumber|block": "i2c read number|at address %address|of format %format=i2c_sizeof", "pins.i2cReadNumber|block": "i2c read number|at address %address|of format %format=i2c_sizeof|repeat %repeat",
"pins.i2cWriteNumber|block": "i2c write number|at address %address|with value %value|of format %format=i2c_sizeof", "pins.i2cWriteNumber|block": "i2c write number|at address %address|with value %value|of format %format=i2c_sizeof|repeat %repeat",
"pins.map|block": "map %value|from low %fromLow|from high %fromHigh|to low %toLow|to high %toHigh", "pins.map|block": "map %value|from low %fromLow|from high %fromHigh|to low %toLow|to high %toHigh",
"pins.onPulsed|block": "on|pin %pin|pulsed %pulse", "pins.onPulsed|block": "on|pin %pin|pulsed %pulse",
"pins.pulseDuration|block": "pulse duration (µs)", "pins.pulseDuration|block": "pulse duration (µs)",

View File

@ -7,7 +7,7 @@
"AcceleratorRange.OneG|block": "1g", "AcceleratorRange.OneG|block": "1g",
"AcceleratorRange.TwoG": "Der Bewegungssensor misst Kräfte bis 2g", "AcceleratorRange.TwoG": "Der Bewegungssensor misst Kräfte bis 2g",
"AcceleratorRange.TwoG|block": "2g", "AcceleratorRange.TwoG|block": "2g",
"BaudRate.BaudRate115200|block": "11520", "BaudRate.BaudRate115200|block": "115200",
"BaudRate.BaudRate9600|block": "9600", "BaudRate.BaudRate9600|block": "9600",
"BeatFraction.Eighth|block": "1/8", "BeatFraction.Eighth|block": "1/8",
"BeatFraction.Half|block": "1/2", "BeatFraction.Half|block": "1/2",

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

@ -192,6 +192,7 @@ declare const enum DAL {
MICROBIT_SERIAL_EVT_TX_EMPTY = 2, MICROBIT_SERIAL_EVT_TX_EMPTY = 2,
MICROBIT_UART_S_EVT_TX_EMPTY = 3, MICROBIT_UART_S_EVT_TX_EMPTY = 3,
// built/yt/yotta_modules/microbit-dal/inc/drivers/CalliopeRGB.h // built/yt/yotta_modules/microbit-dal/inc/drivers/CalliopeRGB.h
RGB_LED_MAX_INTENSITY = 40,
// built/yt/yotta_modules/microbit-dal/inc/drivers/CalliopeSoundMotor.h // built/yt/yotta_modules/microbit-dal/inc/drivers/CalliopeSoundMotor.h
CALLIOPE_SM_DEFAULT_DUTY_M = 50, CALLIOPE_SM_DEFAULT_DUTY_M = 50,
CALLIOPE_SM_DEFAULT_DUTY_S = 100, CALLIOPE_SM_DEFAULT_DUTY_S = 100,

View File

@ -339,6 +339,8 @@ declare namespace motors {
declare enum BaudRate { declare enum BaudRate {
//% block=115200 //% block=115200
BaudRate115200 = 115200, BaudRate115200 = 115200,
//% block=57600
BaudRate56700 = 57600,
//% block=9600 //% block=9600
BaudRate9600 = 9600, BaudRate9600 = 9600,
} }

View File

@ -9,9 +9,13 @@ namespace music {
//% help=music/play-tone weight=90 //% help=music/play-tone weight=90
//% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8 //% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8
//% parts="speaker" async //% parts="speaker" async
void playTone(int freqency, int ms) { void playTone(int frequency, int ms) {
uBit.soundmotor.soundOn(freqency); if(frequency > 0) uBit.soundmotor.soundOn(frequency);
if(ms > 0) uBit.sleep(ms); else uBit.soundmotor.soundOff();
if(ms > 0) {
uBit.sleep(ms);
uBit.soundmotor.soundOff(); uBit.soundmotor.soundOff();
} }
}
} }

View File

@ -22,9 +22,9 @@ namespace pins {
* Read one number from 7-bit I2C address. * Read one number from 7-bit I2C address.
*/ */
//% help=pins/i2c-read-number blockGap=8 //% help=pins/i2c-read-number blockGap=8
//% blockId=pins_i2c_readnumber block="i2c read number|at address %address|of format %format=i2c_sizeof" weight=7 //% blockId=pins_i2c_readnumber block="i2c read number|at address %address|of format %format=i2c_sizeof|repeat %repeat" weight=7
export function i2cReadNumber(address: number, format: NumberFormat): number { export function i2cReadNumber(address: number, format: NumberFormat, repeat?: boolean): number {
let buf = pins.i2cReadBuffer(address, pins.sizeOf(format)) let buf = pins.i2cReadBuffer(address, pins.sizeOf(format), repeat)
return buf.getNumber(format, 0) return buf.getNumber(format, 0)
} }
@ -32,11 +32,11 @@ namespace pins {
* Write one number to a 7-bit I2C address. * Write one number to a 7-bit I2C address.
*/ */
//% help=pins/i2c-write-number blockGap=8 //% help=pins/i2c-write-number blockGap=8
//% blockId=i2c_writenumber block="i2c write number|at address %address|with value %value|of format %format=i2c_sizeof" weight=6 //% blockId=i2c_writenumber block="i2c write number|at address %address|with value %value|of format %format=i2c_sizeof|repeat %repeat" weight=6
export function i2cWriteNumber(address: number, value: number, format: NumberFormat): void { export function i2cWriteNumber(address: number, value: number, format: NumberFormat, repeat?: boolean): void {
let buf = createBuffer(pins.sizeOf(format)) let buf = createBuffer(pins.sizeOf(format))
buf.setNumber(format, 0, value) buf.setNumber(format, 0, value)
pins.i2cWriteBuffer(address, buf) pins.i2cWriteBuffer(address, buf, repeat)
} }
/** /**

View File

@ -12,6 +12,8 @@ enum SerialPin {
enum BaudRate { enum BaudRate {
//% block=115200 //% block=115200
BaudRate115200 = 115200, BaudRate115200 = 115200,
//% block=57600
BaudRate56700 = 57600,
//% block=9600 //% block=9600
BaudRate9600 = 9600 BaudRate9600 = 9600
}; };

View File

@ -555,7 +555,7 @@ declare namespace music {
//% help=music/play-tone weight=90 //% help=music/play-tone weight=90
//% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8 //% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8
//% parts="speaker" async shim=music::playTone //% parts="speaker" async shim=music::playTone
function playTone(freqency: number, ms: number): void; function playTone(frequency: number, ms: number): void;
} }
declare namespace pins { declare namespace pins {

View File

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

View File

@ -14,8 +14,8 @@
"cloud": { "cloud": {
"workspace": false, "workspace": false,
"packages": true, "packages": true,
"sharing": false, "sharing": true,
"publishing": false, "publishing": true,
"preferredPackages": [ "preferredPackages": [
], ],
"githubPackages": true "githubPackages": true
@ -171,7 +171,7 @@
"yottaTarget": "calliope-mini-classic-gcc", "yottaTarget": "calliope-mini-classic-gcc",
"yottaCorePackage": "microbit", "yottaCorePackage": "microbit",
"githubCorePackage": "calliope-mini/microbit", "githubCorePackage": "calliope-mini/microbit",
"gittag": "v2.0.0-rc7-calliope-p9", "gittag": "v2.0.0-rc7-calliope-p9-2016-2",
"serviceId": "calliope" "serviceId": "calliope"
}, },
"serial": { "serial": {
@ -195,8 +195,8 @@
"termsOfUseUrl": "https://go.microsoft.com/fwlink/?LinkID=206977", "termsOfUseUrl": "https://go.microsoft.com/fwlink/?LinkID=206977",
"githubUrl": "https://github.com/Microsoft/pxt-calliope", "githubUrl": "https://github.com/Microsoft/pxt-calliope",
"crowdinProject": "kindscript", "crowdinProject": "kindscript",
"organization": "Microsoft", "organization": "Microsoft MakeCode",
"organizationUrl": "https://pxt.io/", "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",
"browserSupport": [ "browserSupport": [

4
tests/i2c.ts Normal file
View File

@ -0,0 +1,4 @@
let item = pins.i2cReadNumber(123, NumberFormat.Int8LE)
pins.i2cWriteNumber(123, 0, NumberFormat.Int8LE)
let item = pins.i2cReadNumber(123, NumberFormat.Int8LE, true)
pins.i2cWriteNumber(123, 0, NumberFormat.Int8LE, true)