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 {
|
||||
export interface AllocatorOpts {
|
||||
boardDef: BoardDefinition,
|
||||
cmpDefs: Map<ComponentDefinition>,
|
||||
cmpDefs: Map<PartDefinition>,
|
||||
fnArgs: any,
|
||||
getBBCoord: (loc: BBRowCol) => visuals.Coord,
|
||||
cmpList: string[]
|
||||
@ -21,7 +21,7 @@ namespace pxsim {
|
||||
breadboardStartColumn: number,
|
||||
breadboardStartRow: string,
|
||||
assemblyStep: number,
|
||||
visual: string | ComponentVisualDefinition,
|
||||
visual: string | PartVisualDefinition,
|
||||
microbitPins: string[],
|
||||
otherArgs?: string[],
|
||||
}
|
||||
@ -33,7 +33,7 @@ namespace pxsim {
|
||||
};
|
||||
interface PartialCmpAlloc {
|
||||
name: string,
|
||||
def: ComponentDefinition,
|
||||
def: PartDefinition,
|
||||
pinsAssigned: string[],
|
||||
pinsNeeded: number | number[],
|
||||
breadboardColumnsNeeded: number,
|
||||
@ -95,7 +95,7 @@ namespace pxsim {
|
||||
this.opts = opts;
|
||||
}
|
||||
|
||||
private allocateLocation(location: LocationDefinition, opts: AllocLocOpts): Loc {
|
||||
private allocateLocation(location: WireLocationDefinition, opts: AllocLocOpts): Loc {
|
||||
if (location === "ground" || location === "threeVolt") {
|
||||
U.assert(!!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};
|
||||
}
|
||||
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 cmpDefsList = cmpNmAndDefs.map(p => p[1]);
|
||||
let partialCmps: PartialCmpAlloc[] = [];
|
||||
|
@ -78,7 +78,7 @@ namespace pxsim {
|
||||
// let boardDef = RASPBERRYPI_MODELB;
|
||||
|
||||
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 viewHost = new visuals.BoardHost(this, boardDef, cmpsList, cmpDefs, fnArgs);
|
||||
|
@ -40,10 +40,10 @@ namespace pxsim {
|
||||
type: "auto",
|
||||
gpioPinsNeeded: number | number[],
|
||||
}
|
||||
export interface ComponentVisualDefinition {
|
||||
export interface PartVisualDefinition {
|
||||
}
|
||||
export interface ComponentDefinition {
|
||||
visual: string | ComponentVisualDefinition,
|
||||
export interface PartDefinition {
|
||||
visual: string | PartVisualDefinition,
|
||||
breadboardColumnsNeeded: number,
|
||||
breadboardStartRow: string,
|
||||
wires: WireDefinition[],
|
||||
@ -51,12 +51,12 @@ namespace pxsim {
|
||||
pinAllocation: FactoryFunctionPinAlloc | PredefinedPinAlloc | AutoPinAlloc,
|
||||
}
|
||||
export interface WireDefinition {
|
||||
start: LocationDefinition,
|
||||
end: LocationDefinition,
|
||||
start: WireLocationDefinition,
|
||||
end: WireLocationDefinition,
|
||||
color: string,
|
||||
assemblyStep: number
|
||||
};
|
||||
export type LocationDefinition =
|
||||
export type WireLocationDefinition =
|
||||
["breadboard", string, number] | ["GPIO", number] | "ground" | "threeVolt";
|
||||
|
||||
export const MICROBIT_DEF: BoardDefinition = {
|
||||
@ -95,131 +95,7 @@ namespace pxsim {
|
||||
attachPowerOnRight: true,
|
||||
onboardComponents: ["buttonpair", "ledmatrix"],
|
||||
}
|
||||
export const RASPBERRYPI_MODELB: BoardDefinition = {
|
||||
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> = {
|
||||
export const PART_DEFINITIONS: Map<PartDefinition> = {
|
||||
"ledmatrix": {
|
||||
visual: "ledmatrix",
|
||||
breadboardColumnsNeeded: 8,
|
||||
|
@ -289,7 +289,7 @@ namespace pxsim.instructions {
|
||||
}
|
||||
type BoardProps = {
|
||||
boardDef: BoardDefinition,
|
||||
cmpDefs: Map<ComponentDefinition>,
|
||||
cmpDefs: Map<PartDefinition>,
|
||||
allAlloc: AllocatorResult,
|
||||
stepToWires: WireInst[][],
|
||||
stepToCmps: CmpInst[][]
|
||||
@ -348,7 +348,7 @@ namespace pxsim.instructions {
|
||||
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({
|
||||
runtime: pxsim.runtime,
|
||||
boardDef: boardDef,
|
||||
@ -642,8 +642,8 @@ namespace pxsim.instructions {
|
||||
|
||||
style.textContent += STYLE;
|
||||
|
||||
let boardDef = ARDUINO_ZERO;
|
||||
let cmpDefs = COMPONENT_DEFINITIONS;
|
||||
const boardDef = MICROBIT_DEF;
|
||||
const cmpDefs = PART_DEFINITIONS;
|
||||
|
||||
//props
|
||||
let dummyBreadboard = new visuals.Breadboard();
|
||||
|
@ -11,28 +11,27 @@ namespace pxsim.visuals {
|
||||
private defs: SVGDefsElement;
|
||||
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;
|
||||
let onboardCmps = boardDef.onboardComponents || [];
|
||||
let activeComponents = (cmpsList || []).filter(c => onboardCmps.indexOf(c) < 0);
|
||||
activeComponents.sort();
|
||||
|
||||
// if (boardDef.visual === "microbit") {
|
||||
this.boardView = new visuals.MicrobitBoardSvg({
|
||||
runtime: runtime,
|
||||
theme: visuals.randomTheme(),
|
||||
disableTilt: false
|
||||
});
|
||||
// } else {
|
||||
//TODO: port Arduino/generic board
|
||||
// this.boardView = new visuals.GenericBoardSvg({
|
||||
// boardDef: boardDef,
|
||||
// activeComponents: activeComponents,
|
||||
// componentDefinitions: cmpDefs,
|
||||
// runtime: runtime,
|
||||
// fnArgs: fnArgs
|
||||
// })
|
||||
// }
|
||||
// boardDef.visual === "microbit"
|
||||
this.boardView = new visuals.MicrobitBoardSvg({
|
||||
runtime: runtime,
|
||||
theme: visuals.randomTheme(),
|
||||
disableTilt: false
|
||||
});
|
||||
//TODO: port Arduino/generic board
|
||||
// this.boardView = new visuals.GenericBoardSvg({
|
||||
// boardDef: boardDef,
|
||||
// activeComponents: activeComponents,
|
||||
// componentDefinitions: cmpDefs,
|
||||
// runtime: runtime,
|
||||
// fnArgs: fnArgs
|
||||
// })
|
||||
// }
|
||||
|
||||
const VIEW_WIDTH = "100%";
|
||||
const VIEW_HEIGHT = "100%";
|
||||
|
@ -11,7 +11,7 @@ namespace pxsim.visuals {
|
||||
disableTilt?: boolean;
|
||||
activeComponents: string[];
|
||||
fnArgs?: any;
|
||||
componentDefinitions: Map<ComponentDefinition>;
|
||||
componentDefinitions: Map<PartDefinition>;
|
||||
}
|
||||
|
||||
export const VIEW_WIDTH = 498;
|
||||
@ -192,7 +192,7 @@ namespace pxsim.visuals {
|
||||
private underboard: SVGGElement;
|
||||
public boardDef: BoardDefinition;
|
||||
private boardDim: ComputedBoardDimensions;
|
||||
public componentDefs: Map<ComponentDefinition>;
|
||||
public componentDefs: Map<PartDefinition>;
|
||||
private boardEdges: number[];
|
||||
private id: number;
|
||||
public bbX: number;
|
||||
|
Loading…
Reference in New Issue
Block a user