removing external boards
This commit is contained in:
parent
90da72a8de
commit
4c27d62796
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<svg viewBox="0 0 1000 762" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<defs>
|
|
||||||
<pattern id="pattern-1" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse" viewBox="0 0 100 100">
|
|
||||||
<path d="M 0 0 L 50 0 L 50 100 L 0 100 Z" style="fill: black;"/>
|
|
||||||
</pattern>
|
|
||||||
</defs>
|
|
||||||
<path d="M 35.991 584.105 L 34.935 502.071 L 13.194 501.812 C 10.347 491.977 2.323 491.459 2.323 491.459 L 2.323 401.648 C 13.193 401.39 12.677 389.743 12.677 389.743 L 31.053 389.743 L 30.535 276.897 L 10.605 276.638 C 9.57 267.579 2.582 266.803 2.582 266.803 L 2.323 175.18 C 10.346 173.109 10.088 164.309 10.088 164.309 L 30.004 164.836 L 28.286 17.052 C 28.286 17.052 27.984 3.546 40.07 3.236 C 52.156 2.926 940.008 1.377 940.008 1.377 L 961.701 22.759 L 962.011 185.455 L 997.649 222.022 L 999.818 688.106 L 965.109 722.814 L 964.8 747.296 C 964.8 747.296 965.419 756.903 955.813 758.142 C 946.207 759.381 49.987 760.002 49.987 760.002 C 49.987 760.002 41 759.692 38.831 751.015 L 38.211 715.687 L 13.639 715.75 L 12.145 584.429 L 35.991 584.105 Z" style="stroke: rgb(0, 0, 0); fill: rgb(255, 255, 255); stroke-width: 5; stroke-linejoin: round; fill-rule: nonzero; fill-opacity: 1;"/>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 1.2 KiB |
BIN
docs/static/hardware/arduino-zero.png
vendored
BIN
docs/static/hardware/arduino-zero.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 1.7 MiB |
@ -2,7 +2,7 @@
|
|||||||
namespace pxsim {
|
namespace pxsim {
|
||||||
export interface AllocatorOpts {
|
export interface AllocatorOpts {
|
||||||
boardDef: BoardDefinition,
|
boardDef: BoardDefinition,
|
||||||
cmpDefs: Map<ComponentDefinition>,
|
cmpDefs: Map<PartDefinition>,
|
||||||
fnArgs: any,
|
fnArgs: any,
|
||||||
getBBCoord: (loc: BBRowCol) => visuals.Coord,
|
getBBCoord: (loc: BBRowCol) => visuals.Coord,
|
||||||
cmpList: string[]
|
cmpList: string[]
|
||||||
@ -21,7 +21,7 @@ namespace pxsim {
|
|||||||
breadboardStartColumn: number,
|
breadboardStartColumn: number,
|
||||||
breadboardStartRow: string,
|
breadboardStartRow: string,
|
||||||
assemblyStep: number,
|
assemblyStep: number,
|
||||||
visual: string | ComponentVisualDefinition,
|
visual: string | PartVisualDefinition,
|
||||||
microbitPins: string[],
|
microbitPins: string[],
|
||||||
otherArgs?: string[],
|
otherArgs?: string[],
|
||||||
}
|
}
|
||||||
@ -33,7 +33,7 @@ namespace pxsim {
|
|||||||
};
|
};
|
||||||
interface PartialCmpAlloc {
|
interface PartialCmpAlloc {
|
||||||
name: string,
|
name: string,
|
||||||
def: ComponentDefinition,
|
def: PartDefinition,
|
||||||
pinsAssigned: string[],
|
pinsAssigned: string[],
|
||||||
pinsNeeded: number | number[],
|
pinsNeeded: number | number[],
|
||||||
breadboardColumnsNeeded: number,
|
breadboardColumnsNeeded: number,
|
||||||
@ -95,7 +95,7 @@ namespace pxsim {
|
|||||||
this.opts = opts;
|
this.opts = opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
private allocateLocation(location: LocationDefinition, opts: AllocLocOpts): Loc {
|
private allocateLocation(location: WireLocationDefinition, opts: AllocLocOpts): Loc {
|
||||||
if (location === "ground" || location === "threeVolt") {
|
if (location === "ground" || location === "threeVolt") {
|
||||||
U.assert(!!opts.nearestBBPin);
|
U.assert(!!opts.nearestBBPin);
|
||||||
let nearLoc = opts.nearestBBPin;
|
let nearLoc = opts.nearestBBPin;
|
||||||
@ -213,7 +213,7 @@ namespace pxsim {
|
|||||||
return {start: endInsts[0], end: endInsts[1], color: wireDef.color, assemblyStep: wireDef.assemblyStep};
|
return {start: endInsts[0], end: endInsts[1], color: wireDef.color, assemblyStep: wireDef.assemblyStep};
|
||||||
}
|
}
|
||||||
private allocatePartialCmps(): PartialCmpAlloc[] {
|
private allocatePartialCmps(): PartialCmpAlloc[] {
|
||||||
let cmpNmAndDefs = this.opts.cmpList.map(cmpName => <[string, ComponentDefinition]>[cmpName, this.opts.cmpDefs[cmpName]]).filter(d => !!d[1]);
|
let cmpNmAndDefs = this.opts.cmpList.map(cmpName => <[string, PartDefinition]>[cmpName, this.opts.cmpDefs[cmpName]]).filter(d => !!d[1]);
|
||||||
let cmpNmsList = cmpNmAndDefs.map(p => p[0]);
|
let cmpNmsList = cmpNmAndDefs.map(p => p[0]);
|
||||||
let cmpDefsList = cmpNmAndDefs.map(p => p[1]);
|
let cmpDefsList = cmpNmAndDefs.map(p => p[1]);
|
||||||
let partialCmps: PartialCmpAlloc[] = [];
|
let partialCmps: PartialCmpAlloc[] = [];
|
||||||
|
@ -78,7 +78,7 @@ namespace pxsim {
|
|||||||
// let boardDef = RASPBERRYPI_MODELB;
|
// let boardDef = RASPBERRYPI_MODELB;
|
||||||
|
|
||||||
let cmpsList = msg.parts;
|
let cmpsList = msg.parts;
|
||||||
let cmpDefs = COMPONENT_DEFINITIONS; //TODO: read from pxt.json/pxttarget.json
|
let cmpDefs = PART_DEFINITIONS; //TODO: read from pxt.json/pxttarget.json
|
||||||
let fnArgs = msg.fnArgs;
|
let fnArgs = msg.fnArgs;
|
||||||
|
|
||||||
let viewHost = new visuals.BoardHost(this, boardDef, cmpsList, cmpDefs, fnArgs);
|
let viewHost = new visuals.BoardHost(this, boardDef, cmpsList, cmpDefs, fnArgs);
|
||||||
|
@ -40,10 +40,10 @@ namespace pxsim {
|
|||||||
type: "auto",
|
type: "auto",
|
||||||
gpioPinsNeeded: number | number[],
|
gpioPinsNeeded: number | number[],
|
||||||
}
|
}
|
||||||
export interface ComponentVisualDefinition {
|
export interface PartVisualDefinition {
|
||||||
}
|
}
|
||||||
export interface ComponentDefinition {
|
export interface PartDefinition {
|
||||||
visual: string | ComponentVisualDefinition,
|
visual: string | PartVisualDefinition,
|
||||||
breadboardColumnsNeeded: number,
|
breadboardColumnsNeeded: number,
|
||||||
breadboardStartRow: string,
|
breadboardStartRow: string,
|
||||||
wires: WireDefinition[],
|
wires: WireDefinition[],
|
||||||
@ -51,12 +51,12 @@ namespace pxsim {
|
|||||||
pinAllocation: FactoryFunctionPinAlloc | PredefinedPinAlloc | AutoPinAlloc,
|
pinAllocation: FactoryFunctionPinAlloc | PredefinedPinAlloc | AutoPinAlloc,
|
||||||
}
|
}
|
||||||
export interface WireDefinition {
|
export interface WireDefinition {
|
||||||
start: LocationDefinition,
|
start: WireLocationDefinition,
|
||||||
end: LocationDefinition,
|
end: WireLocationDefinition,
|
||||||
color: string,
|
color: string,
|
||||||
assemblyStep: number
|
assemblyStep: number
|
||||||
};
|
};
|
||||||
export type LocationDefinition =
|
export type WireLocationDefinition =
|
||||||
["breadboard", string, number] | ["GPIO", number] | "ground" | "threeVolt";
|
["breadboard", string, number] | ["GPIO", number] | "ground" | "threeVolt";
|
||||||
|
|
||||||
export const MICROBIT_DEF: BoardDefinition = {
|
export const MICROBIT_DEF: BoardDefinition = {
|
||||||
@ -95,131 +95,7 @@ namespace pxsim {
|
|||||||
attachPowerOnRight: true,
|
attachPowerOnRight: true,
|
||||||
onboardComponents: ["buttonpair", "ledmatrix"],
|
onboardComponents: ["buttonpair", "ledmatrix"],
|
||||||
}
|
}
|
||||||
export const RASPBERRYPI_MODELB: BoardDefinition = {
|
export const PART_DEFINITIONS: Map<PartDefinition> = {
|
||||||
visual: {
|
|
||||||
image: "/static/hardware/raspberrypi-model-b.svg",
|
|
||||||
outlineImage: "/static/hardware/raspberrypi-model-b-outline.svg",
|
|
||||||
width: 331,
|
|
||||||
height: 230,
|
|
||||||
pinDist: 9,
|
|
||||||
pinBlocks: [
|
|
||||||
{ x: 5, y: 31, labels: ["3V3", "SDA", "SCL", "#4", "--", "#17", "#21", "#22", "--", "MOSI", "MISO", "SCLK", "--"]},
|
|
||||||
{ x: 5, y: 39, labels: ["5V", "--", "GND", "TXD", "RXD", "#18", "--", "#23", "#24", "--", "#25", "CS0", "CS1"]}
|
|
||||||
],
|
|
||||||
},
|
|
||||||
gpioPinBlocks: [
|
|
||||||
["SDA", "SCL", "#4"],
|
|
||||||
["#17", "#21", "#22"],
|
|
||||||
["MOSI", "MISO", "SCLK"],
|
|
||||||
["TXD", "RXD", "#18"],
|
|
||||||
["#23", "#24"],
|
|
||||||
["#25", "CS0", "CS1"],
|
|
||||||
],
|
|
||||||
gpioPinMap: {
|
|
||||||
"P0": "SDA",
|
|
||||||
"P1": "SCL",
|
|
||||||
"P2": "#4",
|
|
||||||
"P3": "MOSI",
|
|
||||||
"P4": "MISO",
|
|
||||||
"P5": "SCLK",
|
|
||||||
"P6": "TXD",
|
|
||||||
"P7": "RXD",
|
|
||||||
"P8": "#18",
|
|
||||||
"P9": "#23",
|
|
||||||
"P10": "#24",
|
|
||||||
"P11": "#25",
|
|
||||||
"P12": "CS0",
|
|
||||||
"P13": "CS1",
|
|
||||||
},
|
|
||||||
groundPins: ["GND"],
|
|
||||||
threeVoltPins: ["3V3"],
|
|
||||||
}
|
|
||||||
export const SPARKFUN_PHOTON: BoardDefinition = {
|
|
||||||
visual: {
|
|
||||||
image: "/static/hardware/sparkfun-photon.svg",
|
|
||||||
outlineImage: "/static/hardware/sparkfun-photon-outline.svg",
|
|
||||||
width: 264.4,
|
|
||||||
height: 202.4,
|
|
||||||
pinDist: 9.5,
|
|
||||||
pinBlocks: [
|
|
||||||
{x: 72, y: 6, labels: ["~SCL/D1", "~SDA/D0", " ", "GND0", "SCK/A3", "~MISO/A4", "~MOSI/A5", "SS/A2", "~WKP", "DAC"]},
|
|
||||||
{x: 174, y: 6, labels: ["D7", "D6", "D5", "D4", "~D3", "~D2", "~TX", "~RX"]},
|
|
||||||
{x: 107, y: 188, labels: [" ", " ", "RESET", "3.3V", "V-USB", "GND1", "GND2", "VIN"]},
|
|
||||||
{x: 193, y: 188, labels: ["A0", "A1", "A2", "A3", "A4", "A5"]},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
gpioPinBlocks: [
|
|
||||||
["~SCL/D1", "~SDA/D0", "SCK/A3", "~MISO/A4", "~MOSI/A5", "SS/A2"],
|
|
||||||
["D7", "D6", "D5", "D4", "~D3", "~D2", "~TX", "~RX"],
|
|
||||||
["A0", "A1", "A2", "A3", "A4", "A5"],
|
|
||||||
],
|
|
||||||
gpioPinMap: {
|
|
||||||
"P0": "A0",
|
|
||||||
"P1": "A1",
|
|
||||||
"P2": "A2",
|
|
||||||
"P3": "A3",
|
|
||||||
"P4": "A4",
|
|
||||||
"P5": "A5",
|
|
||||||
"P6": "~SDA/D0",
|
|
||||||
"P7": "~SCL/D1",
|
|
||||||
"P8": "~D2",
|
|
||||||
"P9": "~D3",
|
|
||||||
"P10": "D4",
|
|
||||||
"P11": "D5",
|
|
||||||
"P12": "D6",
|
|
||||||
"P13": "D7",
|
|
||||||
"P14": "SS/A2",
|
|
||||||
"P15": "SCK/A3",
|
|
||||||
"P16": "~MISO/A4",
|
|
||||||
"P19": "~MOSI/A5",
|
|
||||||
},
|
|
||||||
groundPins: ["GND0", "GND1", "GND2"],
|
|
||||||
threeVoltPins: ["3.3V"],
|
|
||||||
}
|
|
||||||
export const ARDUINO_ZERO: BoardDefinition = {
|
|
||||||
visual: {
|
|
||||||
image: "/static/hardware/arduino-zero.png",
|
|
||||||
outlineImage: "/static/hardware/arduino-zero-outline.svg",
|
|
||||||
width: 1000,
|
|
||||||
height: 762,
|
|
||||||
pinDist: 35.5,
|
|
||||||
pinBlocks: [
|
|
||||||
{x: 276.8, y: 17.8, labels: ["SCL", "SDA", "AREF", "GND0", "~13", "~12", "~11", "~10", "~9", "~8"]},
|
|
||||||
{x: 655.5, y: 17.8, labels: ["7", "~6", "~5", "~4", "~3", "2", "TX->1", "RX<-0"]},
|
|
||||||
{x: 411.7, y: 704.6, labels: ["ATN", "IOREF", "RESET", "3.3V", "5V", "GND1", "GND2", "VIN"]},
|
|
||||||
{x: 732.9, y: 704.6, labels: ["A0", "A1", "A2", "A3", "A4", "A5"]},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
gpioPinBlocks: [
|
|
||||||
["A0", "A1", "A2", "A3", "A4", "A5"],
|
|
||||||
["~13", "~12", "~11", "~10", "~9", "~8"],
|
|
||||||
["7", "~6", "~5", "~4", "~3", "2", "TX->1", "RX<-0"],
|
|
||||||
],
|
|
||||||
gpioPinMap: {
|
|
||||||
"P0": "A0",
|
|
||||||
"P1": "A1",
|
|
||||||
"P2": "A2",
|
|
||||||
"P3": "A3",
|
|
||||||
"P4": "A4",
|
|
||||||
"P5": "A5",
|
|
||||||
"P6": "RX<-0",
|
|
||||||
"P7": "TX->1",
|
|
||||||
"P8": "2",
|
|
||||||
"P9": "~3",
|
|
||||||
"P10": "~4",
|
|
||||||
"P11": "~5",
|
|
||||||
"P12": "~6",
|
|
||||||
"P13": "7",
|
|
||||||
"P14": "~8",
|
|
||||||
"P15": "~9",
|
|
||||||
"P16": "~10",
|
|
||||||
"P19": "~11",
|
|
||||||
"P20": "~12",
|
|
||||||
},
|
|
||||||
groundPins: ["GND0", "GND1", "GND2"],
|
|
||||||
threeVoltPins: ["3.3V"],
|
|
||||||
}
|
|
||||||
export const COMPONENT_DEFINITIONS: Map<ComponentDefinition> = {
|
|
||||||
"ledmatrix": {
|
"ledmatrix": {
|
||||||
visual: "ledmatrix",
|
visual: "ledmatrix",
|
||||||
breadboardColumnsNeeded: 8,
|
breadboardColumnsNeeded: 8,
|
||||||
|
@ -289,7 +289,7 @@ namespace pxsim.instructions {
|
|||||||
}
|
}
|
||||||
type BoardProps = {
|
type BoardProps = {
|
||||||
boardDef: BoardDefinition,
|
boardDef: BoardDefinition,
|
||||||
cmpDefs: Map<ComponentDefinition>,
|
cmpDefs: Map<PartDefinition>,
|
||||||
allAlloc: AllocatorResult,
|
allAlloc: AllocatorResult,
|
||||||
stepToWires: WireInst[][],
|
stepToWires: WireInst[][],
|
||||||
stepToCmps: CmpInst[][]
|
stepToCmps: CmpInst[][]
|
||||||
@ -348,7 +348,7 @@ namespace pxsim.instructions {
|
|||||||
allWireColors: allWireColors,
|
allWireColors: allWireColors,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function mkBoard(boardDef: BoardDefinition, cmpDefs: Map<ComponentDefinition>, width: number, buildMode: boolean = false): visuals.GenericBoardSvg {
|
function mkBoard(boardDef: BoardDefinition, cmpDefs: Map<PartDefinition>, width: number, buildMode: boolean = false): visuals.GenericBoardSvg {
|
||||||
let board = new visuals.GenericBoardSvg({
|
let board = new visuals.GenericBoardSvg({
|
||||||
runtime: pxsim.runtime,
|
runtime: pxsim.runtime,
|
||||||
boardDef: boardDef,
|
boardDef: boardDef,
|
||||||
@ -642,8 +642,8 @@ namespace pxsim.instructions {
|
|||||||
|
|
||||||
style.textContent += STYLE;
|
style.textContent += STYLE;
|
||||||
|
|
||||||
let boardDef = ARDUINO_ZERO;
|
const boardDef = MICROBIT_DEF;
|
||||||
let cmpDefs = COMPONENT_DEFINITIONS;
|
const cmpDefs = PART_DEFINITIONS;
|
||||||
|
|
||||||
//props
|
//props
|
||||||
let dummyBreadboard = new visuals.Breadboard();
|
let dummyBreadboard = new visuals.Breadboard();
|
||||||
|
@ -11,28 +11,27 @@ namespace pxsim.visuals {
|
|||||||
private defs: SVGDefsElement;
|
private defs: SVGDefsElement;
|
||||||
private state: DalBoard;
|
private state: DalBoard;
|
||||||
|
|
||||||
constructor(state: DalBoard, boardDef: BoardDefinition, cmpsList: string[], cmpDefs: Map<ComponentDefinition>, fnArgs: any) {
|
constructor(state: DalBoard, boardDef: BoardDefinition, cmpsList: string[], cmpDefs: Map<PartDefinition>, fnArgs: any) {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
let onboardCmps = boardDef.onboardComponents || [];
|
let onboardCmps = boardDef.onboardComponents || [];
|
||||||
let activeComponents = (cmpsList || []).filter(c => onboardCmps.indexOf(c) < 0);
|
let activeComponents = (cmpsList || []).filter(c => onboardCmps.indexOf(c) < 0);
|
||||||
activeComponents.sort();
|
activeComponents.sort();
|
||||||
|
|
||||||
// if (boardDef.visual === "microbit") {
|
// boardDef.visual === "microbit"
|
||||||
this.boardView = new visuals.MicrobitBoardSvg({
|
this.boardView = new visuals.MicrobitBoardSvg({
|
||||||
runtime: runtime,
|
runtime: runtime,
|
||||||
theme: visuals.randomTheme(),
|
theme: visuals.randomTheme(),
|
||||||
disableTilt: false
|
disableTilt: false
|
||||||
});
|
});
|
||||||
// } else {
|
//TODO: port Arduino/generic board
|
||||||
//TODO: port Arduino/generic board
|
// this.boardView = new visuals.GenericBoardSvg({
|
||||||
// this.boardView = new visuals.GenericBoardSvg({
|
// boardDef: boardDef,
|
||||||
// boardDef: boardDef,
|
// activeComponents: activeComponents,
|
||||||
// activeComponents: activeComponents,
|
// componentDefinitions: cmpDefs,
|
||||||
// componentDefinitions: cmpDefs,
|
// runtime: runtime,
|
||||||
// runtime: runtime,
|
// fnArgs: fnArgs
|
||||||
// fnArgs: fnArgs
|
// })
|
||||||
// })
|
// }
|
||||||
// }
|
|
||||||
|
|
||||||
const VIEW_WIDTH = "100%";
|
const VIEW_WIDTH = "100%";
|
||||||
const VIEW_HEIGHT = "100%";
|
const VIEW_HEIGHT = "100%";
|
||||||
|
@ -11,7 +11,7 @@ namespace pxsim.visuals {
|
|||||||
disableTilt?: boolean;
|
disableTilt?: boolean;
|
||||||
activeComponents: string[];
|
activeComponents: string[];
|
||||||
fnArgs?: any;
|
fnArgs?: any;
|
||||||
componentDefinitions: Map<ComponentDefinition>;
|
componentDefinitions: Map<PartDefinition>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const VIEW_WIDTH = 498;
|
export const VIEW_WIDTH = 498;
|
||||||
@ -192,7 +192,7 @@ namespace pxsim.visuals {
|
|||||||
private underboard: SVGGElement;
|
private underboard: SVGGElement;
|
||||||
public boardDef: BoardDefinition;
|
public boardDef: BoardDefinition;
|
||||||
private boardDim: ComputedBoardDimensions;
|
private boardDim: ComputedBoardDimensions;
|
||||||
public componentDefs: Map<ComponentDefinition>;
|
public componentDefs: Map<PartDefinition>;
|
||||||
private boardEdges: number[];
|
private boardEdges: number[];
|
||||||
private id: number;
|
private id: number;
|
||||||
public bbX: number;
|
public bbX: number;
|
||||||
|
Loading…
Reference in New Issue
Block a user