public class PulseCounterConfig extends java.lang.Object implements PeripheralConfig<PulseCounter>, PeripheralConfig.HardwareAddressing
PulseCounterConfig class encapsulates the hardware addressing information, and static and dynamic
configuration parameters of a pulse counter.
Some hardware addressing parameter, and static and dynamic configuration parameters may be set to PeripheralConfig.DEFAULT.
Whether such default settings are supported is platform- as well as peripheral driver-dependent.
An instance of PulseCounterConfig can be passed to the PeripheralManager.open(PeripheralConfig) or
PeripheralManager.open(Class, PeripheralConfig) method to open the designated counter with the specified
configuration. A PeripheralConfigInvalidException is thrown when attempting to open a peripheral device with
an invalid or unsupported configuration.PeripheralConfig.HardwareAddressing| Modifier and Type | Field and Description |
|---|---|
static int |
TYPE_FALLING_EDGE_ONLY
Falling pulse edge (counting only falling pulse edges).
|
static int |
TYPE_NEGATIVE_PULSE
Negative edge pulse: measured from falling edge to rising edge (counting well-formed negative edge pulses).
|
static int |
TYPE_POSITIVE_PULSE
Positive edge pulse: measured from rising edge to falling edge (counting well-formed positive edge pulses).
|
static int |
TYPE_RISING_EDGE_ONLY
Rising pulse edge (counting only rising pulse edges).
|
DEFAULT| Constructor and Description |
|---|
PulseCounterConfig(int deviceNumber,
int channelNumber,
int type)
Creates a new
PulseCounterConfig with the specified hardware addressing information and type. |
PulseCounterConfig(int deviceNumber,
int channelNumber,
int type,
GPIOPin source)
Creates a new
PulseCounterConfig the specified hardware addressing information, type and GPIO pin source. |
PulseCounterConfig(int deviceNumber,
int channelNumber,
int type,
GPIOPinConfig source)
Creates a new
PulseCounterConfig the specified hardware addressing information, type and GPIO pin source. |
PulseCounterConfig(java.lang.String deviceName,
int channelNumber,
int type)
Creates a new
PulseCounterConfig with the specified hardware addressing information and type. |
PulseCounterConfig(java.lang.String deviceName,
int channelNumber,
int type,
GPIOPin source)
Creates a new
PulseCounterConfig the specified hardware addressing information, type and GPIO pin source. |
PulseCounterConfig(java.lang.String deviceName,
int channelNumber,
int type,
GPIOPinConfig source)
Creates a new
PulseCounterConfig the specified hardware addressing information, type and GPIO pin source. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj)
Checks two
PulseCounterConfig objects for equality. |
int |
getChannelNumber()
Gets the configured counter number.
|
java.lang.String |
getDeviceName()
Gets the configured device name (such as to its device file name on UNIX systems).
|
int |
getDeviceNumber()
Gets the configured device number.
|
GPIOPin |
getSource()
Gets the configured input source on which the pulses are to be counted/measured.
|
GPIOPinConfig |
getSourceConfig()
Gets the configured input source configuration on which the pulses are to be counted/measured.
|
int |
getType()
Gets the configured pulse or pulse edge type.
|
int |
hashCode()
Returns the hash code value for this object.
|
public static final int TYPE_FALLING_EDGE_ONLY
GPIOPinConfig.TRIGGER_FALLING_EDGE
trigger mode.public static final int TYPE_NEGATIVE_PULSE
GPIOPinConfig.TRIGGER_BOTH_EDGES
trigger mode.public static final int TYPE_POSITIVE_PULSE
GPIOPinConfig.TRIGGER_BOTH_EDGES
trigger mode.public static final int TYPE_RISING_EDGE_ONLY
GPIOPinConfig.TRIGGER_RISING_EDGE
trigger mode.public PulseCounterConfig(int deviceNumber,
int channelNumber,
int type)
PulseCounterConfig with the specified hardware addressing information and type. The source
of the pulse counter is implicit (such as a dedicated input pin).deviceNumber - the hardware controller's number (a positive or zero integer) or PeripheralConfig.DEFAULT.channelNumber - the hardware counter's number (a positive or zero integer) or PeripheralConfig.DEFAULT.type - the pulse or pulse edge type: TYPE_FALLING_EDGE_ONLY, TYPE_RISING_EDGE_ONLY,
TYPE_NEGATIVE_PULSE or TYPE_POSITIVE_PULSE.java.lang.IllegalArgumentException - if any of the following is true:
deviceNumber is not in the defined range;channelNumber is not in the defined range;type is not one of the defined values.public PulseCounterConfig(int deviceNumber,
int channelNumber,
int type,
GPIOPin source)
PulseCounterConfig the specified hardware addressing information, type and GPIO pin source.deviceNumber - the hardware controller's number (a positive or zero integer) or PeripheralConfig.DEFAULT.channelNumber - the hardware counter's number (a positive or zero integer) or PeripheralConfig.DEFAULT.type - the pulse or pulse edge type: TYPE_FALLING_EDGE_ONLY, TYPE_RISING_EDGE_ONLY,
TYPE_NEGATIVE_PULSE or TYPE_POSITIVE_PULSE.source - the configuration of the source (a GPIO input pin) on which the pulses are to be counted.java.lang.IllegalArgumentException - if any of the following is true:
deviceNumber is not in the defined range;channelNumber is not in the defined range;type is not one of the defined values;java.lang.NullPointerException - if source is null.public PulseCounterConfig(int deviceNumber,
int channelNumber,
int type,
GPIOPinConfig source)
PulseCounterConfig the specified hardware addressing information, type and GPIO pin source.deviceNumber - the hardware controller's number (a positive or zero integer) or PeripheralConfig.DEFAULT.channelNumber - the hardware counter's number (a positive or zero integer) or PeripheralConfig.DEFAULT.type - the pulse or pulse edge type: TYPE_FALLING_EDGE_ONLY, TYPE_RISING_EDGE_ONLY,
TYPE_NEGATIVE_PULSE or TYPE_POSITIVE_PULSE.source - the configuration of the source (a GPIO input pin) on which the pulses are to be counted.java.lang.IllegalArgumentException - if any of the following is true:
deviceNumber is not in the defined range;channelNumber is not in the defined range;type is not one of the defined values;java.lang.NullPointerException - if source is null.public PulseCounterConfig(java.lang.String deviceName,
int channelNumber,
int type)
PulseCounterConfig with the specified hardware addressing information and type. The source
of the pulse counter is implicit (such as a dedicated input pin).deviceName - the device name (such as to its device file name on UNIX systems).channelNumber - the hardware counter's number (a positive or zero integer) or PeripheralConfig.DEFAULT.type - the pulse or pulse edge type: TYPE_FALLING_EDGE_ONLY, TYPE_RISING_EDGE_ONLY,
TYPE_NEGATIVE_PULSE or TYPE_POSITIVE_PULSE.java.lang.NullPointerException - if deviceName is null.java.lang.IllegalArgumentException - if any of the following is true:
channelNumber is not in the defined range;type is not one of the defined values.public PulseCounterConfig(java.lang.String deviceName,
int channelNumber,
int type,
GPIOPinConfig source)
PulseCounterConfig the specified hardware addressing information, type and GPIO pin source.deviceName - the device name (such as to its device file name on UNIX systems).channelNumber - the hardware counter's number (a positive or zero integer) or PeripheralConfig.DEFAULT.type - the pulse or pulse edge type: TYPE_FALLING_EDGE_ONLY, TYPE_RISING_EDGE_ONLY,
TYPE_NEGATIVE_PULSE or TYPE_POSITIVE_PULSE.source - the configuration of the source (a GPIO input pin) on which the pulses are to be counted.java.lang.IllegalArgumentException - if any of the following is true:
channelNumber is not in the defined range;type is not one of the defined values;java.lang.NullPointerException - if deviceName or source is null.public PulseCounterConfig(java.lang.String deviceName,
int channelNumber,
int type,
GPIOPin source)
PulseCounterConfig the specified hardware addressing information, type and GPIO pin source.deviceName - the device name (such as to its device file name on UNIX systems).channelNumber - the hardware counter's number (a positive or zero integer) or PeripheralConfig.DEFAULT.type - the pulse or pulse edge type: TYPE_FALLING_EDGE_ONLY, TYPE_RISING_EDGE_ONLY,
TYPE_NEGATIVE_PULSE or TYPE_POSITIVE_PULSE.source - the configuration of the source (a GPIO input pin) on which the pulses are to be counted.java.lang.IllegalArgumentException - if any of the following is true:
channelNumber is not in the defined range;type is not one of the defined values;java.lang.NullPointerException - if deviceName or source is null.public int getDeviceNumber()
getDeviceNumber in interface PeripheralConfig.HardwareAddressingPeripheralConfig.DEFAULT.public int getChannelNumber()
PeripheralConfig.DEFAULT.public java.lang.String getDeviceName()
getDeviceName in interface PeripheralConfig.HardwareAddressingnull.public GPIOPin getSource()
null if the source is implicit.public GPIOPinConfig getSourceConfig()
null if the source is implicit.public int getType()
TYPE_FALLING_EDGE_ONLY, TYPE_RISING_EDGE_ONLY,
TYPE_NEGATIVE_PULSE or TYPE_POSITIVE_PULSE.public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
PulseCounterConfig objects for equality.equals in class java.lang.Objectobj - the object to test for equality with this object.true if obj is a PulseCounterConfig and has
the same hardware addressing information and configuration parameter values
as this PulseCounterConfig object.Copyright © 2012, 2013, Oracle and/or its affiliates. All rights reserved.
Legal Notices