Merge pull request #3 from Microsoft/pxtupdate
Updated to latest of pxt / common
This commit is contained in:
		@@ -3,9 +3,3 @@
 | 
			
		||||
## Reference #reference
 | 
			
		||||
 | 
			
		||||
* [Reference](/reference)
 | 
			
		||||
    * [input](/reference/input)
 | 
			
		||||
    * [light](/reference/light)
 | 
			
		||||
    * [music](/reference/music)
 | 
			
		||||
    * [pins](/reference/pins)
 | 
			
		||||
    * [control](/reference/control)
 | 
			
		||||
    * [serial](/reference/serial)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,19 +1,3 @@
 | 
			
		||||
# Reference
 | 
			
		||||
 | 
			
		||||
```namespaces
 | 
			
		||||
input.onGesture(Gesture.Shake, () => {})
 | 
			
		||||
light.showRing('red red red red red red red red red red')
 | 
			
		||||
music.playTone(0, 0)
 | 
			
		||||
pins.pulseDuration()
 | 
			
		||||
control.runInBackground(() => {})
 | 
			
		||||
serial.writeLine("");
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## See Also
 | 
			
		||||
 | 
			
		||||
[blocks](/blocks), [JavaScript](/javascript), [input](/reference/input), [light](/reference/light), [music](/reference/music),
 | 
			
		||||
[control](/reference/control), [pins](/reference/pins), [serial](/reference/serial)
 | 
			
		||||
 | 
			
		||||
```package
 | 
			
		||||
circuit-playground
 | 
			
		||||
