| 
 | |||||||||
| 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.DigitalModule
public class DigitalModule
Class representing a digital module
| Field Summary | |
|---|---|
| static int | kExpectedLoopTimingExpected loop timing | 
| Fields inherited from class edu.wpi.first.wpilibj.Module | 
|---|
| m_moduleNumber, m_modules, m_moduleType | 
| Fields inherited from class edu.wpi.first.wpilibj.SensorBase | 
|---|
| kAnalogChannels, kAnalogModules, kDigitalChannels, kPwmChannels, kRelayChannels, kSolenoidChannels, kSolenoidModules, kSystemClockTicksPerMicrosecond | 
| Constructor Summary | |
|---|---|
| protected  | DigitalModule(int moduleNumber)Create a new digital module | 
| Method Summary | |
|---|---|
|  boolean | allocateDIO(int channel,
                       boolean input)Allocate Digital I/O channels. | 
|  int | allocateDO_PWM()Allocate a DO PWM Generator. | 
|  void | freeDIO(int channel)Free the resource associated with a digital I/O channel. | 
|  void | freeDO_PWM(int pwmGenerator)Free the resource associated with a DO PWM generator. | 
|  short | getAllDIO()Read the state of all the Digital I/O lines from the FPGA These are not remapped to logical order. | 
|  boolean | getDIO(int channel)Read a digital I/O bit from the FPGA. | 
|  short | getDIODirection()Read the direction of all the Digital I/O lines from the FPGA A 1 bit means output and a 0 bit means input. | 
|  boolean | getDIODirection(int channel)Read the direction of a digital I/O line | 
|  I2C | getI2C(int address)Return an I2C object for this digital module | 
| static DigitalModule | getInstance(int moduleNumber)Get an instance of an Digital Module. | 
|  int | getLoopTiming()Get the loop timing of the Digital Module | 
|  int | getPWM(int channel)Get a value from a PWM channel. | 
|  byte | getRelayForward()Get the current state of all of the forward relay channels on this module. | 
|  boolean | getRelayForward(int channel)Get the current state of the forward relay channel | 
|  byte | getRelayReverse()Get the current state of all of the reverse relay channels on this module. | 
|  boolean | getRelayReverse(int channel)Get the current state of the reverse relay channel | 
|  boolean | isPulsing()Check if any DIO line is currently generating a pulse. | 
|  boolean | isPulsing(int channel)Check a DIO line to see if it is currently generating a pulse. | 
|  void | pulse(int channel,
           int pulseLength)Generate a single pulse. | 
| static int | remapDigitalChannel(int channel)Convert a channel to its fpga reference | 
|  void | setDIO(int channel,
             boolean value)Write a digital I/O bit to the FPGA. | 
|  void | setDO_PWMDutyCycle(int pwmGenerator,
                                     double dutyCycle)Configure the duty-cycle of the PWM generator | 
|  void | setDO_PWMOutputChannel(int pwmGenerator,
                                             int channel)Configure which DO channel the PWM siganl is output on | 
|  void | setDO_PWMRate(double rate)Change the frequency of the DO PWM generator. | 
|  void | setPWM(int channel,
             int value)Set a PWM channel to the desired value. | 
|  void | setPWMPeriodScale(int channel,
                                   int squelchMask)Set how how often the PWM signal is squelched, thus scaling the period. | 
|  void | setRelayForward(int channel,
                               boolean on)Set the state of a relay. | 
|  void | setRelayReverse(int channel,
                               boolean on)Set the state of a relay. | 
| static int | unmapDigitalChannel(int channel)Convert a channel from it's fpga reference | 
| 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, 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 kExpectedLoopTiming
| Constructor Detail | 
|---|
protected DigitalModule(int moduleNumber)
moduleNumber - The number of the digital module to use (1 or 2)| Method Detail | 
|---|
public static DigitalModule getInstance(int moduleNumber)
moduleNumber - The number of the digital module to access.
public static int remapDigitalChannel(int channel)
channel - the channel to convert
public static int unmapDigitalChannel(int channel)
channel - the channel to convert
public void setPWM(int channel,
                   int value)
channel - The PWM channel to set.value - The PWM value to set.public int getPWM(int channel)
channel - The PWM channel to read from.
public void setPWMPeriodScale(int channel,
                              int squelchMask)
channel - The PWM channel to configure.squelchMask - The 2-bit mask of outputs to squelch.
public void setRelayForward(int channel,
                            boolean on)
channel - The Relay channel.on - Indicates whether to set the relay to the On state.
public void setRelayReverse(int channel,
                            boolean on)
channel - The Relay channel.on - Indicates whether to set the relay to the On state.public boolean getRelayForward(int channel)
channel - the channel of the relay to get
public byte getRelayForward()
public boolean getRelayReverse(int channel)
channel - the channel of the relay to get
public byte getRelayReverse()
public boolean allocateDIO(int channel,
                           boolean input)
channel - The channel to allocate.input - Indicates whether the I/O pin is an input (true) or an output (false).
public void freeDIO(int channel)
channel - The channel whose resources should be freed.
public void setDIO(int channel,
                   boolean value)
channel - The channel to set.value - The value to set.public boolean getDIO(int channel)
channel - The channel to read
public short getAllDIO()
public boolean getDIODirection(int channel)
channel - The channel of the DIO to get the direction of.
public short getDIODirection()
public void pulse(int channel,
                  int pulseLength)
channel - The channel to pulse.pulseLength - The length of the pulse.public boolean isPulsing(int channel)
channel - The channel to check.
public boolean isPulsing()
public int allocateDO_PWM()
public void freeDO_PWM(int pwmGenerator)
public void setDO_PWMRate(double rate)
rate - The frequency to output all digital output PWM signals on this module.
public void setDO_PWMOutputChannel(int pwmGenerator,
                                   int channel)
pwmGenerator - The generator index reserved by allocateDO_PWM()channel - The Digital Output channel to output on
public void setDO_PWMDutyCycle(int pwmGenerator,
                               double dutyCycle)
pwmGenerator - The generator index reserved by allocateDO_PWM()dutyCycle - The percent duty cycle to output [0..1].public I2C getI2C(int address)
address - The device address.
public int getLoopTiming()
| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||