Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d9dbb8a66 | ||
|
|
28aa7d451f | ||
|
|
7618996c0e | ||
|
|
be5c478d9f | ||
|
|
80cc438fa8 | ||
|
|
8080cb2bfd | ||
|
|
82c1717c4c | ||
|
|
d46748cd5a | ||
|
|
d4197e2eb1 | ||
|
|
1514458823 | ||
|
|
da72b09750 |
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"appref": "v"
|
"appref": "v0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"appref": "v0.8.26"
|
"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" || $TRAVIS_BRANCH == "v0" ]; 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -174,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)",
|
||||||
|
|||||||
@@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pxt-calliope",
|
"name": "pxt-calliope",
|
||||||
"version": "0.8.29",
|
"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.55"
|
"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"
|
||||||
|
|||||||
@@ -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)
|
||||||
Reference in New Issue
Block a user