Compare commits
28 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
4d9dbb8a66 | ||
|
28aa7d451f | ||
|
7618996c0e | ||
|
be5c478d9f | ||
|
80cc438fa8 | ||
|
8080cb2bfd | ||
|
82c1717c4c | ||
|
d46748cd5a | ||
|
d4197e2eb1 | ||
|
1514458823 | ||
|
da72b09750 | ||
|
437ebb4fad | ||
|
b7c8709424 | ||
|
2325ffcd76 | ||
|
a02476f025 | ||
|
7d35519ca8 | ||
|
a45d46d4b4 | ||
|
176771abfb | ||
|
9db2687985 | ||
|
910987fcea | ||
|
7c8c35a326 | ||
|
7ad9a1cab8 | ||
|
97ba83f660 | ||
|
d69bd0e0e4 | ||
|
3e46d4c615 | ||
|
2a3f2d4b11 | ||
|
d9b3f2fbef | ||
|
978e0fd765 |
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"appref": "v"
|
"appref": "v0"
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"appref": "v0.8.21"
|
"appref": "v0.8.30"
|
||||||
}
|
}
|
||||||
|
@ -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
23
libs/calliope-i2c/i2c.ts
Normal 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);
|
||||||
|
});
|
11
libs/calliope-i2c/pxt.json
Normal file
11
libs/calliope-i2c/pxt.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "calliope-i2c",
|
||||||
|
"description": "Calliope I2C test",
|
||||||
|
"files": [
|
||||||
|
"i2c.ts"
|
||||||
|
],
|
||||||
|
"public": true,
|
||||||
|
"dependencies": {
|
||||||
|
"core": "file:../core"
|
||||||
|
}
|
||||||
|
}
|
23
libs/calliope-midi/midi.ts
Normal file
23
libs/calliope-midi/midi.ts
Normal 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);
|
||||||
|
}
|
||||||
|
});
|
11
libs/calliope-midi/pxt.json
Normal file
11
libs/calliope-midi/pxt.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "midi",
|
||||||
|
"description": "MIDI Example via Serial",
|
||||||
|
"files": [
|
||||||
|
"midi.ts"
|
||||||
|
],
|
||||||
|
"public": true,
|
||||||
|
"dependencies": {
|
||||||
|
"core": "file:../core"
|
||||||
|
}
|
||||||
|
}
|
@ -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)",
|
||||||
|
@ -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)",
|
||||||
|
@ -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
1
libs/core/dal.d.ts
vendored
@ -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,
|
||||||
|
2
libs/core/enums.d.ts
vendored
2
libs/core/enums.d.ts
vendored
@ -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,
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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
|
||||||
};
|
};
|
||||||
|
2
libs/core/shims.d.ts
vendored
2
libs/core/shims.d.ts
vendored
@ -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 {
|
||||||
|
|
||||||
|
@ -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"
|
||||||
|
@ -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
4
tests/i2c.ts
Normal 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)
|
Loading…
Reference in New Issue
Block a user