项目:snobot-2017
文件:I2C.java
/**
* Execute a read transaction with the device.
*
* <p>Read bytes from a device. Most I2C devices will auto-increment the register pointer
* internally allowing you to read consecutive registers on a device in a single transaction.
*
* @param registeraddress The register to read first in the transaction.
* @param count The number of bytes to read in the transaction.
* @param buffer A buffer to store the data read from the device. Must be created using
* ByteBuffer.allocateDirect().
* @return Transfer Aborted... false for success,true for aborted.
*/
public boolean read(int registeraddress,int count,ByteBuffer buffer) {
if (count < 1) {
throw new BoundaryException("Value must be at least 1," + count + " given");
}
if (!buffer.isDirect()) {
throw new IllegalArgumentException("must be a direct buffer");
}
if (buffer.capacity() < count) {
throw new IllegalArgumentException("buffer is too small,must be at least " + count);
}
ByteBuffer dataToSendBuffer = ByteBuffer.allocateDirect(1);
dataToSendBuffer.put(0,(byte) registeraddress);
return transaction(dataToSendBuffer,1,buffer,count);
}
项目:snobot-2017
文件:I2C.java
/**
* Execute a read only transaction with the device.
*
* <p>Read bytes from a device. This method does not write any data to prompt the device.
*
* @param buffer A pointer to the array of bytes to store the data read from the device.
* @param count The number of bytes to read in the transaction.
* @return Transfer Aborted... false for success,true for aborted.
*/
public boolean readOnly(byte[] buffer,int count) {
if (count < 1) {
throw new BoundaryException("Value must be at least 1," + count + " given");
}
if (buffer == null) {
throw new NullPointerException("Null return buffer was given");
}
ByteBuffer dataReceivedBuffer = ByteBuffer.allocateDirect(count);
int retVal = I2CJNI.i2CRead((byte) m_port.value,(byte) m_deviceAddress,dataReceivedBuffer,(byte) count);
dataReceivedBuffer.get(buffer);
return retVal < count;
}
项目:snobot-2017
文件:I2C.java
/**
* Execute a read only transaction with the device.
*
* <p>Read bytes from a device. This method does not write any data to prompt the device.
*
* @param buffer A pointer to the array of bytes to store the data read from the device. Must be
* created using ByteBuffer.allocateDirect().
* @param count The number of bytes to read in the transaction.
* @return Transfer Aborted... false for success,true for aborted.
*/
public boolean readOnly(ByteBuffer buffer," + count
+ " given");
}
if (!buffer.isDirect()) {
throw new IllegalArgumentException("must be a direct buffer");
}
if (buffer.capacity() < count) {
throw new IllegalArgumentException("buffer is too small,must be at least " + count);
}
return I2CJNI.i2CRead((byte) m_port.value,(byte) count)
< count;
}
/**
* Execute a read transaction with the device.
*
* Read bytes from a device. Most I2C devices will auto-increment the
* register pointer internally allowing you to read consecutive
* registers on a device in a single transaction.
*
* @param registeraddress The register to read first in the transaction.
* @param count The number of bytes to read in the transaction.
* @param buffer A buffer to store the data read from the device. Must be
* created using ByteBuffer.allocateDirect().
* @return Transfer Aborted... false for success," + count +
" given");
}
if (!buffer.isDirect())
throw new IllegalArgumentException("must be a direct buffer");
if (buffer.capacity() < count)
throw new IllegalArgumentException("buffer is too small,must be at least " + count);
ByteBuffer dataToSendBuffer = ByteBuffer.allocateDirect(1);
dataToSendBuffer.put(0,count);
}
/**
* Execute a read only transaction with the device.
*
* Read bytes from a device. This method does not write any data to prompt
* the device.
*
* @param buffer A pointer to the array of bytes to store the data read from
* the device.
* @param count The number of bytes to read in the transaction.
* @return Transfer Aborted... false for success," + count +
" given");
}
if (buffer == null) {
throw new NullPointerException("Null return buffer was given");
}
ByteBuffer dataReceivedBuffer = ByteBuffer.allocateDirect(count);
int retVal =
I2CJNI.i2CRead((byte) m_port.getValue(),(byte) count);
dataReceivedBuffer.get(buffer);
return retVal < 0;
}
/**
* Set the analog output voltage.
*
* AO1 is pin 11 on the top connector (P2).
* AO2 is pin 12 on the top connector (P2).
* AO1 is the reference voltage for the 2 analog comparators on dio15 and dio16.
*
* The output range is 0V to 4V,however due to the supply voltage don't expect more than about 3V.
* Current supply capability is only 100uA.
*
* @param channel The analog output channel on the DS IO. [1,2]
* @param value The voltage to output on the channel.
*/
public void setAnalogout(int channel,double value) throws EnhancedioException {
BoundaryException.assertWithinBounds(channel,2);
if (!m_outputValid) {
throw new EnhancedioException("Enhanced IO Missing");
}
if (value < 0.0) {
value = 0.0;
}
if (value > kAnalogoutputReference) {
value = kAnalogoutputReference;
}
if (value > kAnalogoutputReference) {
value = kAnalogoutputReference;
}
synchronized (m_outputDataSemaphore) {
m_outputData.data.dac[channel - 1] = (byte) (value / kAnalogoutputReference * kAnalogoutputResolution);
}
}
/**
* Set the state of an LED on the IO board.
*
* @param channel The LED channel to set. [1,8]
* @param value True to turn the LED on.
*/
public void setLED(int channel,boolean value) throws EnhancedioException {
BoundaryException.assertWithinBounds(channel,8);
if (!m_outputValid) {
throw new EnhancedioException("Enhanced IO Missing");
}
byte leds;
synchronized (m_outputDataSemaphore) {
leds = m_outputData.data.leds;
leds &= ~(1 << (channel - 1));
if (value) {
leds |= 1 << (channel - 1);
}
m_outputData.data.leds = leds;
}
}
/**
* Set the state of a dio line that is configured for digital output.
*
* @param channel The dio channel to set. [1,16]
* @param value The state to set the selected channel to.
*/
public void setDigitalOutput(int channel,16);
if (!m_outputValid) {
throw new EnhancedioException("Enhanced IO Missing");
}
short digital;
synchronized (m_outputDataSemaphore) {
if ((m_outputData.data.digital_oe & (1 << (channel - 1))) != 0) {
digital = m_outputData.data.digital;
digital &= ~(1 << (channel - 1));
if (value) {
digital |= 1 << (channel - 1);
}
m_outputData.data.digital = digital;
} else {
System.err.println("Line not configured for output");
}
}
}
/**
* Set the state to output on a Fixed High Current Digital Output line.
*
* FixedDO1 is pin 5 on the top connector (P2).
* FixedDO2 is pin 3 on the top connector (P2).
*
* The FixedDO lines always output 0V and 3.3V regardless of J1 and J4.
* They can source 4mA and can sink 25mA. Because of this,they are expected to be used
* in an active low configuration,such as connecting to the cathode of a bright LED.
* Because they are expected to be active low,they default to true.
*
* @param channel The FixedDO channel to set.
* @param value The state to set the FixedDO.
*/
public void setFixedDigitalOutput(int channel,2);
if (!m_outputValid) {
throw new EnhancedioException("Enhanced IO Missing");
}
byte digital;
synchronized (m_outputDataSemaphore) {
digital = m_outputData.data.fixed_digital_out;
digital &= ~(1 << (channel - 1));
if (value) {
digital |= 1 << (channel - 1);
}
m_outputData.data.fixed_digital_out = digital;
}
}
/**
* Set the analog output voltage.
*
* AO1 is pin 11 on the top connector (P2).
* AO2 is pin 12 on the top connector (P2).
* AO1 is the reference voltage for the 2 analog comparators on dio15 and dio16.
*
* The output range is 0V to 4V,2);
if (!m_outputValid) {
throw new EnhancedioException("Enhanced IO Missing");
}
if (value < 0.0) {
value = 0.0;
}
if (value > kAnalogoutputReference) {
value = kAnalogoutputReference;
}
if (value > kAnalogoutputReference) {
value = kAnalogoutputReference;
}
synchronized (m_outputDataSemaphore) {
m_outputData.data.dac[channel - 1] = (byte) (value / kAnalogoutputReference * kAnalogoutputResolution);
}
}
/**
* Set the state of an LED on the IO board.
*
* @param channel The LED channel to set. [1,8);
if (!m_outputValid) {
throw new EnhancedioException("Enhanced IO Missing");
}
byte leds;
synchronized (m_outputDataSemaphore) {
leds = m_outputData.data.leds;
leds &= ~(1 << (channel - 1));
if (value) {
leds |= 1 << (channel - 1);
}
m_outputData.data.leds = leds;
}
}
/**
* Set the state of a dio line that is configured for digital output.
*
* @param channel The dio channel to set. [1,16);
if (!m_outputValid) {
throw new EnhancedioException("Enhanced IO Missing");
}
short digital;
synchronized (m_outputDataSemaphore) {
if ((m_outputData.data.digital_oe & (1 << (channel - 1))) != 0) {
digital = m_outputData.data.digital;
digital &= ~(1 << (channel - 1));
if (value) {
digital |= 1 << (channel - 1);
}
m_outputData.data.digital = digital;
} else {
System.err.println("Line not configured for output");
}
}
}
/**
* Set the state to output on a Fixed High Current Digital Output line.
*
* FixedDO1 is pin 5 on the top connector (P2).
* FixedDO2 is pin 3 on the top connector (P2).
*
* The FixedDO lines always output 0V and 3.3V regardless of J1 and J4.
* They can source 4mA and can sink 25mA. Because of this,2);
if (!m_outputValid) {
throw new EnhancedioException("Enhanced IO Missing");
}
byte digital;
synchronized (m_outputDataSemaphore) {
digital = m_outputData.data.fixed_digital_out;
digital &= ~(1 << (channel - 1));
if (value) {
digital |= 1 << (channel - 1);
}
m_outputData.data.fixed_digital_out = digital;
}
}
项目:FRC-2017-Public
文件:SynchronousPID.java
/**
* Sets the maximum and minimum values expected from the input.
*
* @param minimumInput the minimum value expected from the input
* @param maximumInput the maximum value expected from the output
*/
public void setInputRange(double minimumInput,double maximumInput) {
if (minimumInput > maximumInput) {
throw new BoundaryException("Lower bound is greater than upper bound");
}
m_minimumInput = minimumInput;
m_maximumInput = maximumInput;
setSetpoint(m_setpoint);
}
项目:FRC-2017-Public
文件:SynchronousPID.java
/**
* Sets the minimum and maximum values to write.
*
* @param minimumOutput the minimum value to write to the output
* @param maximumOutput the maximum value to write to the output
*/
public void setoutputRange(double minimumOutput,double maximumOutput) {
if (minimumOutput > maximumOutput) {
throw new BoundaryException("Lower bound is greater than upper bound");
}
m_minimumOutput = minimumOutput;
m_maximumOutput = maximumOutput;
}
项目:snobot-2017
文件:PIDController.java
/**
* Sets the maximum and minimum values expected from the input and setpoint.
*
* @param minimumInput the minimum value expected from the input
* @param maximumInput the maximum value expected from the input
*/
public synchronized void setInputRange(double minimumInput,double maximumInput) {
if (minimumInput > maximumInput) {
throw new BoundaryException("Lower bound is greater than upper bound");
}
m_minimumInput = minimumInput;
m_maximumInput = maximumInput;
setSetpoint(m_setpoint);
}
项目:snobot-2017
文件:PIDController.java
/**
* Sets the minimum and maximum values to write.
*
* @param minimumOutput the minimum percentage to write to the output
* @param maximumOutput the maximum percentage to write to the output
*/
public synchronized void setoutputRange(double minimumOutput,double maximumOutput) {
if (minimumOutput > maximumOutput) {
throw new BoundaryException("Lower bound is greater than upper bound");
}
m_minimumOutput = minimumOutput;
m_maximumOutput = maximumOutput;
}
项目:snobot-2017
文件:Counter.java
/**
* Set which parameter of the encoder you are using as a process control variable. The counter
* class supports the rate and distance parameters.
*
* @param pidSource An enum to select the parameter.
*/
public void setPIDSourceType(PIDSourceType pidSource) {
if (pidSource == null) {
throw new NullPointerException("PID Source Parameter given was null");
}
BoundaryException.assertWithinBounds(pidSource.value,1);
m_pidSource = pidSource;
}
项目:snobot-2017
文件:I2C.java
/**
* Execute a read transaction with the device.
*
* <p>Read bytes from a device. Most I2C devices will auto-increment the register pointer
* internally allowing you to read consecutive registers on a device in a single transaction.
*
* @param registeraddress The register to read first in the transaction.
* @param count The number of bytes to read in the transaction.
* @param buffer A pointer to the array of bytes to store the data read from the device.
* @return Transfer Aborted... false for success,byte[] buffer) {
if (count < 1) {
throw new BoundaryException("Value must be at least 1," + count + " given");
}
if (buffer == null) {
throw new NullPointerException("Null return buffer was given");
}
byte[] registeraddressArray = new byte[1];
registeraddressArray[0] = (byte) registeraddress;
return transaction(registeraddressArray,registeraddressArray.length,count);
}
/**
* Set which parameter of the encoder you are using as a process control
* variable. The counter class supports the rate and distance parameters.
*
* @param pidSource An enum to select the parameter.
*/
public void setPIDSourceType(PIDSourceType pidSource) {
if (pidSource == null) {
throw new NullPointerException("PID Source Parameter given was null");
}
BoundaryException.assertWithinBounds(pidSource.value,1);
m_pidSource = pidSource;
}
/**
* Execute a read transaction with the device.
*
* Read bytes from a device. Most I2C devices will auto-increment the
* register pointer internally allowing you to read consecutive
* registers on a device in a single transaction.
*
* @param registeraddress The register to read first in the transaction.
* @param count The number of bytes to read in the transaction.
* @param buffer A pointer to the array of bytes to store the data read from
* the device.
* @return Transfer Aborted... false for success," + count +
" given");
}
if (buffer == null) {
throw new NullPointerException("Null return buffer was given");
}
byte[] registeraddressArray = new byte[1];
registeraddressArray[0] = (byte) registeraddress;
return transaction(registeraddressArray,count);
}
/**
* Execute a read only transaction with the device.
*
* Read bytes from a device. This method does not write any data to prompt
* the device.
*
* @param buffer A pointer to the array of bytes to store the data read from
* the device. Must be created using ByteBuffer.allocateDirect().
* @param count The number of bytes to read in the transaction.
* @return Transfer Aborted... false for success,must be at least " + count);
return I2CJNI.i2CRead((byte) m_port.getValue(),(byte) count) < 0;
}
项目:FakeWPILib
文件:I2C.java
/**
* Execute a read only transaction with the device.
* <p/>
* Read 1 to 7 bytes from a device. This method does not write any data to prompt
* the device.
*
* @param buffer A pointer to the array of bytes to store the data read from
* the device.
* @param count The number of bytes to read in the transaction. [1..7]
* @return Transfer Aborted... false for success,int count) {
BoundaryException.assertWithinBounds(count,7);
if (buffer == null) {
throw new NullPointerException("Null return buffer was given");
}
ByteBuffer dataReceivedBuffer = ByteBuffer.allocateDirect(count);
int retVal = 0;
dataReceivedBuffer.get(buffer);
return retVal < 0;
}
项目:wpilibj
文件:AnalogTrigger.java
/**
* Set the upper and lower limits of the analog trigger.
* The limits are given in ADC codes. If oversampling is used,the units must be scaled
* appropriately.
* @param lower the lower raw limit
* @param upper the upper raw limit
*/
public void setLimitsRaw(final int lower,final int upper) {
if (lower > upper) {
throw new BoundaryException("Lower bound is greater than upper");
}
m_trigger.writeLowerLimit(lower);
m_trigger.writeUpperLimit(upper);
}
项目:wpilibj
文件:AnalogTrigger.java
/**
* Set the upper and lower limits of the analog trigger.
* The limits are given as floating point voltage values.
* @param lower the lower voltage limit
* @param upper the upper voltage limit
*/
public void setLimitsVoltage(double lower,double upper) {
if (lower > upper) {
throw new BoundaryException("Lower bound is greater than upper bound");
}
// Todo: This depends on the averaged setting. Only raw values will work as is.
m_trigger.writeLowerLimit(m_analogModule.voltsTovalue(m_channel,lower));
m_trigger.writeUpperLimit(m_analogModule.voltsTovalue(m_channel,upper));
}
项目:wpilibj
文件:PIDController.java
/**
* Sets the maximum and minimum values expected from the input.
*
* @param minimumInput the minimum percentage expected from the input
* @param maximumInput the maximum percentage expected from the output
*/
public synchronized void setInputRange(double minimumInput,double maximumInput) {
if (minimumInput > maximumInput) {
throw new BoundaryException("Lower bound is greater than upper bound");
}
m_minimumInput = minimumInput;
m_maximumInput = maximumInput;
setSetpoint(m_setpoint);
}
项目:wpilibj
文件:PIDController.java
/**
* Sets the minimum and maximum values to write.
*
* @param minimumOutput the minimum percentage to write to the output
* @param maximumOutput the maximum percentage to write to the output
*/
public synchronized void setoutputRange(double minimumOutput,double maximumOutput) {
if (minimumOutput > maximumOutput) {
throw new BoundaryException("Lower bound is greater than upper bound");
}
m_minimumOutput = minimumOutput;
m_maximumOutput = maximumOutput;
}
项目:wpilibj
文件:Encoder.java
/**
* Set the Samples to Average which specifies the number of samples of the timer to
* average when calculating the period. Perform averaging to account for
* mechanical imperfections or as oversampling to increase resolution.
* @param samplesToAverage The number of samples to average from 1 to 127.
*/
public void setSamplesToAverage(int samplesToAverage)
{
BoundaryException.assertWithinBounds(samplesToAverage,127);
switch (m_encodingType.value) {
case EncodingType.k4X_val:
m_encoder.writeTimerConfig_AverageSize(samplesToAverage);
break;
case EncodingType.k1X_val:
case EncodingType.k2X_val:
m_counter.setSamplesToAverage(samplesToAverage);
}
}
/**
* Query an analog input channel on the DS IO in ratiometric form.
*
* @param channel The channel number to read. [1,8]
* @return The analog input percentage for the channel.
*/
public double getAnalogInRatio(int channel) throws EnhancedioException {
BoundaryException.assertWithinBounds(channel,8);
if (!m_inputValid) {
throw new EnhancedioException("Enhanced IO Missing");
}
synchronized (m_inputDataSemaphore) {
return m_inputData.data.analog[channel - 1] / kAnalogInputResolution;
}
}
/**
* Query the voltage currently being output.
*
* AO1 is pin 11 on the top connector (P2).
* AO2 is pin 12 on the top connector (P2).
*
* @param channel The analog output channel on the DS IO. [1,2]
* @return The voltage being output on the channel.
*/
public double getAnalogout(int channel) throws EnhancedioException {
BoundaryException.assertWithinBounds(channel,2);
if (!m_outputValid) {
throw new EnhancedioException("Enhanced IO Missing");
}
synchronized (m_outputDataSemaphore) {
int tempData = m_outputData.data.dac[channel - 1];
tempData = tempData < 0 ? tempData + 256 : tempData;
return tempData * kAnalogoutputReference / kAnalogoutputResolution;
}
}
/**
* Get the current configuration for a dio line.
*
* This has the side effect of forcing the Driver Station to switch to Enhanced mode if it's not when called.
* If Enhanced mode is not enabled when this is called,it will return kUnkNown.
*
* @param channel The dio channel config to get. [1,16]
* @return The configured mode for the dio line.
*/
public tDigitalConfig getDigitalConfig(int channel) throws EnhancedioException {
BoundaryException.assertWithinBounds(channel,16);
if (!m_outputValid) {
m_requestEnhancedEnable = true;
throw new EnhancedioException("Enhanced IO Missing");
}
synchronized (m_outputDataSemaphore) {
if ((channel >= 1) && (channel <= 4)) {
if ((m_outputData.data.pwm_enable & (1 << (channel - 1))) != 0) {
return tDigitalConfig.kPWM;
}
}
if ((channel >= 15) && (channel <= 16)) {
if ((m_outputData.data.comparator_enable & (1 << (channel - 15))) != 0) {
return tDigitalConfig.kAnalogComparator;
}
}
if ((m_outputData.data.digital_oe & (1 << (channel - 1))) != 0) {
return tDigitalConfig.kOutput;
}
if ((m_outputData.data.digital_pe & (1 << (channel - 1))) == 0) {
return tDigitalConfig.kInputFloating;
}
if ((m_outputData.data.digital & (1 << (channel - 1))) != 0) {
return tDigitalConfig.kInputPullUp;
} else {
return tDigitalConfig.kInputPullDown;
}
}
}
/**
* Get the state being output on a fixed digital output.
*
* @param channel The FixedDO line to get. [1,2]
* @return The state of the FixedDO line.
*/
public boolean getFixedDigitalOutput(int channel) throws EnhancedioException {
BoundaryException.assertWithinBounds(channel,2);
if (!m_outputValid) {
throw new EnhancedioException("Enhanced IO Missing");
}
synchronized (m_outputDataSemaphore) {
return ((m_outputData.data.fixed_digital_out >> (channel - 1)) & 1) != 0;
}
}
/**
* Reset the position of an encoder to 0.
*
* This simply stores an offset locally. It does not reset the hardware counter on the IO board.
* If you use this method with Index enabled,you may get unexpected results.
*
* @param encoderNumber The quadrature encoder to reset. [1,2]
*/
public void resetEncoder(int encoderNumber) throws EnhancedioException {
BoundaryException.assertWithinBounds(encoderNumber,2);
if (!m_inputValid) {
throw new EnhancedioException("Enhanced IO Missing");
}
synchronized (m_inputDataSemaphore) {
m_encoderOffsets[encoderNumber - 1] = m_inputData.data.quad[encoderNumber - 1];
}
}
/**
* Get the current configuration of a quadrature encoder index channel.
*
* This has the side effect of forcing the Driver Station to switch to Enhanced mode if it's not when called.
* If Enhanced mode is not enabled when this is called,it will return false.
*
* @param encoderNumber The quadrature encoder. [1,2]
* @return Is the index channel of the encoder enabled.
*/
public boolean getEncoderIndexEnable(int encoderNumber) throws EnhancedioException {
BoundaryException.assertWithinBounds(encoderNumber,2);
if (!m_outputValid) {
m_requestEnhancedEnable = true;
throw new EnhancedioException("Enhanced IO Missing");
}
synchronized (m_outputDataSemaphore) {
return ((m_outputData.data.quad_index_enable >> (encoderNumber - 1)) & 1) != 0;
}
}
/**
* Get the percent duty-cycle that the PWM generator channel is configured to output.
*
* @param channel The dio line's PWM generator to get the duty-cycle from. [1,4]
* @return The percent duty-cycle being output (if the dio line is configured for PWM). [0.0,1.0]
*/
public double getPWMOutput(int channel) throws EnhancedioException {
BoundaryException.assertWithinBounds(channel,4);
if (!m_outputValid) {
throw new EnhancedioException("Enhanced IO Missing");
}
synchronized (m_outputDataSemaphore) {
int tempCompare = m_outputData.data.pwm_compare[channel - 1] & 0xFFFF;
int tempPeriod = m_outputData.data.pwm_period[(channel - 1) >> 1] & 0xFFFF;
return (double) tempCompare / (double) tempPeriod;
}
}
/**
* Set the percent duty-cycle to output on a PWM enabled dio line.
*
* dio1 through dio4 have the ability to output a PWM signal. The period of the
* signal can be configured in pairs using SetPWMPeriod().
*
* @param channel The dio line's PWM generator to set. [1,4]
* @param value The percent duty-cycle to output from the PWM generator. [0.0,1.0]
*/
public void setPWMOutput(int channel,4);
if (!m_outputValid) {
throw new EnhancedioException("Enhanced IO Missing");
}
if (value > 1.0) {
value = 1.0;
} else if (value < 0.0) {
value = 0.0;
}
synchronized (m_outputDataSemaphore) {
m_outputData.data.pwm_compare[channel - 1] = (short) (value * (double) m_outputData.data.pwm_period[(channel - 1) >> 1]);
}
}
项目:wpilibj
文件:NIVision.java
项目:649code2014
文件:PIDController649.java
/**
* Sets the maximum and minimum values expected from the input.
*
* @param minimumInput the minimum percentage expected from the input
* @param maximumInput the maximum percentage expected from the output
*/
public synchronized void setInputRange(double minimumInput,double maximumInput) {
if (minimumInput > maximumInput) {
throw new BoundaryException("Lower bound is greater than upper bound");
}
m_minimumInput = minimumInput;
m_maximumInput = maximumInput;
setSetpoint(m_setpoint);
}
项目:649code2014
文件:PIDController649.java
/**
* Sets the minimum and maximum values to write.
*
* @param minimumOutput the minimum percentage to write to the output
* @param maximumOutput the maximum percentage to write to the output
*/
public synchronized void setoutputRange(double minimumOutput,double maximumOutput) {
if (minimumOutput > maximumOutput) {
throw new BoundaryException("Lower bound is greater than upper bound");
}
m_minimumOutput = minimumOutput;
m_maximumOutput = maximumOutput;
}
项目:wpilib-java
文件:AnalogTrigger.java
/**
* Set the upper and lower limits of the analog trigger.
* The limits are given in ADC codes. If oversampling is used,final int upper) {
if (lower > upper) {
throw new BoundaryException("Lower bound is greater than upper");
}
m_trigger.writeLowerLimit(lower);
m_trigger.writeUpperLimit(upper);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。