pxt-stm32-nucleo
Version:
528 lines • 42.8 kB
JavaScript
var pxtTargetBundle = {
"id": "stm32iotnode",
"name": "STM32 IoT Node",
"title": "STM32 IoT Node MakeCode Editor",
"description": "A Blocks / JavaScript code editor for the STM32 IoT Node powered by Microsoft MakeCode.",
"corepkg": "core",
"cloud": {
"workspace": false,
"packages": true,
"sharing": true,
"publishing": true,
"githubPackages": true
},
"bundleddirs": [
"libs/core"
],
"runtime": {
"mathBlocks": true,
"loopsBlocks": true,
"logicBlocks": true,
"variablesBlocks": true,
"textBlocks": true,
"listsBlocks": true,
"functionBlocks": true,
"onStartColor": "#0078D7",
"onStartNamespace": "robotdulab",
"onStartWeight": 54
},
"simulator": {
"autoRun": false,
"stopOnChange": true,
"enableTrace": true
},
"appTheme": {
"logoUrl": "https://github.com/labaixbidouille/pxt-robotdulab",
"homeUrl": "http://labaixbidouille.github.io/pxt-robotdulab/",
"betaUrl": "https://makecode.com/",
"docMenu": [
{
"name": "About",
"path": "/about"
},
{
"name": "Docs",
"path": "/docs"
}
],
"coloredToolbox": true,
"monacoToolbox": true,
"invertedMenu": true,
"useStartPage": false,
"blocklyOptions": {
"grid": {
"spacing": 45,
"length": 7,
"colour": "rgba(189, 195, 199, 0.30)",
"snap": true
}
},
"simAnimationEnter": "fly right in",
"simAnimationExit": "fly right out",
"disableBlockIcons": false,
"TOC": [
{
"name": "Blocks",
"subitems": [
{
"name": "On Start",
"subitems": [],
"path": "/blocks/on-start",
"prevName": "Blocks",
"prevPath": "/blocks",
"nextName": "Loops",
"nextPath": "/blocks/loops"
},
{
"name": "Loops",
"subitems": [
{
"name": "repeat",
"subitems": [],
"path": "/blocks/loops/repeat",
"prevName": "Loops",
"prevPath": "/blocks/loops",
"nextName": "for",
"nextPath": "/blocks/loops/for"
},
{
"name": "for",
"subitems": [],
"path": "/blocks/loops/for",
"prevName": "repeat",
"prevPath": "/blocks/loops/repeat",
"nextName": "while",
"nextPath": "/blocks/loops/while"
},
{
"name": "while",
"subitems": [],
"path": "/blocks/loops/while",
"prevName": "for",
"prevPath": "/blocks/loops/for",
"nextName": "Logic",
"nextPath": "/blocks/logic"
}
],
"path": "/blocks/loops",
"prevName": "On Start",
"prevPath": "/blocks/on-start",
"nextName": "repeat",
"nextPath": "/blocks/loops/repeat"
},
{
"name": "Logic",
"subitems": [
{
"name": "if",
"subitems": [],
"path": "/blocks/logic/if",
"prevName": "Logic",
"prevPath": "/blocks/logic",
"nextName": "Boolean",
"nextPath": "/blocks/logic/boolean"
},
{
"name": "Boolean",
"subitems": [],
"path": "/blocks/logic/boolean",
"prevName": "if",
"prevPath": "/blocks/logic/if",
"nextName": "Variables",
"nextPath": "/blocks/variables"
}
],
"path": "/blocks/logic",
"prevName": "while",
"prevPath": "/blocks/loops/while",
"nextName": "if",
"nextPath": "/blocks/logic/if"
},
{
"name": "Variables",
"subitems": [
{
"name": "assign",
"subitems": [],
"path": "/blocks/variables/assign",
"prevName": "Variables",
"prevPath": "/blocks/variables",
"nextName": "change var",
"nextPath": "/blocks/variables/change"
},
{
"name": "change var",
"subitems": [],
"path": "/blocks/variables/change",
"prevName": "assign",
"prevPath": "/blocks/variables/assign",
"nextName": "var",
"nextPath": "/blocks/variables/var"
},
{
"name": "var",
"subitems": [],
"path": "/blocks/variables/var",
"prevName": "change var",
"prevPath": "/blocks/variables/change",
"nextName": "Math",
"nextPath": "/blocks/math"
}
],
"path": "/blocks/variables",
"prevName": "Boolean",
"prevPath": "/blocks/logic/boolean",
"nextName": "assign",
"nextPath": "/blocks/variables/assign"
},
{
"name": "Math",
"subitems": [],
"path": "/blocks/math",
"prevName": "var",
"prevPath": "/blocks/variables/var",
"nextName": "JavaScript blocks",
"nextPath": "/blocks/javascript-blocks"
},
{
"name": "JavaScript blocks",
"subitems": [],
"path": "/blocks/javascript-blocks",
"prevName": "Math",
"prevPath": "/blocks/math",
"nextName": "Custom blocks",
"nextPath": "/blocks/custom"
},
{
"name": "Custom blocks",
"subitems": [],
"path": "/blocks/custom",
"prevName": "JavaScript blocks",
"prevPath": "/blocks/javascript-blocks",
"nextName": "JavaScript",
"nextPath": "/javascript"
}
],
"path": "/blocks",
"nextName": "On Start",
"nextPath": "/blocks/on-start"
},
{
"name": "JavaScript",
"subitems": [
{
"name": "Calling",
"subitems": [],
"path": "/javascript/call",
"prevName": "JavaScript",
"prevPath": "/javascript",
"nextName": "Sequencing",
"nextPath": "/javascript/sequence"
},
{
"name": "Sequencing",
"subitems": [],
"path": "/javascript/sequence",
"prevName": "Calling",
"prevPath": "/javascript/call",
"nextName": "Variables",
"nextPath": "/javascript/variables"
},
{
"name": "Variables",
"subitems": [],
"path": "/javascript/variables",
"prevName": "Sequencing",
"prevPath": "/javascript/sequence",
"nextName": "Operators",
"nextPath": "/javascript/operators"
},
{
"name": "Operators",
"subitems": [],
"path": "/javascript/operators",
"prevName": "Variables",
"prevPath": "/javascript/variables",
"nextName": "Statements",
"nextPath": "/javascript/statements"
},
{
"name": "Statements",
"subitems": [],
"path": "/javascript/statements",
"prevName": "Operators",
"prevPath": "/javascript/operators",
"nextName": "Functions",
"nextPath": "/javascript/functions"
},
{
"name": "Functions",
"subitems": [],
"path": "/javascript/functions",
"prevName": "Statements",
"prevPath": "/javascript/statements",
"nextName": "Types",
"nextPath": "/javascript/types"
},
{
"name": "Types",
"subitems": [],
"path": "/javascript/types",
"prevName": "Functions",
"prevPath": "/javascript/functions",
"nextName": "Classes",
"nextPath": "/javascript/classes"
},
{
"name": "Classes",
"subitems": [],
"path": "/javascript/classes",
"prevName": "Types",
"prevPath": "/javascript/types",
"nextName": "Interfaces",
"nextPath": "/javascript/interfaces"
},
{
"name": "Interfaces",
"subitems": [],
"path": "/javascript/interfaces",
"prevName": "Classes",
"prevPath": "/javascript/classes",
"nextName": "Generics",
"nextPath": "/javascript/generics"
},
{
"name": "Generics",
"subitems": [],
"path": "/javascript/generics",
"prevName": "Interfaces",
"prevPath": "/javascript/interfaces",
"nextName": "Types",
"nextPath": "/types"
}
],
"path": "/javascript",
"prevName": "Custom blocks",
"prevPath": "/blocks/custom",
"nextName": "Calling",
"nextPath": "/javascript/call"
},
{
"name": "Types",
"subitems": [
{
"name": "Number",
"subitems": [],
"path": "/types/number",
"prevName": "Types",
"prevPath": "/types",
"nextName": "String",
"nextPath": "/types/string"
},
{
"name": "String",
"subitems": [],
"path": "/types/string",
"prevName": "Number",
"prevPath": "/types/number",
"nextName": "Boolean",
"nextPath": "/types/boolean"
},
{
"name": "Boolean",
"subitems": [],
"path": "/types/boolean",
"prevName": "String",
"prevPath": "/types/string",
"nextName": "Array",
"nextPath": "/types/array"
},
{
"name": "Array",
"subitems": [],
"path": "/types/array",
"prevName": "Boolean",
"prevPath": "/types/boolean",
"nextName": "Function",
"nextPath": "/types/function"
},
{
"name": "Function",
"subitems": [],
"path": "/types/function",
"prevName": "Array",
"prevPath": "/types/array",
"nextName": "Support",
"nextPath": "/support"
}
],
"path": "/types",
"prevName": "Generics",
"prevPath": "/javascript/generics",
"nextName": "Number",
"nextPath": "/types/number"
},
{
"name": "",
"subitems": [
{
"name": "Support",
"subitems": [],
"path": "/support",
"prevName": "Function",
"prevPath": "/types/function",
"nextName": "FAQ",
"nextPath": "/faq"
},
{
"name": "FAQ",
"subitems": [],
"path": "/faq",
"prevName": "Support",
"prevPath": "/support",
"nextName": "Translate",
"nextPath": "/translate"
},
{
"name": "Translate",
"subitems": [],
"path": "/translate",
"prevName": "FAQ",
"prevPath": "/faq",
"nextName": "Sharing projects",
"nextPath": "/share"
},
{
"name": "Sharing projects",
"subitems": [],
"path": "/share",
"prevName": "Translate",
"prevPath": "/translate",
"nextName": "Offline support",
"nextPath": "/offline"
},
{
"name": "Offline support",
"subitems": [],
"path": "/offline",
"prevName": "Sharing projects",
"prevPath": "/share",
"nextName": "Streaming",
"nextPath": "/streaming"
},
{
"name": "Streaming",
"subitems": [],
"path": "/streaming",
"prevName": "Offline support",
"prevPath": "/offline",
"nextName": "Command Line Interface",
"nextPath": "/cli"
}
],
"prevName": "Function",
"prevPath": "/types/function"
},
{
"name": "",
"subitems": [
{
"name": "Command Line Interface",
"subitems": [],
"path": "/cli",
"prevName": "Streaming",
"prevPath": "/streaming",
"nextName": "Visual Studio Code support",
"nextPath": "/code"
},
{
"name": "Visual Studio Code support",
"subitems": [],
"path": "/code",
"prevName": "Command Line Interface",
"prevPath": "/cli",
"nextName": "Coding on Raspberry Pi",
"nextPath": "/raspberry-pi"
},
{
"name": "Coding on Raspberry Pi",
"subitems": [],
"path": "/raspberry-pi",
"prevName": "Visual Studio Code support",
"prevPath": "/code"
}
],
"prevName": "Streaming",
"prevPath": "/streaming"
}
],
"embedUrl": "http://labaixbidouille.github.io/pxt-robotdulab/",
"id": "stm32iotnode",
"title": "STM32 IoT Node MakeCode Editor",
"name": "STM32 IoT Node",
"description": "A Blocks / JavaScript code editor for the STM32 IoT Node powered by Microsoft MakeCode.",
"htmlDocIncludes": {}
},
"blocksprj": {
"id": "blocksprj",
"config": {
"name": "{0}",
"dependencies": {
"core": "*"
},
"description": "",
"files": [
"main.blocks",
"main.ts",
"README.md"
]
},
"files": {
"README.md": " ",
"main.blocks": "<xml xmlns=\"http://www.w3.org/1999/xhtml\">\n</xml>",
"main.ts": " "
}
},
"tsprj": {
"id": "tsprj",
"config": {
"name": "{0}",
"dependencies": {
"core": "*"
},
"description": "",
"files": [
"main.ts",
"README.md"
]
},
"files": {
"README.md": " ",
"main.ts": " "
}
},
"bundledpkgs": {
"core": {
"README.md": "# basic\n\nAdd your docs here...",
"enums.d.ts": "// Auto-generated. Do not edit.\n\n\n /** Couleurs */\n\n declare const enum Color\n {\n NOIR = (0),\n ROUGE = (1),\n VERT = (2),\n MAGENTA = (3),\n BLEU = (4),\n BLANC = (5),\n TURQUOISE = (6),\n JAUNE = (7),\n VIOLET = (8),\n }\n\n\n /** Sens de rotation servomoteur */\n\n declare const enum Direction\n {\n //% block=\"left\"\n LEFT = 0,\n //% block=\"right\"\n RIGHT = 1,\n }\n\n\n /** Gestion de l'anneau de LED */\n\n declare const enum TypeAnimationLED\n {\n COULEUR = (1),\n ARC_EN_CIEL = (2),\n ARC_EN_CIEL_CYCLIQUE = (3),\n COULEUR_CYCLIQUE = (4),\n }\n\n// Auto-generated. Do not edit. Really.\n",
"ns.ts": "/**\n * Basic functionalities.\n */\n//% color=#00BCD4 weight=100 \nnamespace robotdulab {\n\n}\n\n/**\n * Control flow\n */\n//% color=#FF5722 weight=90\nnamespace control {\n\n}\n",
"pxt-core.d.ts": "/// <reference no-default-lib=\"true\"/>\n\ninterface Array<T> {\n /**\n * Get or set the length of an array. This number is one more than the index of the last element the array.\n */\n //% shim=Array_::length weight=84\n //% blockId=\"lists_length\" block=\"length of %VALUE\" blockBuiltin=true blockNamespace=\"arrays\"\n length: number;\n\n /**\n * Append a new element to an array.\n * @param items New elements of the Array.\n */\n //% help=arrays/push\n //% shim=Array_::push weight=49\n //% blockId=\"array_push\" block=\"%list| add value %value| to end\" blockNamespace=\"arrays\"\n push(item: T): void;\n\n /**\n * Remove the last element from an array and return it.\n */\n //% help=arrays/pop\n //% shim=Array_::pop weight=48\n //% blockId=\"array_pop\" block=\"get and remove last value from %list\" blockNamespace=\"arrays\"\n pop(): T;\n\n /**\n * Reverse the elements in an array. The first array element becomes the last, and the last array element becomes the first.\n */\n //% help=arrays/reverse\n //% helper=arrayReverse weight=10 advanced=true\n //% blockId=\"array_reverse\" block=\"reverse %list\" blockNamespace=\"arrays\"\n reverse(): void;\n\n /**\n * Remove the first element from an array and return it. This method changes the length of the array.\n */\n //% help=arrays/shift\n //% helper=arrayShift weight=70 advanced=true\n //% blockId=\"array_shift\" block=\"get and remove first value from %list\" blockNamespace=\"arrays\"\n shift(): T;\n\n /**\n * Add one element to the beginning of an array and return the new length of the array.\n * @param element to insert at the start of the Array.\n */\n //% help=arrays/unshift\n //% helper=arrayUnshift weight=69 advanced=true\n //% blockId=\"array_unshift\" block=\"%list| insert %value| at beginning\" blockNamespace=\"arrays\"\n //unshift(...values:T[]): number; //rest is not supported in our compiler yet.\n unshift(value: T): number;\n\n /**\n * Return a section of an array.\n * @param start The beginning of the specified portion of the array. eg: 0\n * @param end The end of the specified portion of the array. eg: 0\n */\n //% help=arrays/slice\n //% helper=arraySlice weight=41 advanced=true blockNamespace=\"arrays\"\n slice(start: number, end: number): T[];\n\n /**\n * Remove elements from an array.\n * @param start The zero-based location in the array from which to start removing elements. eg: 0\n * @param deleteCount The number of elements to remove. eg: 0\n */\n //% helper=arraySplice weight=40\n splice(start: number, deleteCount: number): void;\n\n /**\n * Sort the elements of an array in place and returns the array. The sort is not necessarily stable.\n * @param specifies a function that defines the sort order. If omitted, the array is sorted according to the prmitive type\n */\n //% helper=arraySort weight=40\n sort(callbackfn?: (value1: T, value2: T) => number): T[];\n\n /**\n * Call a defined callback function on each element of an array, and return an array containing the results.\n * @param callbackfn A function that accepts up to two arguments. The map method calls the callbackfn function one time for each element in the array.\n */\n //% helper=arrayMap weight=40\n map<U>(callbackfn: (value: T, index: number) => U): U[];\n\n /**\n * Return the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to two arguments. The filter method calls the callbackfn function one time for each element in the array.\n */\n //% helper=arrayFilter weight=40\n filter(callbackfn: (value: T, index: number) => boolean): T[];\n\n /**\n * Call the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to three arguments. The reduce method calls the callbackfn function one time for each element in the array.\n * @param initialValue Initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n */\n //% helper=arrayReduce weight=40\n reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number) => U, initialValue: U): U;\n\n\n /** Remove the first occurence of an object. Returns true if removed. */\n //% shim=Array_::removeElement weight=48\n removeElement(element: T): boolean;\n\n /** Remove the element at a certain index. */\n //% help=arrays/remove-at\n //% shim=Array_::removeAt weight=49 advanced=true\n //% blockId=\"array_removeat\" block=\"%list| remove value at %index\" blockNamespace=\"arrays\"\n removeAt(index: number): T;\n\n /**\n * Insert the value at a particular index, increases length by 1\n * @param index the zero-based position in the list to insert the value, eg: 0\n * @param the value to insert, eg: 0\n */\n //% help=arrays/insert-at\n //% shim=Array_::insertAt weight=84 advanced=true\n //% blockId=\"array_insertAt\" block=\"%list| insert at %index| value %value\" blockNamespace=\"arrays\"\n insertAt(index: number, value: T): void;\n\n /**\n * Return the index of the first occurrence of a value in an array.\n * @param item The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\n */\n //% help=arrays/index-of\n //% shim=Array_::indexOf weight=50 advanced=true\n //% blockId=\"array_indexof\" block=\"%list| find index of %value\" blockNamespace=\"arrays\"\n indexOf(item: T, fromIndex?: number): number;\n\n /**\n * Get the value at a particular index\n * @param index the zero-based position in the list of the item, eg: 0\n */\n //% help=arrays/get\n //% shim=Array_::getAt weight=85\n get(index: number): T;\n\n /**\n * Store a value at a particular index\n * @param index the zero-based position in the list to store the value, eg: 0\n * @param the value to insert, eg: 0\n */\n //% help=arrays/set\n //% shim=Array_::setAt weight=84\n set(index: number, value: T): void;\n\n [n: number]: T;\n}\n\ndeclare interface String {\n // This block is currently disabled in favor of the built-in Blockly \"Create text with\" block, which compiles to \"\" + \"\"\n // Add % sign back to the block annotation to re-enable\n /**\n * Returns a string that contains the concatenation of two or more strings.\n * @param other The string to append to the end of the string.\n */\n //% shim=String_::concat weight=49\n //% blockId=\"string_concat\" blockNamespace=\"text\"\n // block=\"join %list=text|%other\"\n concat(other: string): string;\n\n /**\n * Return the character at the specified index.\n * @param index The zero-based index of the desired character.\n */\n //% shim=String_::charAt weight=48\n //% help=text/char-at\n //% blockId=\"string_get\" block=\"char from %this=text|at %pos\" blockNamespace=\"text\"\n charAt(index: number): string;\n\n /** Returns the length of a String object. */\n //% property shim=String_::length weight=47\n //% blockId=\"text_length\" block=\"length of %VALUE\" blockBuiltin=true blockNamespace=\"text\"\n length: number;\n\n /**\n * Return the Unicode value of the character at the specified location.\n * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned.\n */\n //% shim=String_::charCodeAt\n charCodeAt(index: number): number;\n\n /**\n * See how the order of characters in two strings is different (in ASCII encoding).\n * @param that String to compare to target string\n */\n //% shim=String_::compare\n //% help=text/compare\n //% blockId=\"string_compare\" block=\"compare %this=text| to %that\" blockNamespace=\"text\"\n compare(that: string): number;\n\n /**\n * Return a substring of the current string.\n * @param start first character index; can be negative from counting from the end, eg:0\n * @param length number of characters to extract\n */\n //% shim=String_::substr length.defl=1000000\n //% help=text/substr\n //% blockId=\"string_substr\" block=\"substring of %this=text|from %start|of length %length\" blockNamespace=\"text\"\n substr(start: number, length?: number): string;\n\n // This block is currently disabled, as it does not compile in some targets\n // Add % sign back to the block annotation to re-enable\n /** Returns a value indicating if the string is empty */\n //% shim=String_::isEmpty\n //% blockId=\"string_isempty\" blockNamespace=\"text\"\n // block=\"%this=text| is empty\"\n isEmpty(): boolean;\n\n [index: number]: string;\n}\n\n/**\n * Convert a string to an integer.\n * @param s A string to convert into a number.\n */\n//% shim=String_::toNumber\n//% help=text/parse-int\n//% blockId=\"string_parseint\" block=\"parse to integer %text\" blockNamespace=\"text\"\ndeclare function parseInt(text: string): number;\n\ninterface Object { }\ninterface Function { }\ninterface IArguments { }\ninterface RegExp { }\n\ntype uint8 = number;\ntype uint16 = number;\ntype uint32 = number;\ntype int8 = number;\ntype int16 = number;\ntype int32 = number;\n\n\ndeclare interface Boolean {\n /**\n * Returns a string representation of an object.\n */\n //% shim=Boolean_::toString\n toString(): string;\n}\n\n/**\n * Combine, split, and search text strings.\n*/\n//% blockNamespace=\"Text\"\ndeclare namespace String {\n\n /**\n * Make a string from the given ASCII character code.\n */\n //% help=math/string-from-char-code\n //% shim=String_::fromCharCode\n //% weight=0\n //% blockNamespace=\"Math\" blockId=\"stringFromCharCode\" block=\"text from char code %code\" weight=1\n function fromCharCode(code: number): string;\n}\n\ndeclare interface Number {\n /**\n * Returns a string representation of a number.\n */\n //% shim=Number_::toString\n toString(): string;\n}\n\n/**\n * Add, remove, and replace items in lists.\n*/\n//% blockNamespace=\"Arrays\"\ndeclare namespace Array {\n}\n\n/**\n * More complex operations with numbers.\n*/\ndeclare namespace Math {\n /**\n * Returns the value of a base expression taken to a specified power.\n * @param x The base value of the expression.\n * @param y The exponent value of the expression.\n */\n //% shim=Math_::pow\n function pow(x: number, y: number): number;\n\n /**\n * Returns a pseudorandom number between 0 and 1.\n */\n //% shim=Math_::random\n //% helpUrl=\"/reference/math/random\"\n function random(): number;\n\n /**\n * Returns a pseudorandom number between min and max included. \n * If both numbers are integral, the result is integral.\n * @param min the lower inclusive bound, eg: 0\n * @param max the upper inclusive bound, eg: 10\n */\n //% blockId=\"device_random\" block=\"pick random %min|to %limit\"\n //% helpUrl=\"/reference/math/random-range\"\n //% shim=Math_::randomRange\n function randomRange(min: number, max: number): number;\n\n /**\n * Returns the natural logarithm (base e) of a number.\n * @param x A number\n */\n //% shim=Math_::log\n function log(x: number): number;\n\n /**\n * Returns returns ``e^x``.\n * @param x A number\n */\n //% shim=Math_::exp\n function exp(x: number): number;\n\n /**\n * Returns the sine of a number.\n * @param x An angle in radians\n */\n //% shim=Math_::sin\n function sin(x: number): number;\n\n /**\n * Returns the cosine of a number.\n * @param x An angle in radians\n */\n //% shim=Math_::cos\n function cos(x: number): number;\n\n /**\n * Returns the tangent of a number.\n * @param x An angle in radians\n */\n //% shim=Math_::tan\n function tan(x: number): number;\n\n /**\n * Returns the arcsine (in radians) of a number\n * @param x A number\n */\n //% shim=Math_::asin\n function asin(x: number): number;\n\n /**\n * Returns the arccosine (in radians) of a number\n * @param x A number\n */\n //% shim=Math_::acos\n function acos(x: number): number;\n\n /**\n * Returns the arctangent (in radians) of a number\n * @param x A number\n */\n //% shim=Math_::atan\n function atan(x: number): number;\n\n /**\n * Returns the arctangent of the quotient of its arguments.\n * @param y A number\n * @param x A number\n */\n //% shim=Math_::atan2\n function atan2(y: number, x: number): number;\n\n /**\n * Returns the square root of a number.\n * @param x A numeric expression.\n */\n //% shim=Math_::sqrt\n function sqrt(x: number): number;\n\n /**\n * Returns the smallest number greater than or equal to its numeric argument.\n * @param x A numeric expression.\n */\n //% shim=Math_::ceil\n function ceil(x: number): number;\n\n /**\n * Returns the greatest number less than or equal to its numeric argument.\n * @param x A numeric expression.\n */\n //% shim=Math_::floor\n function floor(x: number): number;\n\n /**\n * Returns the number with the decimal part truncated.\n * @param x A numeric expression.\n */\n //% shim=Math_::trunc\n function trunc(x: number): number;\n\n /**\n * Returns a supplied numeric expression rounded to the nearest number.\n * @param x The value to be rounded to the nearest number.\n */\n //% shim=Math_::round\n function round(x: number): number;\n\n /**\n * Returns the value of integer signed 32 bit multiplication of two numbers.\n * @param x The first number\n * @param y The second number\n */\n //% shim=Math_::imul\n function imul(x: number, y: number): number;\n\n /**\n * Returns the value of integer signed 32 bit division of two numbers.\n * @param x The first number\n * @param y The second number\n */\n //% shim=Math_::idiv\n function idiv(x: number, y: number): number;\n}\n",
"pxt-helpers.ts": "type Action = () => void;\n\nnamespace helpers {\n export function arraySplice<T>(arr: T[], start: number, len: number) {\n if (start < 0) {\n return;\n }\n for (let i = 0; i < len; ++i) {\n arr.removeAt(start)\n }\n }\n\n export function arrayReverse<T>(arr: T[]): void {\n let len = arr.length;\n for (let i = 0; i < len / 2; i++) {\n swap(arr, i, len - i - 1);\n }\n }\n\n export function arrayShift<T>(arr: T[]): T {\n return arr.removeAt(0);\n }\n\n /*TODO: Enable this multiple value unshift, after rest is enabled in our compiler.\n export function arrayUnshift<T>(arr: T[], ...values: T[]) : number {\n for(let i = values.length; i > 0; --i) {\n arr.insertAt(0, values[i - 1]);\n }\n return arr.length;\n }\n */\n export function arrayUnshift<T>(arr: T[], value: T): number {\n arr.insertAt(0, value);\n return arr.length;\n }\n\n function swap<T>(arr: T[], i: number, j: number): void {\n let temp: T = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n }\n\n function sortHelper<T>(arr: T[], callbackfn?: (value1: T, value2: T) => number): T[] {\n if (arr.length <= 0 || !callbackfn) {\n return arr;\n }\n let len = arr.length;\n // simple selection sort.\n for (let i = 0; i < len - 1; ++i) {\n for (let j = i + 1; j < len; ++j) {\n if (callbackfn(arr[i], arr[j]) > 0) {\n swap(arr, i, j);\n }\n }\n }\n return arr;\n }\n\n export function arraySort<T>(arr: T[], callbackfn?: (value1: T, value2: T) => number): T[] {\n if (!callbackfn) {\n //TODO: support native strings and number sorting\n /* callbackfn = function (value1: string, value2: string) : number {\n return value1.compare(value2);\n }*/\n }\n return sortHelper(arr, callbackfn);\n }\n\n export function arrayMap<T, U>(arr: T[], callbackfn: (value: T, index: number) => U): U[] {\n let res: U[] = []\n let len = arr.length // caching this seems to match V8\n for (let i = 0; i < len; ++i) {\n res.push(callbackfn(arr[i], i))\n }\n return res\n }\n\n export function arrayFilter<T>(arr: T[], callbackfn: (value: T, index: number) => boolean): T[] {\n let res: T[] = []\n let len = arr.length\n for (let i = 0; i < len; ++i) {\n let v = arr[i] // need to cache\n if (callbackfn(v, i)) res.push(v)\n }\n return res\n }\n\n export function arrayReduce<T, U>(arr: T[], callbackfn: (previousValue: U, currentValue: T, currentIndex: number) => U, initialValue: U): U {\n let len = arr.length\n for (let i = 0; i < len; ++i) {\n initialValue = callbackfn(initialValue, arr[i], i)\n }\n return initialValue\n }\n\n export function arraySlice<T>(arr: T[], start: number, end: number): T[] {\n const res: T[] = [];\n const len = arr.length;\n\n if (start < 0) {\n start = Math.max(len + start, 0);\n }\n\n if (end < 0) {\n end = len + end;\n }\n\n const sliceLength = end - start;\n\n for (let i = 0; i < sliceLength; ++i) {\n const index = i + start;\n if (index >= len) {\n break;\n }\n res.push(arr[index]);\n }\n return res;\n }\n}\n\nnamespace Math {\n export function clamp(min: number, max: number, value: number): number {\n return Math.min(max, Math.max(min, value));\n }\n\n /**\n * Returns the absolute value of a number (the value without regard to whether it is positive or negative).\n * For example, the absolute value of -5 is the same as the absolute value of 5.\n * @param x A numeric expression for which the absolute value is needed.\n */\n export function abs(x: number): number {\n return x < 0 ? -x : x;\n }\n\n /**\n * Returns the sign of the x, indicating whether x is positive, negative or zero.\n * @param x The numeric expression to test\n */\n export function sign(x: number): number {\n if (x == 0) return 0;\n if (x > 0) return 1;\n return -1;\n }\n\n /**\n * Returns the larger of two supplied numeric expressions.\n */\n export function max(a: number, b: number): number {\n if (a >= b) return a;\n return b;\n }\n\n /**\n * Returns the smaller of two supplied numeric expressions.\n */\n export function min(a: number, b: number): number {\n if (a <= b) return a;\n return b;\n }\n}\n",
"pxt.json": "{\n \"name\": \"core\",\n \"description\": \"A STM32 target for PXT\",\n \"files\": [\n \"README.md\",\n \"pxt-core.d.ts\",\n \"pxt-helpers.ts\",\n \"robotdulab.h\",\n \"robotdulab.cpp\",\n \"enums.d.ts\",\n \"sims.d.ts\",\n \"shims.d.ts\",\n \"ns.ts\"\n ],\n \"testFiles\": [\n \"test.ts\"\n ],\n \"public\": true,\n \"dependencies\": {}\n}",
"robotdulab.cpp": "#include \"pxt.h\"\n#include \"robotdulab.h\"\n\nRobotDuLAB robotDuLAB();\n\nnamespace robotdulab {\n\n/**\n* Move forward the robot\n*\n* @param time Duration of the move\n*/\n//% blockId=robotdulab_move_forward block=\"move forward %time\" \n//% parts=\"robotdulab\"\nvoid moveForward(int time) {\n}\n\n/**\n* Move backward the robot\n*\n* @param time Duration of the move\n*/\n//% blockId=robotdulab_move_backward block=\"move backward %time\"\n//% parts=\"robotdulab\"\nvoid moveBackward(int time) {\n}\n\n\n\n/**\n* Turn the robot\n* @param direction the direction to turn, eg: Direction.Left\n* @param angle degrees to turn, eg:90\n*/\n//% weight=85\n//% blockId=robotdulab_turn block=\"turn %direction|by %angle degrees\"\nvoid turn(Direction direction, int angle){\n\n}\n\n\n/**\n* Get the distance from obstacle in front of the robot\n*/\n//% blockId=robotdulab_get_distance block=\"get distance in cm\"\nint getDistance(){\n return 0;\n}\n\n}",
"robotdulab.h": "/*\n * Copyright (C) 2008 Laboratoire d'Aix-périmentation et de Bidouille\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software< /span>\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n #ifndef _ROBOTDULAB_H_\n #define _ROBOTDULAB_H_\n \n /** Constants */\n \n /** Couleurs */\n enum class Color\n {\n NOIR = (0), \n ROUGE = (1), \n VERT = (2), \n MAGENTA = (3), \n BLEU = (4), \n BLANC = (5), \n TURQUOISE= (6), \n JAUNE = (7), \n VIOLET = (8), \n };\n \n /** Sens de rotation servomoteur */\nenum class Direction\n {\n//% block=\"left\"\nLEFT,\n//% block=\"right\"\nRIGHT\n };\n \n /** Gestion de l'anneau de LED */\n \n const int NB_LED = 16;\n \n enum class TypeAnimationLED\n {\n COULEUR = (1),\n ARC_EN_CIEL = (2),\n ARC_EN_CIEL_CYCLIQUE = (3),\n COULEUR_CYCLIQUE = (4),\n };\n \n \n \n class RobotDuLAB {\n \n public:\n \n // Constructor(s)\n RobotDuLAB() {}\n \n virtual ~RobotDuLAB() {}\n \n void begin();\n \n void Arreter();\n \n void Avancer();\n \n void Reculer();\n \n void TournerAGauche();\n \n void TournerADroite();\n \n void AnimerAnneauLed(choix_animation_anneau_led_t choix, couleur_index_t couleur);\n \n long getDistanceObstacle();\n \n private:\n void MettreEnMouvement(sens_rotation_t sensRoueDroite, sens_rotation_t sensRoueGauche);\n \n void eteindreAnneauDeLed();\n \n long microsecondsEnCentimetres(long microseconds)\n {\n // The speed of sound is 340 m/s or 29 microseconds per centimeter.\n // The ping travels out and back, so to find the distance of the\n // object we take half of the distance travelled.\n return microseconds / 29 / 2;\n }\n };\n \n #endif /* _ROBOTDULAB_H_ */",
"shims.d.ts": "// Auto-generated. Do not edit.\ndeclare namespace robotdulab {\n\n /**\n * Move forward the robot\n *\n * @param time Duration of the move\n */\n //% blockId=robotdulab_move_forward block=\"move forward %time\" \n //% parts=\"robotdulab\" shim=robotdulab::moveForward\n function moveForward(time: int32): void;\n\n /**\n * Move backward the robot\n *\n * @param time Duration of the move\n */\n //% blockId=robotdulab_move_backward block=\"move backward %time\"\n //% parts=\"robotdulab\" shim=robotdulab::moveBackward\n function moveBackward(time: int32): void;\n\n /**\n * Turn the robot\n * @param direction the direction to turn, eg: Direction.Left\n * @param angle degrees to turn, eg:90\n */\n //% weight=85\n //% blockId=robotdulab_turn block=\"turn %direction|by %angle degrees\" shim=robotdulab::turn\n function turn(direction: Direction, angle: int32): void;\n\n /**\n * Get the distance from obstacle in front of the robot\n */\n //% blockId=robotdulab_get_distance block=\"get distance in cm\" shim=robotdulab::getDistance\n function getDistance(): int32;\n}\n\n// Auto-generated. Do not edit. Really.\n",
"sims.d.ts": "// Auto-generated from simulator. Do not edit.\ndeclare namespace robotdulab {\n /**\n * Moves the sprite forward\n * @param steps number of steps to move, eg: 1\n */\n //% weight=90\n //% block\n //% shim=robotdulab::forwardAsync promise\n function forward(steps: number): void;\n\n /**\n * Moves the sprite forward\n * @param direction the direction to turn, eg: Direction.Left\n * @param angle degrees to turn, eg:90\n */\n //% weight=85\n //% blockId=RobotDuLabTurn block=\"turn %direction|by %angle degrees\"\n //% shim=robotdulab::turnAsync promise\n function turn(direction: Direction, angle: number): void;\n\n}\ndeclare namespace loops {\n /**\n * Repeats the code forever in the background. On each iteration, allows other code to run.\n * @param body the code to repeat\n */\n //% help=functions/forever weight=55 blockGap=8\n //% blockId=device_forever block=\"forever\"\n //% shim=loops::forever\n function forever(body: () => void): void;\n\n /**\n * Pause for the specified time in milliseconds\n * @param ms how long to pause for, eg: 100, 200, 500, 1000, 2000\n */\n //% help=functions/pause weight=54\n //% block=\"pause (ms) %pause\" blockId=device_pause\n //% shim=loops::pauseAsync promise\n function pause(ms: number): void;\n\n}\ndeclare namespace console {\n /**\n * Print out message\n */\n //%\n //% shim=console::log\n function log(msg: string): void;\n\n}\n /**\n * A ghost on the screen.\n */\n //%\n declare class Sprite {\n /**\n * The X-coordiante\n */\n //%\n //% shim=.x\n public x: number;\n\n /**\n * The Y-coordiante\n */\n //%\n //% shim=.y\n public y: number;\n\n /**\n * Move the thing forward\n */\n //%\n //% shim=.forwardAsync promise\n public forward(steps: number): void;\n\n }\n\n// Auto-generated. Do not edit. Really.\n",
"test.ts": ""
}
},
"compile": {
"isNative": false,
"hasHex": false,
"floatingPoint": true
},
"versions": {
"target": "1.0.0",
"pxt": "2.0.31"
}
}