let Common = system.getScript("/driverlib/Common.js"); let Pinmux = system.getScript("/driverlib/pinmux.js"); let ComparatorInputs = system.getScript("/driverlib/cmpss/cmpss_inputSignals.js") let device_driverlib_peripheral = system.getScript("/driverlib/device_driverlib_peripherals/" + Common.getDeviceName().toLowerCase() + "_cmpss.js"); let device_driverlib_memmap = system.getScript("/driverlib/device_driverlib_peripherals/" + Common.getDeviceName().toLowerCase() + "_memmap.js"); var deviceNumberOfInstances = device_driverlib_memmap.CMPSSMemoryMap.length let CMPSS_INSTANCE = device_driverlib_memmap.CMPSSMemoryMap; CMPSS_INSTANCE = CMPSS_INSTANCE.map(({baseAddress, ...rest}) => { return rest; }); if (["F28004x","F28002x","F28003x","F28P55x","F280013x", "F280015x", "F28P65x"].includes(Common.getDeviceName())){ var defaultCMPSSPinInfos = Pinmux.findAllAnalogPin(Pinmux.getDeviceADCName(ComparatorInputs.CMPSS_comparatorInputSignals[Common.getDeviceName()]["CMPSS1_BASE"][0].displayName.split("/")[0])); var defaultCMPSSNegPinInfos = Pinmux.findAllAnalogPin(Pinmux.getDeviceADCName(ComparatorInputs.CMPSS_comparatorNegInputSignals[Common.getDeviceName()]["CMPSS1_BASE"][1].displayName.split("/")[0])); } var rampDirections = [ {name: "CMPSS_RAMP_DIR_DOWN", displayName: "Count Down"}, {name: "CMPSS_RAMP_DIR_UP", displayName: "Count Up"} ] var CMPSS_TRIPOUT = [ {name: "CMPSS_TRIPOUT_ASYNC_COMP", displayName: "Asynchronous comparator output drives CTRIPOUT"}, {name: "CMPSS_TRIPOUT_SYNC_COMP", displayName: "Synchronous comparator output drives CTRIPOUT"}, {name: "CMPSS_TRIPOUT_FILTER", displayName: "Filter output drives CTRIPOUT"}, {name: "CMPSS_TRIPOUT_LATCH", displayName: "Latched filter output drives CTRIPOUT"}, ]; var CMPSS_TRIP = [ {name: "CMPSS_TRIP_ASYNC_COMP", displayName: "Asynchronous comparator output drives CTRIP"}, {name: "CMPSS_TRIP_SYNC_COMP", displayName: "Synchronous comparator output drives CTRIP"}, {name: "CMPSS_TRIP_FILTER", displayName: "Filter output drives CTRIP"}, {name: "CMPSS_TRIP_LATCH", displayName: "Latched filter output drives CTRIP"}, ]; function calculateDevicePinNameHigh(inst,ui){ if (["F28P65x"].includes(Common.getDeviceName())){ if(((inst.cmpssBase == "CMPSS9_BASE") || (inst.cmpssBase == "CMPSS10_BASE") || (inst.cmpssBase == "CMPSS11_BASE")) && (inst.asysCMPHPMXSELValue == 3)) { var tempPinInfoDesc = "No Device Pin Found" return tempPinInfoDesc } else { var tempPinName = ComparatorInputs.CMPSS_comparatorInputSignals[Common.getDeviceName()][inst.cmpssBase][inst.asysCMPHPMXSELValue].displayName var tempPinInfo = Pinmux.findAllAnalogPin(Pinmux.getDeviceADCName(tempPinName.split("/")[0])) var tempPinInfoDesc = Pinmux.getDevicePinInfoDescription(tempPinInfo) if(tempPinInfo.length == 0) //SysConfig was unable to find any pins with this name, even though it exists as an input; remove error detection { if(tempPinName.includes("TempSensor")) { return "Temperature Sensor"; } else if(tempPinName.includes("VREF")) { return tempPinName } } return tempPinInfoDesc } } else if (["F28P55x"].includes(Common.getDeviceName())){ if((inst.cmpssBase == "CMPSS4_BASE") && (inst.asysCMPHPMXSELValue == 6)) { var tempPinInfoDesc = "No Device Pin Found" return tempPinInfoDesc } else { var tempPinName = ComparatorInputs.CMPSS_comparatorInputSignals[Common.getDeviceName()][inst.cmpssBase][inst.asysCMPHPMXSELValue].displayName var tempPinInfo = Pinmux.findAllAnalogPin(Pinmux.getDeviceADCName(tempPinName.split("/")[0])) var tempPinInfoDesc = Pinmux.getDevicePinInfoDescription(tempPinInfo) if(tempPinInfo.length == 0) //SysConfig was unable to find any pins with this name, even though it exists as an input; remove error detection { if(tempPinName.includes("TempSensor")) { return "Temperature Sensor"; } else if(tempPinName.includes("VREF")) { return tempPinName } } return tempPinInfoDesc } } else { var tempPinName = ComparatorInputs.CMPSS_comparatorInputSignals[Common.getDeviceName()][inst.cmpssBase][inst.asysCMPHPMXSELValue].displayName var tempPinInfo = Pinmux.findAllAnalogPin(Pinmux.getDeviceADCName(tempPinName.split("/")[0])) var tempPinInfoDesc = Pinmux.getDevicePinInfoDescription(tempPinInfo) if ((["F28004x"].includes(Common.getDeviceName())) && (tempPinInfoDesc == Pinmux.NO_DEVICE_PIN_FOUND) && (inst.asysCMPHPMXSELValue == 4)){ return "PGA"+(inst.cmpssBase.match(/\d+/)[0])+"_OUT" } else{ return tempPinInfoDesc } } } function calculateDevicePinNameHighNeg(inst,ui){ var tempPinName = ComparatorInputs.CMPSS_comparatorNegInputSignals[Common.getDeviceName()][inst.cmpssBase][inst.asysCMPHNMXSELValue].displayName var tempPinInfo = Pinmux.findAllAnalogPin(Pinmux.getDeviceADCName(tempPinName.split("/")[0])) var tempPinInfoDesc = Pinmux.getDevicePinInfoDescription(tempPinInfo) if ((["F28004x"].includes(Common.getDeviceName())) && (tempPinInfoDesc == Pinmux.NO_DEVICE_PIN_FOUND) && (inst.asysCMPHNMXSELValue == 4)){ return "PGA"+(inst.cmpssBase.match(/\d+/)[0])+"_OUT" } else if ((["F28P55x"].includes(Common.getDeviceName())) && (tempPinInfoDesc == Pinmux.NO_DEVICE_PIN_FOUND) && (inst.asysCMPHNMXSELValue == 6) && (inst.cmpssBase!= "CMPSS4_BASE")){ return "PGA"+(inst.cmpssBase.match(/\d+/)[0])+"_OUT" } else{ return tempPinInfoDesc } } function calculateDevicePinNameLow(inst,ui){ if(["F28P65x"].includes(Common.getDeviceName())) { if(((inst.cmpssBase == "CMPSS9_BASE") || (inst.cmpssBase == "CMPSS10_BASE") || (inst.cmpssBase == "CMPSS11_BASE")) && (inst.asysCMPLPMXSELValue == 3)) { var tempPinInfoDesc = "No Device Pin Found" return tempPinInfoDesc } else { var tempPinName = ComparatorInputs.CMPSS_comparatorLowPositiveInputSignals[Common.getDeviceName()][inst.cmpssBase][inst.asysCMPLPMXSELValue].displayName var tempPinInfo = Pinmux.findAllAnalogPin(Pinmux.getDeviceADCName(tempPinName.split("/")[0])) var tempPinInfoDesc = Pinmux.getDevicePinInfoDescription(tempPinInfo) if((tempPinInfo.length == 0) && tempPinName.includes("VREF")) //SysConfig was unable to find any pins with this name, even though it exists as an input; remove error detection { return tempPinName } return tempPinInfoDesc } } else if(["F28P55x"].includes(Common.getDeviceName())) { if((inst.cmpssBase == "CMPSS4_BASE") && (inst.asysCMPLPMXSELValue == 6)) { var tempPinInfoDesc = "No Device Pin Found" return tempPinInfoDesc } else { var tempPinName = ComparatorInputs.CMPSS_comparatorLowPositiveInputSignals[Common.getDeviceName()][inst.cmpssBase][inst.asysCMPLPMXSELValue].displayName var tempPinInfo = Pinmux.findAllAnalogPin(Pinmux.getDeviceADCName(tempPinName.split("/")[0])) var tempPinInfoDesc = Pinmux.getDevicePinInfoDescription(tempPinInfo) if((tempPinInfo.length == 0) && tempPinName.includes("VREF")) //SysConfig was unable to find any pins with this name, even though it exists as an input; remove error detection { return tempPinName } return tempPinInfoDesc } } else { var tempPinName = ComparatorInputs.CMPSS_comparatorInputSignals[Common.getDeviceName()][inst.cmpssBase][inst.asysCMPLPMXSELValue].displayName var tempPinInfo = Pinmux.findAllAnalogPin(Pinmux.getDeviceADCName(tempPinName.split("/")[0])) var tempPinInfoDesc = Pinmux.getDevicePinInfoDescription(tempPinInfo) if ((["F28004x"].includes(Common.getDeviceName())) && (tempPinInfoDesc == Pinmux.NO_DEVICE_PIN_FOUND) && (inst.asysCMPLPMXSELValue == 4)){ return "PGA"+(inst.cmpssBase.match(/\d+/)[0])+"_OUT" } else{ return tempPinInfoDesc } } } function calculateDevicePinNameLowNeg(inst,ui){ var tempPinName = ComparatorInputs.CMPSS_comparatorNegInputSignals[Common.getDeviceName()][inst.cmpssBase][inst.asysCMPLNMXSELValue].displayName var tempPinInfo = Pinmux.findAllAnalogPin(Pinmux.getDeviceADCName(tempPinName.split("/")[0])) var tempPinInfoDesc = Pinmux.getDevicePinInfoDescription(tempPinInfo) if ((["F28004x"].includes(Common.getDeviceName())) && (tempPinInfoDesc == Pinmux.NO_DEVICE_PIN_FOUND) && (inst.asysCMPLNMXSELValue == 4)){ return "PGA"+(inst.cmpssBase.match(/\d+/)[0])+"_OUT" } else if ((["F28P55x"].includes(Common.getDeviceName())) && (tempPinInfoDesc == Pinmux.NO_DEVICE_PIN_FOUND) && (inst.asysCMPLNMXSELValue == 6) && (inst.cmpssBase!= "CMPSS4_BASE") ){ return "PGA"+(inst.cmpssBase.match(/\d+/)[0])+"_OUT_INT" } else{ return tempPinInfoDesc } } /* Array of possible ePWM sync signals */ var ePWMInstances = Common.peripheralCount("EPWM") var ePWMArraySync = []; var ePWMArrayBlank = []; for(var i = 0; i < ePWMInstances; i++) { ePWMArraySync.push() ePWMArraySync.push({ name: ""+(i+1), displayName: "EPWM"+(i+1)+"SYNCPER" }) ePWMArrayBlank.push() ePWMArrayBlank.push({ name: ""+(i+1), displayName: "EPWM"+(i+1)+"BLANK" }) } /*Generate array for input signals*/ var numberOfPosInputSignals = 0 var numberOfNegInputSignals = 0 var asysPosSignalOptions = [] var asysNegSignalOptions = [] if (["F28002x","F28004x", "F280013x", "F280015x"].includes(Common.getDeviceName())){ numberOfPosInputSignals = 5 } else if (["F28003x"].includes(Common.getDeviceName())){ numberOfPosInputSignals = 6 } else if (["F28P65x"].includes(Common.getDeviceName())){ numberOfPosInputSignals = 4 } else if (["F28P55x"].includes(Common.getDeviceName())){ numberOfPosInputSignals = 8 } numberOfNegInputSignals = 2 for(var i=0;i