|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.wpi.first.wpilibj.SensorBase
edu.wpi.first.wpilibj.Module
edu.wpi.first.wpilibj.AnalogModule
public class AnalogModule
Analog Module class. Each module can independently sample its channels at a configurable rate. There is a 64-bit hardware accumulator associated with channel 1 on each module. The accumulator is attached to the output of the oversample and average engine so that the center value can be specified in higher resolution resulting in less error.
| Field Summary | |
|---|---|
static int |
kDefaultAverageBits
The default number of averaging bits to use |
static int |
kDefaultOversampleBits
The default number of Oversample bits to use |
static double |
kDefaultSampleRate
The default sample rate |
static int |
kTimebase
The time base used by the module |
| Fields inherited from class edu.wpi.first.wpilibj.Module |
|---|
m_hwModule, m_moduleNumber, m_moduleType |
| Fields inherited from class edu.wpi.first.wpilibj.SensorBase |
|---|
kAnalogChannels, kAnalogModules, kDigitalChannels, kPwmChannels, kRelayChannels, kSolenoidChannels, kSolenoidModules, kSystemClockTicksPerMicrosecond, n_simProperties |
| Constructor Summary | |
|---|---|
protected |
AnalogModule(int moduleNumber)
Create a new instance of an analog module. |
| Method Summary | |
|---|---|
int |
getAverageBits(int channel)
Get the number of averaging bits. |
int |
getAverageValue(int channel)
Get the raw averaged and oversampled value. |
double |
getAverageVoltage(int channel)
Get the averaged voltage. |
static AnalogModule |
getInstance(int moduleNumber)
Get an instance of an Analog Module. |
long |
getLSBWeight(int channel)
Get the LSB Weight portion of the calibration for a channel. |
int |
getOffset(int channel)
Get the Offset portion of the calibration for a channel. |
int |
getOversampleBits(int channel)
Get the number of oversample bits. |
double |
getSampleRate()
Get the current sample rate on the module. |
int |
getValue(int channel)
Get the raw analog value. |
double |
getVoltage(int channel)
Get the voltage. |
void |
setAverageBits(int channel,
int bits)
Set the number of averaging bits. |
void |
setOversampleBits(int channel,
int bits)
Set the number of oversample bits. |
void |
setSampleRate(double samplesPerSecond)
Set the sample rate on the module. |
int |
voltsToValue(int channel,
double voltage)
Convert a voltage to a raw value for a specified channel. |
| Methods inherited from class edu.wpi.first.wpilibj.Module |
|---|
getModule, getModuleNumber, getModuleType |
| Methods inherited from class edu.wpi.first.wpilibj.SensorBase |
|---|
checkAnalogChannel, checkAnalogModule, checkDigitalChannel, checkDigitalModule, checkPWMChannel, checkPWMModule, checkRelayChannel, checkRelayModule, checkSolenoidChannel, checkSolenoidModule, free, getDefaultAnalogModule, getDefaultDigitalModule, getDefaultSolenoidModule, getSimProperties, setDefaultAnalogModule, setDefaultDigitalModule, setDefaultSolenoidModule |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int kTimebase
public static final int kDefaultOversampleBits
public static final int kDefaultAverageBits
public static final double kDefaultSampleRate
| Constructor Detail |
|---|
protected AnalogModule(int moduleNumber)
moduleNumber - The index of the analog module to create (1 or 2).| Method Detail |
|---|
public static AnalogModule getInstance(int moduleNumber)
moduleNumber - The index of the analog module to get (1 or 2).
public void setSampleRate(double samplesPerSecond)
samplesPerSecond - The number of samples per channel per second.public double getSampleRate()
public void setAverageBits(int channel,
int bits)
channel - Analog channel to configure.bits - Number of bits to average.public int getAverageBits(int channel)
channel - Channel to address.
public void setOversampleBits(int channel,
int bits)
channel - Analog channel to configure.bits - Number of bits to oversample.public int getOversampleBits(int channel)
channel - Channel to address.
public int getValue(int channel)
channel - Channel number to read.
public int getAverageValue(int channel)
channel - Channel number to read.
public int voltsToValue(int channel,
double voltage)
channel - The channel to convert for.voltage - The voltage to convert.
public double getVoltage(int channel)
channel - The channel to read.
public double getAverageVoltage(int channel)
channel - The channel to read.
public long getLSBWeight(int channel)
channel - The channel to get calibration data for.
public int getOffset(int channel)
channel - The channel to get calibration data for.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||