public class PWMChannelConfig extends java.lang.Object implements PeripheralConfig<PWMChannel>, PeripheralConfig.HardwareAddressing
PWMChannelConfig class encapsulates the hardware addressing information, and static and dynamic
configuration parameters of a PWM channel.
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 PWMChannelConfig can be passed to the PeripheralManager.open(PeripheralConfig) or
PeripheralManager.open(Class, PeripheralConfig) method to open the designated PWM channel 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 |
ALIGN_CENTER
Center alignement.
|
static int |
ALIGN_LEFT
Left alignement.
|
static int |
ALIGN_RIGHT
Right alignement.
|
static int |
IDLE_STATE_HIGH
High idle state.
|
static int |
IDLE_STATE_LOW
Low idle state.
|
DEFAULT| Constructor and Description |
|---|
PWMChannelConfig(int deviceNumber,
int channelNumber,
int idleState,
int pulsePeriod,
int pulseAlignment)
Creates a new
PWMChannelConfig with the specified hardware addressing information and type. |
PWMChannelConfig(int deviceNumber,
int channelNumber,
int idleState,
int pulsePeriod,
int pulseAlignment,
GPIOPin output)
Creates a new
PWMChannelConfig the specified hardware addressing information, type and GPIO pin output. |
PWMChannelConfig(int deviceNumber,
int channelNumber,
int idleState,
int pulsePeriod,
int pulseAlignment,
GPIOPinConfig output)
Creates a new
PWMChannelConfig the specified hardware addressing information, type and GPIO pin output. |
PWMChannelConfig(java.lang.String deviceName,
int channelNumber,
int idleState,
int pulsePeriod,
int pulseAlignment)
Creates a new
PWMChannelConfig with the specified hardware addressing information and type. |
PWMChannelConfig(java.lang.String deviceName,
int channelNumber,
int idleState,
int pulsePeriod,
int pulseAlignment,
GPIOPin output)
Creates a new
PWMChannelConfig the specified hardware addressing information, type and GPIO pin output. |
PWMChannelConfig(java.lang.String deviceName,
int channelNumber,
int idleState,
int pulsePeriod,
int pulseAlignment,
GPIOPinConfig output)
Creates a new
PWMChannelConfig the specified hardware addressing information, type and GPIO pin output. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj)
Checks two
PWMChannelConfig objects for equality. |
int |
getChannelNumber()
Gets the configured PWM channel 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 (the PWM controller or generator number).
|
int |
getIdleState()
Gets the configured idle output state.
|
GPIOPin |
getOutput()
Gets the configured output on which the pulses are to be generated.
|
GPIOPinConfig |
getOutputConfig()
Gets the configured output configuration on which the pulses are to be generated.
|
int |
getPulseAlignment()
Gets the configured pulse alignment.
|
int |
getPulsePeriod()
Gets the configured default/initial pulse period (in microseconds).
|
int |
hashCode()
Returns the hash code value for this object.
|
public static final int IDLE_STATE_HIGH
public static final int IDLE_STATE_LOW
public static final int ALIGN_CENTER
public static final int ALIGN_LEFT
public static final int ALIGN_RIGHT
public PWMChannelConfig(int deviceNumber,
int channelNumber,
int idleState,
int pulsePeriod,
int pulseAlignment)
PWMChannelConfig with the specified hardware addressing information and type. The output of
the PWM channel is implicit (such as a dedicated output pin).deviceNumber - the hardware PWM controller (or generator)'s number (a positive or zero integer) or PeripheralConfig.DEFAULT.channelNumber - the hardware PWM channel's number (a positive or zero integer) or PeripheralConfig.DEFAULT.idleState - the output idle state: IDLE_STATE_HIGH, IDLE_STATE_LOW or PeripheralConfig.DEFAULT.pulsePeriod - the default pulse period in microseconds (a positive integer) or PeripheralConfig.DEFAULT.pulseAlignment - the pulse alignment: ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT or
PeripheralConfig.DEFAULT.java.lang.IllegalArgumentException - if any of the following is true:
deviceNumber is not in the defined range;channelNumber is not in the defined range;idleState is not in the defined range;pulsePeriod is not in the defined range.pulseAlignment is not in the defined range.public PWMChannelConfig(int deviceNumber,
int channelNumber,
int idleState,
int pulsePeriod,
int pulseAlignment,
GPIOPinConfig output)
PWMChannelConfig the specified hardware addressing information, type and GPIO pin output.deviceNumber - the hardware PWM controller (or generator)'s number (a positive or zero integer) or PeripheralConfig.DEFAULT.channelNumber - the hardware PWM channel's number (a positive or zero integer) or PeripheralConfig.DEFAULT.idleState - the output idle state: IDLE_STATE_HIGH, IDLE_STATE_LOW or PeripheralConfig.DEFAULT.pulsePeriod - the default pulse period in microseconds (a positive integer) or PeripheralConfig.DEFAULT.pulseAlignment - the pulse alignment: ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT or
PeripheralConfig.DEFAULT.output - the configuration of the output (a GPIO output pin) on which the pulses are to be generated.java.lang.IllegalArgumentException - if any of the following is true:
deviceNumber is not in the defined range;channelNumber is not in the defined range;idleState is not in the defined range;pulsePeriod is not in the defined range.pulseAlignment is not in the defined range.java.lang.NullPointerException - if output is null.public PWMChannelConfig(int deviceNumber,
int channelNumber,
int idleState,
int pulsePeriod,
int pulseAlignment,
GPIOPin output)
PWMChannelConfig the specified hardware addressing information, type and GPIO pin output.deviceNumber - the hardware PWM controller (or generator)'s number (a positive or zero integer) or PeripheralConfig.DEFAULT.channelNumber - the hardware PWM channel's number (a positive or zero integer) or PeripheralConfig.DEFAULT.idleState - the output idle state: IDLE_STATE_HIGH, IDLE_STATE_LOW or PeripheralConfig.DEFAULT.pulsePeriod - the default pulse period in microseconds (a positive integer) or PeripheralConfig.DEFAULT.pulseAlignment - the pulse alignment: ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT or
PeripheralConfig.DEFAULT.output - the configuration of the output (a GPIO output pin) on which the pulses are to be generated.java.lang.IllegalArgumentException - if any of the following is true:
deviceNumber is not in the defined range;channelNumber is not in the defined range;idleState is not in the defined range;pulsePeriod is not in the defined range.pulseAlignment is not in the defined range.java.lang.NullPointerException - if output is null.public PWMChannelConfig(java.lang.String deviceName,
int channelNumber,
int idleState,
int pulsePeriod,
int pulseAlignment)
PWMChannelConfig with the specified hardware addressing information and type. The output of
the PWM channel is implicit (such as a dedicated output pin).deviceName - the device name (such as to its device file name on UNIX systems).channelNumber - the hardware PWM channel's number (a positive or zero integer) or PeripheralConfig.DEFAULT.idleState - the output idle state: IDLE_STATE_HIGH, IDLE_STATE_LOW or PeripheralConfig.DEFAULT.pulsePeriod - the default pulse period in microseconds (a positive integer) or PeripheralConfig.DEFAULT.pulseAlignment - the pulse alignment: ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT or
PeripheralConfig.DEFAULT.java.lang.IllegalArgumentException - if any of the following is true:
channelNumber is not in the defined range;idleState is not in the defined range;pulsePeriod is not in the defined range.pulseAlignment is not in the defined range.java.lang.NullPointerException - if deviceName is null.public PWMChannelConfig(java.lang.String deviceName,
int channelNumber,
int idleState,
int pulsePeriod,
int pulseAlignment,
GPIOPinConfig output)
PWMChannelConfig the specified hardware addressing information, type and GPIO pin output.deviceName - the device name (such as to its device file name on UNIX systems).channelNumber - the hardware PWM channel's number (a positive or zero integer) or PeripheralConfig.DEFAULT.idleState - the output idle state: IDLE_STATE_HIGH, IDLE_STATE_LOW or PeripheralConfig.DEFAULT.pulsePeriod - the default pulse period in microseconds (a positive integer) or PeripheralConfig.DEFAULT.pulseAlignment - the pulse alignment: ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT or
PeripheralConfig.DEFAULT.output - the configuration of the output (a GPIO output pin) on which the pulses are to be generated.java.lang.IllegalArgumentException - if any of the following is true:
channelNumber is not in the defined range;idleState is not in the defined range;pulsePeriod is not in the defined range.pulseAlignment is not in the defined range.java.lang.NullPointerException - if deviceName or output is null.public PWMChannelConfig(java.lang.String deviceName,
int channelNumber,
int idleState,
int pulsePeriod,
int pulseAlignment,
GPIOPin output)
PWMChannelConfig the specified hardware addressing information, type and GPIO pin output.deviceName - the device name (such as to its device file name on UNIX systems).channelNumber - the hardware PWM channel's number (a positive or zero integer) or PeripheralConfig.DEFAULT.idleState - the output idle state: IDLE_STATE_HIGH, IDLE_STATE_LOW or PeripheralConfig.DEFAULT.pulsePeriod - the default pulse period in microseconds (a positive integer) or PeripheralConfig.DEFAULT.pulseAlignment - the pulse alignment: ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT or
PeripheralConfig.DEFAULT.output - the configuration of the output (a GPIO output pin) on which the pulses are to be generated.java.lang.IllegalArgumentException - if any of the following is true:
channelNumber is not in the defined range;idleState is not in the defined range;pulsePeriod is not in the defined range.pulseAlignment is not in the defined range.java.lang.NullPointerException - if deviceName or output is null.public int getChannelNumber()
PeripheralConfig.DEFAULT.public int getDeviceNumber()
getDeviceNumber in interface PeripheralConfig.HardwareAddressingPeripheralConfig.DEFAULT.public java.lang.String getDeviceName()
getDeviceName in interface PeripheralConfig.HardwareAddressingnull.public GPIOPinConfig getOutputConfig()
null if the output is implicit.public GPIOPin getOutput()
null if the output is implicit.public int getPulsePeriod()
PeripheralConfig.DEFAULT.public int getIdleState()
IDLE_STATE_HIGH, IDLE_STATE_LOW or PeripheralConfig.DEFAULT.public int getPulseAlignment()
ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT or PeripheralConfig.DEFAULTpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
PWMChannelConfig objects for equality.equals in class java.lang.Objectobj - the object to test for equality with this object.true if obj is a PWMChannelConfig and has
the same hardware addressing information and configuration parameter values
as this PWMChannelConfig object.Copyright © 2012, 2013, Oracle and/or its affiliates. All rights reserved.
Legal Notices