```
 | 
			
		||||
TODO
 | 
			
		||||
@@ -31,6 +31,22 @@
 | 
			
		||||
  "Array.splice|param|deleteCount": "The number of elements to remove. eg: 0",
 | 
			
		||||
  "Array.splice|param|start": "The zero-based location in the array from which to start removing elements. eg: 0",
 | 
			
		||||
  "Array.unshift": "Add one element to the beginning of an array and return the new length of the array.",
 | 
			
		||||
  "Boolean.toString": "Returns a string representation of an object.",
 | 
			
		||||
  "Buffer.fill": "Fill (a fragment) of the buffer with given value.",
 | 
			
		||||
  "Buffer.getNumber": "Read a number in specified format from the buffer.",
 | 
			
		||||
  "Buffer.length": "Returns the length of a Buffer object.",
 | 
			
		||||
  "Buffer.rotate": "Rotate buffer left in place.\n\n\n\nstart. eg: -1",
 | 
			
		||||
  "Buffer.rotate|param|length": "number of elements in buffer. If negative, length is set as the buffer length minus",
 | 
			
		||||
  "Buffer.rotate|param|offset": "number of bytes to shift; use negative value to shift right",
 | 
			
		||||
  "Buffer.rotate|param|start": "start offset in buffer. Default is 0.",
 | 
			
		||||
  "Buffer.setNumber": "Write a number in specified format in the buffer.",
 | 
			
		||||
  "Buffer.shift": "Shift buffer left in place, with zero padding.\n\n\n\nstart. eg: -1",
 | 
			
		||||
  "Buffer.shift|param|length": "number of elements in buffer. If negative, length is set as the buffer length minus",
 | 
			
		||||
  "Buffer.shift|param|offset": "number of bytes to shift; use negative value to shift right",
 | 
			
		||||
  "Buffer.shift|param|start": "start offset in buffer. Default is 0.",
 | 
			
		||||
  "Buffer.slice": "Return a copy of a fragment of a buffer.",
 | 
			
		||||
  "Buffer.toHex": "Convert a buffer to its hexadecimal representation.",
 | 
			
		||||
  "Buffer.write": "Write contents of `src` at `dstOffset` in current buffer.",
 | 
			
		||||
  "Math": "More complex operations with numbers.",
 | 
			
		||||
  "Math.abs": "Returns the absolute value of a number (the value without regard to whether it is positive or negative).\nFor example, the absolute value of -5 is the same as the absolute value of 5.",
 | 
			
		||||
  "Math.abs|param|x": "A numeric expression for which the absolute value is needed.",
 | 
			
		||||
@@ -91,6 +107,7 @@
 | 
			
		||||
  "Math.tan|param|x": "An angle in radians",
 | 
			
		||||
  "Math.trunc": "Returns the number with the decimal part truncated.",
 | 
			
		||||
  "Math.trunc|param|x": "A numeric expression.",
 | 
			
		||||
  "Number.toString": "Returns a string representation of a number.",
 | 
			
		||||
  "String": "Combine, split, and search text strings.\n\nCombine, split, and search text strings.",
 | 
			
		||||
  "String.charAt": "Return the character at the specified index.",
 | 
			
		||||
  "String.charAt|param|index": "The zero-based index of the desired character.",
 | 
			
		||||
@@ -107,6 +124,8 @@
 | 
			
		||||
  "String.substr|param|length": "number of characters to extract",
 | 
			
		||||
  "String.substr|param|start": "first character index; can be negative from counting from the end, eg:0",
 | 
			
		||||
  "control": "Program controls and events.",
 | 
			
		||||
  "control.AnimationQueue.cancel": "Cancels the current running animation and clears the queue",
 | 
			
		||||
  "control.AnimationQueue.runUntilDone": "Runs 'render' in a loop until it returns false or the 'stop' function is called",
 | 
			
		||||
  "control.assert": "Display an error code and stop the program when the assertion is `false`.",
 | 
			
		||||
  "control.deviceSerialNumber": "Derive a unique, consistent serial number of this device from internal data.",
 | 
			
		||||
  "control.millis": "Gets the number of milliseconds elapsed since power on.",
 | 
			
		||||
@@ -119,11 +138,13 @@
 | 
			
		||||
  "control.waitForEvent": "Blocks the calling thread until the specified event is raised.",
 | 
			
		||||
  "control.waitMicros": "Block the current fiber for the given microseconds",
 | 
			
		||||
  "control.waitMicros|param|micros": "number of micro-seconds to wait. eg: 4",
 | 
			
		||||
  "hex": "Tagged hex literal converter",
 | 
			
		||||
  "loops.forever": "Repeats the code forever in the background. On each iteration, allows other codes to run.",
 | 
			
		||||
  "loops.pause": "Pause for the specified time in milliseconds",
 | 
			
		||||
  "loops.pause|param|ms": "how long to pause for, eg: 100, 200, 500, 1000, 2000",
 | 
			
		||||
  "loops.timePicker": "Get the time field editor",
 | 
			
		||||
  "loops.timePicker|param|ms": "time duration in milliseconds, eg: 500, 1000",
 | 
			
		||||
  "parseInt": "Convert a string to an integer.",
 | 
			
		||||
  "serial": "Reading and writing data over a serial connection.",
 | 
			
		||||
  "serial.writeBuffer": "Send a buffer across the serial connection.",
 | 
			
		||||
  "serial.writeLine": "Write a line of text to the serial port.",
 | 
			
		||||
 
 | 
			
		||||
@@ -33,6 +33,7 @@
 | 
			
		||||
  "loops.pause|block": "pause %ms=timePicker|ms",
 | 
			
		||||
  "loops.timePicker|block": "%ms",
 | 
			
		||||
  "loops|block": "loops",
 | 
			
		||||
  "parseInt|block": "parse to integer %text",
 | 
			
		||||
  "serial.writeBuffer|block": "serial|write buffer %buffer",
 | 
			
		||||
  "serial.writeLine|block": "serial|write line %text",
 | 
			
		||||
  "serial.writeNumber|block": "serial|write number %value",
 | 
			
		||||
@@ -41,9 +42,13 @@
 | 
			
		||||
  "serial|block": "serial",
 | 
			
		||||
  "{id:category}Array": "Array",
 | 
			
		||||
  "{id:category}Arrays": "Arrays",
 | 
			
		||||
  "{id:category}Boolean": "Boolean",
 | 
			
		||||
  "{id:category}Buffer": "Buffer",
 | 
			
		||||
  "{id:category}Control": "Control",
 | 
			
		||||
  "{id:category}Helpers": "Helpers",
 | 
			
		||||
  "{id:category}Loops": "Loops",
 | 
			
		||||
  "{id:category}Math": "Math",
 | 
			
		||||
  "{id:category}Number": "Number",
 | 
			
		||||
  "{id:category}Serial": "Serial",
 | 
			
		||||
  "{id:category}String": "String",
 | 
			
		||||
  "{id:category}Text": "Text"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								libs/base/shims.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								libs/base/shims.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -70,7 +70,7 @@ declare namespace loops {
 | 
			
		||||
     * Repeats the code forever in the background. On each iteration, allows other codes to run.
 | 
			
		||||
     * @param body code to execute
 | 
			
		||||
     */
 | 
			
		||||
    //% help=loops/forever weight=100
 | 
			
		||||
    //% help=loops/forever weight=100 afterOnStart=true
 | 
			
		||||
    //% blockId=forever block="forever" blockAllowMultiple=1 shim=loops::forever
 | 
			
		||||
    function forever(a: () => void): void;
 | 
			
		||||
 | 
			
		||||
@@ -120,7 +120,7 @@ declare namespace control {
 | 
			
		||||
    /**
 | 
			
		||||
     * Run other code in the background.
 | 
			
		||||
     */
 | 
			
		||||
    //% help=control/run-in-background blockAllowMultiple=1
 | 
			
		||||
    //% help=control/run-in-background blockAllowMultiple=1 afterOnStart=true
 | 
			
		||||
    //% blockId="control_run_in_background" block="run in background" blockGap=8 shim=control::runInBackground
 | 
			
		||||
    function runInBackground(a: () => void): void;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,14 @@
 | 
			
		||||
{
 | 
			
		||||
  "ButtonEvent": "User interaction on buttons",
 | 
			
		||||
  "Draw": "Drawing modes",
 | 
			
		||||
  "LightsPattern": "Patterns for lights under the buttons.",
 | 
			
		||||
  "MMap.getNumber": "Read a number in specified format from the buffer.",
 | 
			
		||||
  "MMap.ioctl": "Perform ioctl(2) on the underlaying file",
 | 
			
		||||
  "MMap.length": "Returns the length of a Buffer object.",
 | 
			
		||||
  "MMap.read": "Perform read(2) on the underlaying file",
 | 
			
		||||
  "MMap.setNumber": "Write a number in specified format in the buffer.",
 | 
			
		||||
  "MMap.slice": "Read a range of bytes into a buffer.",
 | 
			
		||||
  "MMap.write": "Perform write(2) on the underlaying file",
 | 
			
		||||
  "control": "Program controls and events.",
 | 
			
		||||
  "control.allocateNotifyEvent": "Allocates the next user notification event",
 | 
			
		||||
  "control.deviceFirmwareVersion": "Determine the version of system software currently running.",
 | 
			
		||||
@@ -9,6 +19,14 @@
 | 
			
		||||
  "control.raiseEvent|param|value": "Component specific code indicating the cause of the event.",
 | 
			
		||||
  "input": "Respond to and read data from buttons and sensors.",
 | 
			
		||||
  "input.Button": "Generic button class, for device buttons and sensors.",
 | 
			
		||||
  "input.Button.isPressed": "Check if button is currently pressed or not.",
 | 
			
		||||
  "input.Button.onEvent": "Do something when a button or sensor is clicked, double clicked, etc...",
 | 
			
		||||
  "input.Button.onEvent|param|body": "code to run when the event is raised",
 | 
			
		||||
  "input.Button.wasPressed": "See if the button was pressed again since the last time you checked.",
 | 
			
		||||
  "input.ColorSensor.getAmbientLight": "Get current ambient light value from the color sensor.",
 | 
			
		||||
  "input.ColorSensor.getColor": "Get the current color from the color sensor.",
 | 
			
		||||
  "input.ColorSensor.getReflectedLight": "Get current reflected light value from the color sensor.",
 | 
			
		||||
  "input.UltraSonicSensor.getDistance": "Get distance in mm",
 | 
			
		||||
  "input.buttonDown": "Down button.",
 | 
			
		||||
  "input.buttonEnter": "Enter button.",
 | 
			
		||||
  "input.buttonLeft": "Left button.",
 | 
			
		||||
@@ -33,10 +51,6 @@
 | 
			
		||||
  "output.setSpeed": "Set motor speed.",
 | 
			
		||||
  "output.setSpeed|param|out": "the output connection that the motor is connected to",
 | 
			
		||||
  "output.setSpeed|param|speed": "the desired speed to use. eg: 100",
 | 
			
		||||
  "output.start": "Turn motor on.",
 | 
			
		||||
  "output.start|param|out": "the output connection that the motor is connected to",
 | 
			
		||||
  "output.stop": "Turn motor off.",
 | 
			
		||||
  "output.stop|param|out": "the output connection that the motor is connected to",
 | 
			
		||||
  "output.switchMotor": "Switch the motor on or off.",
 | 
			
		||||
  "output.switchMotor|param|on": "1 to turn the motor on, 0 to turn it off",
 | 
			
		||||
  "output.switchMotor|param|out": "the output connection that the motor is connected to",
 | 
			
		||||
 
 | 
			
		||||
@@ -15,24 +15,30 @@
 | 
			
		||||
  "LightsPattern.Red|block": "Red",
 | 
			
		||||
  "control.raiseEvent|block": "raise event|from %src|with value %value",
 | 
			
		||||
  "control|block": "control",
 | 
			
		||||
  "input.Button.isPressed|block": "%button|is pressed",
 | 
			
		||||
  "input.Button.onEvent|block": "on %button|%event",
 | 
			
		||||
  "input.Button.wasPressed|block": "%button|was pressed",
 | 
			
		||||
  "input.ColorSensor.getAmbientLight|block": "%color| ambient light",
 | 
			
		||||
  "input.ColorSensor.getColor|block": "%color| color",
 | 
			
		||||
  "input.ColorSensor.getReflectedLight|block": "%color| reflected light",
 | 
			
		||||
  "input.buttonDown|block": "button down",
 | 
			
		||||
  "input.buttonEnter|block": "button enter",
 | 
			
		||||
  "input.buttonLeft|block": "button left",
 | 
			
		||||
  "input.buttonRight|block": "button right",
 | 
			
		||||
  "input.buttonUp|block": "button up",
 | 
			
		||||
  "input.color|block": "color sensor",
 | 
			
		||||
  "input.remoteBottomLeft|block": "remote bottom-left",
 | 
			
		||||
  "input.remoteBottomRight|block": "remote bottom-right",
 | 
			
		||||
  "input.remoteCenter|block": "remote center",
 | 
			
		||||
  "input.remoteTopLeft|block": "remote top-left",
 | 
			
		||||
  "input.remoteTopRight|block": "remote top-right",
 | 
			
		||||
  "input.touchSensor|block": "touch sensor",
 | 
			
		||||
  "input|block": "input",
 | 
			
		||||
  "output.getCurrentSpeed|block": "motor %out|speed",
 | 
			
		||||
  "output.getPattern|block": "%pattern",
 | 
			
		||||
  "output.setLights|block": "set status light %pattern=led_pattern",
 | 
			
		||||
  "output.setPower|block": "set motor %out| power to %power",
 | 
			
		||||
  "output.setSpeed|block": "set motor %out| speed to %speed",
 | 
			
		||||
  "output.start|block": "turn motor %out|on",
 | 
			
		||||
  "output.stop|block": "turn motor %out|off",
 | 
			
		||||
  "output.switchMotor|block": "turn motor %out|%on",
 | 
			
		||||
  "output.turn|block": "turn motor %out| on for %ms|milliseconds",
 | 
			
		||||
  "output|block": "output",
 | 
			
		||||
@@ -41,6 +47,7 @@
 | 
			
		||||
  "serial|block": "serial",
 | 
			
		||||
  "{id:category}Control": "Control",
 | 
			
		||||
  "{id:category}Input": "Input",
 | 
			
		||||
  "{id:category}MMap": "MMap",
 | 
			
		||||
  "{id:category}Output": "Output",
 | 
			
		||||
  "{id:category}Screen": "Screen",
 | 
			
		||||
  "{id:category}Serial": "Serial",
 | 
			
		||||
 
 | 
			
		||||
@@ -8,15 +8,15 @@
 | 
			
		||||
  "music.noteFrequency|param|name": "the note name, eg: Note.C",
 | 
			
		||||
  "music.playSound": "Start playing a sound and don't wait for it to finish.\nNotes are expressed as a string of characters with this format: NOTE[octave][:duration]",
 | 
			
		||||
  "music.playSoundUntilDone": "Play a sound and wait until the sound is done.\nNotes are expressed as a string of characters with this format: NOTE[octave][:duration]",
 | 
			
		||||
  "music.playSoundUntilDone|param|sound": "the melody to play, eg: 'g5:1'",
 | 
			
		||||
  "music.playSound|param|sound": "the melody to play, eg: 'g5:1'",
 | 
			
		||||
  "music.playSoundUntilDone|param|sound": "the melody to play, eg: music.sounds(Sounds.PowerUp)",
 | 
			
		||||
  "music.playSound|param|sound": "the melody to play, eg: music.sounds(Sounds.PowerUp)",
 | 
			
		||||
  "music.playTone": "Play a tone through the speaker for some amount of time.",
 | 
			
		||||
  "music.playTone|param|frequency": "pitch of the tone to play in Hertz (Hz)",
 | 
			
		||||
  "music.playTone|param|ms": "tone duration in milliseconds (ms)",
 | 
			
		||||
  "music.rest": "Rest, or play silence, for some time (in milleseconds).",
 | 
			
		||||
  "music.rest|param|ms": "rest duration in milliseconds (ms)",
 | 
			
		||||
  "music.rest|param|ms": "rest duration in milliseconds (ms), eg: 100",
 | 
			
		||||
  "music.ringTone": "Play a tone.",
 | 
			
		||||
  "music.ringTone|param|frequency": "pitch of the tone to play in Hertz (Hz)",
 | 
			
		||||
  "music.ringTone|param|frequency": "pitch of the tone to play in Hertz (Hz), eg: Note.C",
 | 
			
		||||
  "music.setTempo": "Set the tempo a number of beats per minute (bpm).",
 | 
			
		||||
  "music.setTempo|param|bpm": "The new tempo in beats per minute, eg: 120",
 | 
			
		||||
  "music.setVolume": "Set the output volume of the sound synthesizer.",
 | 
			
		||||
 
 | 
			
		||||
@@ -39,8 +39,8 @@
 | 
			
		||||
    "semantic-ui-less": "^2.2.4"
 | 
			
		||||
  },
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "pxt-common-packages": "0.9.6",
 | 
			
		||||
    "pxt-core": "2.0.49"
 | 
			
		||||
    "pxt-common-packages": "0.11.7",
 | 
			
		||||
    "pxt-core": "2.3.4"
 | 
			
		||||
  },
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "test": "node node_modules/pxt-core/built/pxt.js travis"
 | 
			
		||||
 
 | 
			
		||||
@@ -110,10 +110,7 @@
 | 
			
		||||
                "path": "https://www.lego.com/en-us/mindstorms/products/mindstorms-ev3-31313"
 | 
			
		||||
            }
 | 
			
		||||
        ],
 | 
			
		||||
        "galleries": {
 | 
			
		||||
        },
 | 
			
		||||
        "useStartPage": true,
 | 
			
		||||
        "sideDoc": "tutorials/getting-started",
 | 
			
		||||
        "invertedMenu": false,
 | 
			
		||||
        "invertedMonaco": false,
 | 
			
		||||
        "monacoToolbox": true,
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@ namespace pxsim {
 | 
			
		||||
    export class DalBoard extends CoreBoard implements
 | 
			
		||||
        AccelerometerBoard,
 | 
			
		||||
        CommonBoard,
 | 
			
		||||
        LightBoard,
 | 
			
		||||
        // LightBoard,
 | 
			
		||||
        LightSensorBoard,
 | 
			
		||||
        MicrophoneBoard,
 | 
			
		||||
        MusicBoard,
 | 
			
		||||
@@ -34,7 +34,7 @@ namespace pxsim {
 | 
			
		||||
        InfraredBoard,
 | 
			
		||||
        CapTouchBoard {
 | 
			
		||||
        // state & update logic for component services
 | 
			
		||||
        neopixelState: CommonNeoPixelState;
 | 
			
		||||
        // neopixelState: CommonNeoPixelState;
 | 
			
		||||
        buttonState: EV3ButtonState;
 | 
			
		||||
        slideSwitchState: SlideSwitchState;
 | 
			
		||||
        lightSensorState: AnalogSensorState;
 | 
			
		||||
@@ -175,9 +175,9 @@ namespace pxsim {
 | 
			
		||||
            return svg.toDataUri(new XMLSerializer().serializeToString(this.view));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        defaultNeopixelPin() {
 | 
			
		||||
            return this.edgeConnectorState.getPin(CPlayPinName.D8);
 | 
			
		||||
        }
 | 
			
		||||
        //defaultNeopixelPin() {
 | 
			
		||||
        //    return this.edgeConnectorState.getPin(CPlayPinName.D8);
 | 
			
		||||
        //}
 | 
			
		||||
 | 
			
		||||
        getDefaultPitchPin() {
 | 
			
		||||
            return this.edgeConnectorState.getPin(CPlayPinName.D6);
 | 
			
		||||
 
 | 
			
		||||
@@ -480,6 +480,7 @@ namespace pxsim.visuals {
 | 
			
		||||
            this.screenCanvasCtx.putImageData(this.screenCanvasData, 0, 0);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /*
 | 
			
		||||
        private updateNeoPixels() {
 | 
			
		||||
            let state = this.board;
 | 
			
		||||
            if (!state || !state.neopixelState) return;
 | 
			
		||||
@@ -509,6 +510,7 @@ namespace pxsim.visuals {
 | 
			
		||||
                if (p_inner) svg.filter(p_inner, `url(#neopixelglow)`);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        */
 | 
			
		||||
 | 
			
		||||
        private updateSound() {
 | 
			
		||||
            let state = this.board;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user