Buffer from commonpackages (#1520)
* use buffer.ts from common packages * updated common packages * fix descr * fix double description * restore pin descr
This commit is contained in:
parent
44a47a7e5c
commit
11dbaabe3a
@ -388,6 +388,9 @@
|
|||||||
"led.unplot": "Turn off the specified LED using x, y coordinates (x is horizontal, y is vertical). (0,0) is upper left.",
|
"led.unplot": "Turn off the specified LED using x, y coordinates (x is horizontal, y is vertical). (0,0) is upper left.",
|
||||||
"led.unplot|param|x": "TODO",
|
"led.unplot|param|x": "TODO",
|
||||||
"led.unplot|param|y": "TODO",
|
"led.unplot|param|y": "TODO",
|
||||||
|
"msgpack.packNumberArray": "Pack a number array into a buffer.",
|
||||||
|
"msgpack.packNumberArray|param|nums": "the numbers to be packed",
|
||||||
|
"msgpack.unpackNumberArray": "Unpacks a buffer into a number array.",
|
||||||
"music": "Generation of music tones.",
|
"music": "Generation of music tones.",
|
||||||
"music.beat": "Returns the duration of a beat in milli-seconds",
|
"music.beat": "Returns the duration of a beat in milli-seconds",
|
||||||
"music.beginMelody": "Starts playing a melody.\nNotes are expressed as a string of characters with this format: NOTE[octave][:duration]",
|
"music.beginMelody": "Starts playing a melody.\nNotes are expressed as a string of characters with this format: NOTE[octave][:duration]",
|
||||||
@ -446,6 +449,8 @@
|
|||||||
"pins.analogWritePin|param|name": "pin name to write to, eg: AnalogPin.P0",
|
"pins.analogWritePin|param|name": "pin name to write to, eg: AnalogPin.P0",
|
||||||
"pins.analogWritePin|param|value": "value to write to the pin between ``0`` and ``1023``. eg:1023,0",
|
"pins.analogWritePin|param|value": "value to write to the pin between ``0`` and ``1023``. eg:1023,0",
|
||||||
"pins.createBuffer": "Create a new zero-initialized buffer.",
|
"pins.createBuffer": "Create a new zero-initialized buffer.",
|
||||||
|
"pins.createBufferFromArray": "Create a new buffer initalized to bytes from given array.",
|
||||||
|
"pins.createBufferFromArray|param|bytes": "data to initalize with",
|
||||||
"pins.createBuffer|param|size": "number of bytes in the buffer",
|
"pins.createBuffer|param|size": "number of bytes in the buffer",
|
||||||
"pins.digitalReadPin": "Read the specified pin or connector as either 0 or 1",
|
"pins.digitalReadPin": "Read the specified pin or connector as either 0 or 1",
|
||||||
"pins.digitalReadPin|param|name": "pin to read from, eg: DigitalPin.P0",
|
"pins.digitalReadPin|param|name": "pin to read from, eg: DigitalPin.P0",
|
||||||
|
@ -305,6 +305,7 @@
|
|||||||
"led.toggle|block": "toggle|x %x|y %y",
|
"led.toggle|block": "toggle|x %x|y %y",
|
||||||
"led.unplot|block": "unplot|x %x|y %y",
|
"led.unplot|block": "unplot|x %x|y %y",
|
||||||
"led|block": "led",
|
"led|block": "led",
|
||||||
|
"msgpack|block": "msgpack",
|
||||||
"music.beat|block": "%fraction|beat",
|
"music.beat|block": "%fraction|beat",
|
||||||
"music.beginMelody|block": "start melody %melody=device_builtin_melody| repeating %options",
|
"music.beginMelody|block": "start melody %melody=device_builtin_melody| repeating %options",
|
||||||
"music.builtInMelody|block": "%melody",
|
"music.builtInMelody|block": "%melody",
|
||||||
@ -374,6 +375,7 @@
|
|||||||
"{id:category}Led": "Led",
|
"{id:category}Led": "Led",
|
||||||
"{id:category}Math": "Math",
|
"{id:category}Math": "Math",
|
||||||
"{id:category}MicrobitPin": "MicrobitPin",
|
"{id:category}MicrobitPin": "MicrobitPin",
|
||||||
|
"{id:category}Msgpack": "Msgpack",
|
||||||
"{id:category}Music": "Music",
|
"{id:category}Music": "Music",
|
||||||
"{id:category}Number": "Number",
|
"{id:category}Number": "Number",
|
||||||
"{id:category}Pins": "Pins",
|
"{id:category}Pins": "Pins",
|
||||||
|
@ -41,6 +41,12 @@ namespace control {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function fail(message: string) {
|
||||||
|
console.log("Fatal failure: ")
|
||||||
|
console.log(message)
|
||||||
|
panic(108)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display warning in the simulator.
|
* Display warning in the simulator.
|
||||||
*/
|
*/
|
||||||
|
@ -38,33 +38,4 @@ namespace pins {
|
|||||||
buf.setNumber(format, 0, value)
|
buf.setNumber(format, 0, value)
|
||||||
pins.i2cWriteBuffer(address, buf, repeated)
|
pins.i2cWriteBuffer(address, buf, repeated)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the size in bytes of specified number format.
|
|
||||||
*/
|
|
||||||
//%
|
|
||||||
export function sizeOf(format: NumberFormat) {
|
|
||||||
switch (format) {
|
|
||||||
case NumberFormat.Int8LE:
|
|
||||||
case NumberFormat.UInt8LE:
|
|
||||||
case NumberFormat.Int8BE:
|
|
||||||
case NumberFormat.UInt8BE:
|
|
||||||
return 1;
|
|
||||||
case NumberFormat.Int16LE:
|
|
||||||
case NumberFormat.UInt16LE:
|
|
||||||
case NumberFormat.Int16BE:
|
|
||||||
case NumberFormat.UInt16BE:
|
|
||||||
return 2;
|
|
||||||
case NumberFormat.Int32LE:
|
|
||||||
case NumberFormat.Int32BE:
|
|
||||||
return 4;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
interface Buffer {
|
|
||||||
[index: number]: number;
|
|
||||||
// rest defined in buffer.cpp
|
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
"serial.cpp",
|
"serial.cpp",
|
||||||
"serial.ts",
|
"serial.ts",
|
||||||
"buffer.cpp",
|
"buffer.cpp",
|
||||||
|
"buffer.ts",
|
||||||
"pxtparts.json",
|
"pxtparts.json",
|
||||||
"parts/speaker.svg",
|
"parts/speaker.svg",
|
||||||
"parts/headphone.svg"
|
"parts/headphone.svg"
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
"@types/web-bluetooth": "0.0.4"
|
"@types/web-bluetooth": "0.0.4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pxt-common-packages": "0.24.9",
|
"pxt-common-packages": "0.24.11",
|
||||||
"pxt-core": "4.1.49"
|
"pxt-core": "4.1.49"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user