Class AnalogInputJNI
java.lang.Object
org.wpilib.hardware.hal.JNIWrapper
org.wpilib.hardware.hal.AnalogInputJNI
Analog Input / Output / Trigger JNI Functions.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class JNIWrapper
JNIWrapper.Helper -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckAnalogInputChannel(int channel) Checks that the analog output channel number is valid.static booleancheckAnalogModule(byte module) Checks that the analog module number is valid.static voidfreeAnalogInputPort(int analogPortHandle) Frees an analog input port.static shortgetAnalogValue(int analogPortHandle) Gets a sample straight from the channel on this module.static doublegetAnalogValueToVolts(int analogPortHandle, int value) Get the analog voltage from a raw value.static doublegetAnalogVoltage(int analogPortHandle) Gets a scaled sample straight from the channel on this module.static intgetAnalogVoltsToValue(int analogPortHandle, double voltage) Converts a voltage to a raw value for a specified channel.static intinitializeAnalogInputPort(int channel) Initializes the analog input port using the given port object.static voidsetAnalogInputSimDevice(int handle, int device) Indicates the analog input is used by a simulated device.Methods inherited from class JNIWrapper
forceLoad, suppressUnused
-
Method Details
-
initializeAnalogInputPort
Initializes the analog input port using the given port object.- Parameters:
channel- The smartio channel.- Returns:
- the created analog input handle
- See Also:
-
freeAnalogInputPort
Frees an analog input port.- Parameters:
analogPortHandle- Handle to the analog port.- See Also:
-
checkAnalogModule
Checks that the analog module number is valid.- Parameters:
module- The analog module number.- Returns:
- Analog module is valid and present
- See Also:
-
checkAnalogInputChannel
Checks that the analog output channel number is valid. Verifies that the analog channel number is one of the legal channel numbers. Channel numbers are 0-based.- Parameters:
channel- The analog output channel number.- Returns:
- Analog channel is valid
- See Also:
-
setAnalogInputSimDevice
Indicates the analog input is used by a simulated device.- Parameters:
handle- the analog input handledevice- simulated device handle- See Also:
-
getAnalogValue
Gets a sample straight from the channel on this module.The sample is a 12-bit value representing the 0V to 3.3V range of the A/D converter in the module. The units are in A/D converter codes. Use GetVoltage() to get the analog value in calibrated units.
- Parameters:
analogPortHandle- Handle to the analog port to use.- Returns:
- A sample straight from the channel on this module.
- See Also:
-
getAnalogVoltsToValue
Converts a voltage to a raw value for a specified channel.This process depends on the calibration of each channel, so the channel must be specified.
todo This assumes raw values. Oversampling not supported as is.
- Parameters:
analogPortHandle- Handle to the analog port to use.voltage- The voltage to convert.- Returns:
- The raw value for the channel.
- See Also:
-
getAnalogValueToVolts
Get the analog voltage from a raw value.- Parameters:
analogPortHandle- Handle to the analog port the values were read from.value- The raw analog value- Returns:
- The voltage relating to the value
- See Also:
-
getAnalogVoltage
Gets a scaled sample straight from the channel on this module.The value is scaled to units of Volts.
- Parameters:
analogPortHandle- Handle to the analog port to use.- Returns:
- A scaled sample straight from the channel on this module.
- See Also:
-