public class PulseCounterConfig extends java.lang.Object implements DeviceConfig<PulseCounter>, DeviceConfig.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
DeviceConfig.DEFAULT
. Whether such default settings are supported is platform- as well as device
driver-dependent.
An instance of PulseCounterConfig
can be passed to the
DeviceManager.open(DeviceConfig)
or
DeviceManager.open(Class, DeviceConfig)
method to open the designated counter
with the specified configuration. A InvalidDeviceConfigException
is thrown when
attempting to open a device with an invalid or unsupported configuration.DeviceConfig.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 controllerNumber,
int channelNumber,
int type)
Creates a new
PulseCounterConfig with the specified hardware addressing information
and type. |
PulseCounterConfig(int controllerNumber,
int channelNumber,
int type,
GPIOPinConfig source)
Creates a new
PulseCounterConfig the specified hardware addressing information, type
and GPIO pin source. |
PulseCounterConfig(java.lang.String controllerName,
int channelNumber,
int type)
Creates a new
PulseCounterConfig with the specified hardware addressing information
and type. |
PulseCounterConfig(java.lang.String controllerName,
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 |
getControllerName()
Gets the configured controller name (such as its device file name on UNIX systems).
|
int |
getControllerNumber()
Gets the configured controller number.
|
GPIOPin |
getSource()
Gets the 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 controllerNumber, 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).controllerNumber
- the hardware controller's number (a positive or zero integer) or DeviceConfig.DEFAULT
.channelNumber
- the hardware counter's number (a positive or zero integer) or DeviceConfig.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:
controllerNumber
is not in the defined range;channelNumber
is not in the defined range;type
is not one of the defined values.public PulseCounterConfig(int controllerNumber, int channelNumber, int type, GPIOPinConfig source)
PulseCounterConfig
the specified hardware addressing information, type
and GPIO pin source.controllerNumber
- the hardware controller's number (a positive or zero integer) or DeviceConfig.DEFAULT
.channelNumber
- the hardware counter's number (a positive or zero integer) or DeviceConfig.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:
controllerNumber
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 controllerName, 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).controllerName
- the controller name (such as its device file name on UNIX systems).channelNumber
- the hardware counter's number (a positive or zero integer) or DeviceConfig.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 controllerName
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 controllerName, int channelNumber, int type, GPIOPinConfig source)
PulseCounterConfig
the specified hardware addressing information, type
and GPIO pin source.controllerName
- the controller name (such as its device file name on UNIX systems).channelNumber
- the hardware counter's number (a positive or zero integer) or DeviceConfig.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 controllerName
or source
is null
.public int getControllerNumber()
getControllerNumber
in interface DeviceConfig.HardwareAddressing
DeviceConfig.DEFAULT
.public int getChannelNumber()
DeviceConfig.DEFAULT
.public java.lang.String getControllerName()
getControllerName
in interface DeviceConfig.HardwareAddressing
null
.public GPIOPin getSource()
IOException
being thrown by counting operations.null
if the source is implicit
or if this PusleCounterConfig
instance is not associated to an actual PulseCounter
instance.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.Object
public boolean equals(java.lang.Object obj)
PulseCounterConfig
objects for equality.equals
in class java.lang.Object
obj
- 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, 2014, Oracle and/or its affiliates. All rights reserved.
Legal Notices