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);
}
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));
}
Aggregations