diff --git a/pxtarget.json b/pxtarget.json
index dfc84806..f7d9bd73 100644
--- a/pxtarget.json
+++ b/pxtarget.json
@@ -87,6 +87,95 @@
"bluetooth": true,
"thermometer": true,
"compass": true
+ },
+ "boardDefinition": {
+ "visual": "microbit",
+ "gpioPinBlocks": [
+ [
+ "P0"
+ ],
+ [
+ "P1"
+ ],
+ [
+ "P2"
+ ],
+ [
+ "P3"
+ ],
+ [
+ "P4",
+ "P5",
+ "P6",
+ "P7"
+ ],
+ [
+ "P8",
+ "P9",
+ "P10",
+ "P11",
+ "P12"
+ ],
+ [
+ "P16"
+ ]
+ ],
+ "gpioPinMap": {
+ "P0": "P0",
+ "P1": "P1",
+ "P2": "P2",
+ "P3": "P3",
+ "P4": "P4",
+ "P5": "P5",
+ "P6": "P6",
+ "P7": "P7",
+ "P8": "P8",
+ "P9": "P9",
+ "P10": "P10",
+ "P11": "P11",
+ "P12": "P12",
+ "P13": "P13",
+ "P14": "P14",
+ "P15": "P15",
+ "P16": "P16",
+ "P19": "P19",
+ "P20": "P20"
+ },
+ "spiPins": {
+ "MOSI": "P15",
+ "MISO": "P14",
+ "SCK": "P13"
+ },
+ "i2cPins": {
+ "SDA": "P20",
+ "SCL": "P19"
+ },
+ "analogInPins": [
+ "P0",
+ "P1",
+ "P2",
+ "P3",
+ "P10"
+ ],
+ "groundPins": [
+ "GND"
+ ],
+ "threeVoltPins": [
+ "+3v3"
+ ],
+ "attachPowerOnRight": true,
+ "onboardComponents": [
+ "buttonpair",
+ "ledmatrix",
+ "speaker"
+ ],
+ "useCrocClips": true,
+ "marginWhenBreadboarding": [
+ 0,
+ 0,
+ 80,
+ 0
+ ]
}
},
"compileService": {
diff --git a/sim/dalboard.ts b/sim/dalboard.ts
index 6049ebf8..1899b481 100644
--- a/sim/dalboard.ts
+++ b/sim/dalboard.ts
@@ -92,10 +92,9 @@ namespace pxsim {
const options = (msg.options || {}) as RuntimeOptions;
- const boardDef = CURRENT_BOARD; //TODO: read from pxt.json/pxttarget.json
-
+ const boardDef = msg.boardDefinition;
const cmpsList = msg.parts;
- const cmpDefs = msg.partDefinitions || {}; //TODO: read from pxt.json/pxttarget.json
+ const cmpDefs = msg.partDefinitions || {};
const fnArgs = msg.fnArgs;
const opts : visuals.BoardHostOpts = {
diff --git a/sim/definitions.ts b/sim/definitions.ts
deleted file mode 100644
index b48976e3..00000000
--- a/sim/definitions.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-///
-///
-///
-///
-///
-
-namespace pxsim {
- export const MICROBIT_DEF: BoardDefinition = {
- visual: "microbit",
- gpioPinBlocks: [
- ["P0"], ["P1"], ["P2"],
- ["P3"],
- ["P4", "P5", "P6", "P7"],
- ["P8", "P9", "P10", "P11", "P12"],
- ["P16"],
- ],
- gpioPinMap: {
- "P0": "P0",
- "P1": "P1",
- "P2": "P2",
- "P3": "P3",
- "P4": "P4",
- "P5": "P5",
- "P6": "P6",
- "P7": "P7",
- "P8": "P8",
- "P9": "P9",
- "P10": "P10",
- "P11": "P11",
- "P12": "P12",
- "P13": "P13",
- "P14": "P14",
- "P15": "P15",
- "P16": "P16",
- "P19": "P19",
- "P20": "P20",
- },
- spiPins: {
- MOSI: "P15",
- MISO: "P14",
- SCK: "P13",
- },
- i2cPins: {
- SDA: "P20",
- SCL: "P19",
- },
- analogInPins: ["P0", "P1", "P2", "P3", "P10"],
- groundPins: ["GND"],
- threeVoltPins: ["+3v3"],
- attachPowerOnRight: true,
- onboardComponents: ["buttonpair", "ledmatrix", "speaker"],
- useCrocClips: true,
- marginWhenBreadboarding: [0, 0, 80, 0],
- }
-
-
- //TODO: add multiple board support
- export const CURRENT_BOARD = MICROBIT_DEF;
-}
\ No newline at end of file
diff --git a/sim/instructions.ts b/sim/instructions.ts
index 9a226073..71f7eec3 100644
--- a/sim/instructions.ts
+++ b/sim/instructions.ts
@@ -615,6 +615,9 @@ ${tsPackage}
});
}
+ // board def
+ const boardDef = JSON.parse(getQsVal("board")) as pxsim.BoardDefinition;
+
//parts list
let parts = (getQsVal("parts") || "").split(" ");
parts.sort();
@@ -638,7 +641,6 @@ ${tsPackage}
style.textContent += STYLE;
- const boardDef = CURRENT_BOARD;
const cmpDefs = partDefinitions;
//props
diff --git a/sim/microbit.ts b/sim/visuals/microbit.ts
similarity index 100%
rename from sim/microbit.ts
rename to sim/visuals/microbit.ts