adds max6675
This commit is contained in:
		
							
								
								
									
										3
									
								
								docs/static/hardware/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								docs/static/hardware/.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,4 +1,5 @@
 | 
			
		||||
# don't check in until OSS request is approved
 | 
			
		||||
sparkfun-*
 | 
			
		||||
raspberrypi-*
 | 
			
		||||
arduino-*
 | 
			
		||||
arduino-*
 | 
			
		||||
max6675.svg
 | 
			
		||||
@@ -148,6 +148,16 @@ namespace pxsim {
 | 
			
		||||
                let idx = <number>location[1];
 | 
			
		||||
                let pin = opts.cmpGPIOPins[idx];
 | 
			
		||||
                return {type: "dalboard", pin: pin};
 | 
			
		||||
            } else if (location === "MOSI" || location === "MISO" || location === "SCK") {
 | 
			
		||||
                if (!this.opts.boardDef.spiPins)
 | 
			
		||||
                    console.debug("No SPI pin mappings found!");
 | 
			
		||||
                let pin = (<any>this.opts.boardDef.spiPins)[location as string] as string;
 | 
			
		||||
                return {type: "dalboard", pin: pin};
 | 
			
		||||
            } else if (location === "SDA" || location === "SCL") {
 | 
			
		||||
                if (!this.opts.boardDef.i2cPins)
 | 
			
		||||
                    console.debug("No I2C pin mappings found!");
 | 
			
		||||
                let pin = (<any>this.opts.boardDef.i2cPins)[location as string] as string;
 | 
			
		||||
                return {type: "dalboard", pin: pin};
 | 
			
		||||
            } else {
 | 
			
		||||
                //TODO
 | 
			
		||||
                U.assert(false);
 | 
			
		||||
@@ -206,7 +216,7 @@ namespace pxsim {
 | 
			
		||||
                let l = this.allocateLocation(ends[idx], {
 | 
			
		||||
                    nearestBBPin: locInst.rowCol,
 | 
			
		||||
                    startColumn: opts.startColumn,
 | 
			
		||||
                    cmpGPIOPins: opts.cmpGPIOPins
 | 
			
		||||
                    cmpGPIOPins: opts.cmpGPIOPins,
 | 
			
		||||
                });
 | 
			
		||||
                return l;
 | 
			
		||||
            });
 | 
			
		||||
@@ -260,6 +270,7 @@ namespace pxsim {
 | 
			
		||||
                        });
 | 
			
		||||
                    } else {
 | 
			
		||||
                        // failed to find pin allocation from callsites
 | 
			
		||||
                        debugger;
 | 
			
		||||
                        console.debug("Failed to read pin(s) from callsite for: " + fnNm);
 | 
			
		||||
                        let pinsNeeded = fnPinAlloc.pinArgPositions.length;
 | 
			
		||||
                        partialCmps.push({
 | 
			
		||||
 
 | 
			
		||||
@@ -28,6 +28,16 @@ namespace pxsim {
 | 
			
		||||
        onboardComponents?: string[]
 | 
			
		||||
        useCrocClips?: boolean,
 | 
			
		||||
        marginWhenBreadboarding?: [number, number, number, number],
 | 
			
		||||
        spiPins?: {
 | 
			
		||||
            MOSI: string,
 | 
			
		||||
            MISO: string,
 | 
			
		||||
            SCK: string,
 | 
			
		||||
        },
 | 
			
		||||
        i2cPins?: {
 | 
			
		||||
            SDA: string,
 | 
			
		||||
            SCL: string,
 | 
			
		||||
        },
 | 
			
		||||
        analogInPins?: string[], //TODO: implement allocation
 | 
			
		||||
    }
 | 
			
		||||
    export interface FactoryFunctionPinAlloc {
 | 
			
		||||
        type: "factoryfunction",
 | 
			
		||||
@@ -65,8 +75,15 @@ namespace pxsim {
 | 
			
		||||
        color: string,
 | 
			
		||||
        assemblyStep: number
 | 
			
		||||
    };
 | 
			
		||||
    export type WireLocationDefinition =
 | 
			
		||||
        ["breadboard", string, number] | ["GPIO", number] | "ground" | "threeVolt";
 | 
			
		||||
    export type SPIPin = "MOSI" | "MISO" | "SCK";
 | 
			
		||||
    export type I2CPin = "SDA" | "SCL";
 | 
			
		||||
    export type WireLocationDefinition = (
 | 
			
		||||
          ["breadboard", string, number]
 | 
			
		||||
        | ["GPIO", number]
 | 
			
		||||
        | SPIPin
 | 
			
		||||
        | I2CPin
 | 
			
		||||
        | "ground"
 | 
			
		||||
        | "threeVolt");
 | 
			
		||||
 | 
			
		||||
    export const MICROBIT_DEF: BoardDefinition = {
 | 
			
		||||
        visual: "microbit",
 | 
			
		||||
@@ -75,8 +92,7 @@ namespace pxsim {
 | 
			
		||||
            ["P3"],
 | 
			
		||||
            ["P4", "P5", "P6", "P7"],
 | 
			
		||||
            ["P8", "P9", "P10", "P11", "P12"],
 | 
			
		||||
            ["P13", "P14", "P15", "P16"],
 | 
			
		||||
            ["P19", "P20"],
 | 
			
		||||
            ["P16"],
 | 
			
		||||
        ],
 | 
			
		||||
        gpioPinMap: {
 | 
			
		||||
            "P0": "P0",
 | 
			
		||||
@@ -99,6 +115,16 @@ namespace pxsim {
 | 
			
		||||
            "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,
 | 
			
		||||
@@ -184,6 +210,31 @@ namespace pxsim {
 | 
			
		||||
                {start: ["breadboard", "j", 3], end: "ground", color: "blue", assemblyStep: 1},
 | 
			
		||||
            ],
 | 
			
		||||
        },
 | 
			
		||||
        "max6675": {
 | 
			
		||||
            visual: {
 | 
			
		||||
                image: "/static/hardware/max6675.svg",
 | 
			
		||||
                width: 58,
 | 
			
		||||
                height: 64,
 | 
			
		||||
                firstPin: [11, 5],
 | 
			
		||||
                pinDist: 7.2,
 | 
			
		||||
                extraColumnOffset: 2,
 | 
			
		||||
            },
 | 
			
		||||
            breadboardColumnsNeeded: 10,
 | 
			
		||||
            breadboardStartRow: "h",
 | 
			
		||||
            pinAllocation: {
 | 
			
		||||
                type: "factoryfunction",
 | 
			
		||||
                functionName: "max6675.temperature",
 | 
			
		||||
                pinArgPositions: [0]
 | 
			
		||||
            },
 | 
			
		||||
            assemblyStep: 0,
 | 
			
		||||
            wires: [
 | 
			
		||||
                {start: ["breadboard", "j", 2], end: "SCK", color: "green", assemblyStep: 1},
 | 
			
		||||
                {start: ["breadboard", "j", 3], end: ["GPIO", 0], color: "blue", assemblyStep: 1},
 | 
			
		||||
                {start: ["breadboard", "j", 4], end: "MISO", color: "orange", assemblyStep: 1},
 | 
			
		||||
                {start: ["breadboard", "j", 5], end: "ground", color: "blue", assemblyStep: 0},
 | 
			
		||||
                {start: ["breadboard", "j", 6], end: "threeVolt", color: "red", assemblyStep: 1},
 | 
			
		||||
            ],
 | 
			
		||||
        },
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    export const builtinComponentSimVisual: Map<() => visuals.IBoardComponent<any>> = {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user