Search in sources :

Example 16 with BooleanVariable

use of net.sourceforge.usbdm.deviceEditor.information.BooleanVariable in project usbdm-eclipse-plugins by podonoghue.

the class LpuartValidate method validate.

/**
 * Class to validate LPUART settings
 * @throws Exception
 */
@Override
public void validate(Variable variable) throws Exception {
    super.validate(variable);
    // Variables
    // =================================
    BooleanVariable uartClassVar = getBooleanVariable("lpuartClass");
    LongVariable receiveBufferSizeVar = getLongVariable("receiveBufferSize");
    LongVariable transmitBufferSizeVar = getLongVariable("transmitBufferSize");
    IrqVariable txrxHandlerVar = getIrqVariable("irqHandlers");
    // Enable/disable parameters that depend on mode
    boolean uartClass = uartClassVar.getValueAsBoolean();
    if (variable == uartClassVar) {
        // System.err.println("uartClassVar = "+uartClassVar.getValueAsBoolean());
        // Changed buffering
        receiveBufferSizeVar.enable(uartClass);
        transmitBufferSizeVar.enable(uartClass);
        txrxHandlerVar.setLocked(uartClass);
        if (uartClass) {
            txrxHandlerVar.setValue(IrqVariable.CLASS_VALUE);
        }
    }
    validateMappedPins(new int[] { 0, 1 }, getPeripheral().getSignalTables().get(0).table);
}
Also used : LongVariable(net.sourceforge.usbdm.deviceEditor.information.LongVariable) BooleanVariable(net.sourceforge.usbdm.deviceEditor.information.BooleanVariable) IrqVariable(net.sourceforge.usbdm.deviceEditor.information.IrqVariable)

Example 17 with BooleanVariable

use of net.sourceforge.usbdm.deviceEditor.information.BooleanVariable in project usbdm-eclipse-plugins by podonoghue.

the class PdbValidate method doDacValidate.

/**
 * Validate a DAC settings
 *
 * @param  variable   Variable that triggered change (may be null)
 * @param  channel    The DAC to validate e.g. 0, 1 etc
 *
 * @throws Exception
 */
void doDacValidate(Variable variable, int channel) throws Exception {
    // In/Out
    BooleanVariable pdb_intXc_toeVar = safeGetBooleanVariable("pdb_int" + channel + "c_toe");
    if (pdb_intXc_toeVar == null) {
        // Dac trigger doesn't exit
        return;
    }
    BooleanVariable pdb_intXc_extVar = getBooleanVariable("pdb_int" + channel + "c_ext");
    LongVariable pdb_intX_intVar = getLongVariable("pdb_int" + channel + "_int");
    // Out/Out
    DoubleVariable pdb_intX_int_delayVar = getDoubleVariable("pdb_int" + channel + "_int_delay");
    boolean triggerEnable = pdb_intXc_toeVar.getRawValueAsBoolean();
    // Do enable/disable first
    pdb_intXc_extVar.enable(triggerEnable);
    pdb_intX_intVar.enable(triggerEnable);
    pdb_intX_int_delayVar.enable(triggerEnable);
    // Get current values
    long pdb_intX_int = pdb_intX_intVar.getRawValueAsLong();
    double pdb_intX_int_delay = pdb_intX_int_delayVar.getRawValueAsDouble();
    if (clockChanged) {
        pdb_intX_int_delayVar.setOrigin(pdbClockOrigin + " period * pdb_int" + channel + "_int");
    }
    if (variable != null) {
        if (variable.equals(pdb_intX_int_delayVar)) {
            // Calculate rounded value
            pdb_intX_int = Math.max(0, Math.round((pdb_intX_int_delay / pdb_period) - 1));
            // Update
            pdb_intX_intVar.setValue(pdb_intX_int);
        // Need to show effect of rounding
        }
    }
    pdb_intX_intVar.setMax(pdb_mod);
    pdb_intX_int_delayVar.setMax((pdb_mod + 1.5) * pdb_period);
    pdb_intX_int_delayVar.setValue(pdb_period * (pdb_intX_int + 1));
}
Also used : LongVariable(net.sourceforge.usbdm.deviceEditor.information.LongVariable) BooleanVariable(net.sourceforge.usbdm.deviceEditor.information.BooleanVariable) DoubleVariable(net.sourceforge.usbdm.deviceEditor.information.DoubleVariable)

Aggregations

BooleanVariable (net.sourceforge.usbdm.deviceEditor.information.BooleanVariable)17 LongVariable (net.sourceforge.usbdm.deviceEditor.information.LongVariable)15 ChoiceVariable (net.sourceforge.usbdm.deviceEditor.information.ChoiceVariable)12 Variable (net.sourceforge.usbdm.deviceEditor.information.Variable)9 DoubleVariable (net.sourceforge.usbdm.deviceEditor.information.DoubleVariable)7 IrqVariable (net.sourceforge.usbdm.deviceEditor.information.IrqVariable)3 StringVariable (net.sourceforge.usbdm.deviceEditor.information.StringVariable)3 Status (net.sourceforge.usbdm.deviceEditor.model.Status)3 PinListVariable (net.sourceforge.usbdm.deviceEditor.information.PinListVariable)2 Signal (net.sourceforge.usbdm.deviceEditor.information.Signal)2 FileNotFoundException (java.io.FileNotFoundException)1 ArrayList (java.util.ArrayList)1 BitmaskVariable (net.sourceforge.usbdm.deviceEditor.information.BitmaskVariable)1 IndexedCategoryVariable (net.sourceforge.usbdm.deviceEditor.information.IndexedCategoryVariable)1 MappingInfo (net.sourceforge.usbdm.deviceEditor.information.MappingInfo)1 NumericListVariable (net.sourceforge.usbdm.deviceEditor.information.NumericListVariable)1 InfoTable (net.sourceforge.usbdm.deviceEditor.information.Peripheral.InfoTable)1 Pin (net.sourceforge.usbdm.deviceEditor.information.Pin)1 Pair (net.sourceforge.usbdm.deviceEditor.information.Variable.Pair)1 UsbdmException (net.sourceforge.usbdm.jni.UsbdmException)1