| java.lang.Object | |
| ↳ | com.digi.android.pwm.PWM |
Represents a PWM (Pulse Width Modulation) channel. A PWM channel
lets you control the physical module PWM interface.
To obtain an instance of the PWM you have to use the
PWMManager.createPWM(int) method.
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| int | FREQUENCY |
This constant is deprecated.
This constant is no longer acceptable for default frequency. Use ERROR(/getFrequency())
|
|||||||||
| long | PERIOD |
This constant is deprecated.
This constant is no longer acceptable for default period. Use ERROR(/getPeriod())
|
|||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Retrieves the PWM channel index.
| |||||||||||
Retrieves the PWM chip.
| |||||||||||
This method is deprecated.
This method is no longer acceptable to read the PWM channel duty cycle percentage.
Use | |||||||||||
Retrieves the configured duty cycle percentage of this PWM channel.
| |||||||||||
Retrieves the configured duty cycle of this PWM channel in nanoseconds.
| |||||||||||
Retrieves the configured frequency of this PWM channel in Hz.
| |||||||||||
Retrieves the configured period of this PWM channel in nanoseconds.
| |||||||||||
Retrieves the configured polarity of this PWM channel.
| |||||||||||
Retrieves the enable status of this PWM channel.
| |||||||||||
This method is deprecated.
This method is no longer acceptable to set the PWM channel duty cycle percentage.
Use | |||||||||||
Sets the duty cycle percentage of the PWM signal.
| |||||||||||
Sets the duty cycle of the PWM signal in nanoseconds.
| |||||||||||
Changes the enable status of this PWM channel.
| |||||||||||
Sets the frequency of the PWM signal in Hz.
| |||||||||||
Sets the period of the PWM signal in nanoseconds.
| |||||||||||
Sets the polarity of the PWM signal.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||||
This constant is deprecated.
This constant is no longer acceptable for default frequency. Use ERROR(/getFrequency())
Default frequency configured in the PWM: .FREQUENCY Hz.
This constant is deprecated.
This constant is no longer acceptable for default period. Use ERROR(/getPeriod())
Default period configured in the PWM: .PERIOD nanoseconds.
| Parameters | |
|---|---|
other |
Object |
| Returns | |
|---|---|
boolean |
|
This method is deprecated.
This method is no longer acceptable to read the PWM channel duty cycle percentage.
Use ERROR(/getDutyCyclePercentage()) or ERROR(/getDutyCycleRaw()) instead.
Retrieves the duty cycle percentage configured in this PWM channel.
| Returns | |
|---|---|
double |
dutyCycle The duty cycle percentage configured in this PWM channel (0 to 100%). |
| Throws | |
|---|---|
PWMException |
If there is any error reading the duty cycle. |
Retrieves the configured duty cycle percentage of this PWM channel.
| Returns | |
|---|---|
int |
The configured duty cycle percentage of this PWM channel. |
| Throws | |
|---|---|
PWMException |
If there is any error reading the duty cycle percentage. |
Retrieves the configured duty cycle of this PWM channel in nanoseconds.
| Returns | |
|---|---|
long |
The configured duty cycle of this PWM channel in nanoseconds. |
| Throws | |
|---|---|
PWMException |
If there is any error reading the duty cycle. |
Retrieves the configured frequency of this PWM channel in Hz.
| Returns | |
|---|---|
long |
The configured frequency of this PWM channel in Hz. |
| Throws | |
|---|---|
PWMException |
If there is any error reading the frequency. |
Retrieves the configured period of this PWM channel in nanoseconds.
| Returns | |
|---|---|
long |
The configured period of this PWM channel in nanoseconds. |
| Throws | |
|---|---|
PWMException |
If there is any error reading the period. |
Retrieves the configured polarity of this PWM channel.
| Returns | |
|---|---|
PWMPolarity |
The configured polarity of this PWM channel. |
| Throws | |
|---|---|
PWMException |
If there is any error reading the polarity. |
See also:
| Returns | |
|---|---|
int |
|
Retrieves the enable status of this PWM channel.
| Returns | |
|---|---|
boolean |
true if PWM channel is enabled, false otherwise. |
| Throws | |
|---|---|
PWMException |
If there is any error reading the enable status. |
See also:
This method is deprecated.
This method is no longer acceptable to set the PWM channel duty cycle percentage.
Use ERROR(/setDutyCyclePercentage(double)) or ERROR(/setDutyCycleRaw(long)) instead.
Sets the duty cycle percentage of the PWM signal.
| Parameters | |
|---|---|
dutyCycle |
double: The duty cycle percentage of the PWM signal (0 to 100%). |
| Throws | |
|---|---|
IllegalArgumentException |
If dutyCycle < 0 or dutyCycle > 100. |
PWMException |
If there is any error setting the duty cycle. |
Sets the duty cycle percentage of the PWM signal.
| Parameters | |
|---|---|
percentage |
int: The new duty cycle percentage to set. |
| Throws | |
|---|---|
IllegalArgumentException |
If percentage < 0 or
if percentage > 100 |
PWMException |
If there is any error setting the duty cycle percentage. |
Sets the duty cycle of the PWM signal in nanoseconds.
| Parameters | |
|---|---|
dutyCycle |
long: The new duty cycle to set in nanoseconds. |
| Throws | |
|---|---|
IllegalArgumentException |
If dutyCycle < 0 or the duty cycle
to set is greater than the configured period. |
PWMException |
If there is any error setting the duty cycle. |
Changes the enable status of this PWM channel.
| Parameters | |
|---|---|
enable |
boolean: true to enable the PWM channel, false
to disable it. |
| Throws | |
|---|---|
PWMException |
If there is any error changing the enable status. |
See also:
Sets the frequency of the PWM signal in Hz.
| Parameters | |
|---|---|
frequency |
long: The new frequency to set in Hz. |
| Throws | |
|---|---|
IllegalArgumentException |
If frequency <= 0 or
if frequency > 1000000000 |
PWMException |
If there is any error setting the frequency. |
See also:
Sets the period of the PWM signal in nanoseconds.
| Parameters | |
|---|---|
period |
long: The new period to set in nanoseconds. |
| Throws | |
|---|---|
IllegalArgumentException |
If period < 1 |
PWMException |
If there is any error setting the period. |
Sets the polarity of the PWM signal.
| Parameters | |
|---|---|
polarity |
PWMPolarity: The new polarity to set. |
| Throws | |
|---|---|
NullPointerException |
If polarity == null |
PWMException |
If there is any error setting the polarity. |
See also:
| Returns | |
|---|---|
String |
|