class PCA9685GpioProvider extends GpioProviderBase with GpioProvider
This GPIO provider implements the PCA9685 16-channel, 12-bit PWM I2C-bus LED/Servo controller as native Pi4J GPIO pins. The PCA9685 is connected via I2C connection to the Raspberry Pi and provides 16 PWM pins that can be used for PWM output.
More information about the PCA9685 can be found here:
PCA9685.pdf
...and especially about the board here:
Adafruit 16-Channel 12-bit PWM/Servo Driver
- Alphabetic
- By Inheritance
- PCA9685GpioProvider
- GpioProviderBase
- GpioProvider
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new PCA9685GpioProvider(bus: I2CBus, address: Int, targetFrequency: BigDecimal, frequencyCorrectionFactor: BigDecimal)
- new PCA9685GpioProvider(bus: I2CBus, address: Int, targetFrequency: BigDecimal)
- new PCA9685GpioProvider(bus: I2CBus, address: Int)
- new PCA9685GpioProvider(busNumber: Int, address: Int)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def addListener(arg0: Pin, arg1: PinListener): Unit
- Definition Classes
- GpioProviderBase → GpioProvider
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def calculateOffPositionForPulseDuration(duration: Int): Int
Calculates the OFF position for a certain pulse duration.
Calculates the OFF position for a certain pulse duration.
- duration
pulse duration in microseconds
- returns
OFF position(value between 1 and 4095)
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def dispatchPinAnalogValueChangeEvent(arg0: Pin, arg1: Double): Unit
- Attributes
- protected[com.pi4j.io.gpio]
- Definition Classes
- GpioProviderBase
- def dispatchPinDigitalStateChangeEvent(arg0: Pin, arg1: PinState): Unit
- Attributes
- protected[com.pi4j.io.gpio]
- Definition Classes
- GpioProviderBase
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def export(pin: Pin, mode: PinMode): Unit
- Definition Classes
- PCA9685GpioProvider → GpioProviderBase → GpioProvider
- Annotations
- @Override()
- def export(arg0: Pin, arg1: PinMode, arg2: PinState): Unit
- Definition Classes
- GpioProviderBase → GpioProvider
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def getFrequency(): BigDecimal
- def getMode(arg0: Pin): PinMode
- Definition Classes
- GpioProviderBase → GpioProvider
- def getName(): String
- Definition Classes
- PCA9685GpioProvider → GpioProviderBase → GpioProvider
- Annotations
- @Override()
- def getPeriodDurationMicros(): Int
- def getPinCache(pin: Pin): PCA9685GpioProviderPinCache
- Attributes
- protected[pca]
- Definition Classes
- PCA9685GpioProvider → GpioProviderBase
- Annotations
- @Override()
- def getPullResistance(arg0: Pin): PinPullResistance
- Definition Classes
- GpioProviderBase → GpioProvider
- def getPwm(pin: Pin): Int
- Definition Classes
- PCA9685GpioProvider → GpioProviderBase → GpioProvider
- Annotations
- @Override()
- def getPwmOnOffValues(pin: Pin): Array[Int]
- pin
represents channel 0..15
- returns
[0]: onValue, [1]: offValue
- def getState(arg0: Pin): PinState
- Definition Classes
- GpioProviderBase → GpioProvider
- def getValue(arg0: Pin): Double
- Definition Classes
- GpioProviderBase → GpioProvider
- def hasPin(arg0: Pin): Boolean
- Definition Classes
- GpioProviderBase → GpioProvider
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def isExported(arg0: Pin): Boolean
- Definition Classes
- GpioProviderBase → GpioProvider
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isShutdown(): Boolean
- Definition Classes
- GpioProviderBase → GpioProvider
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def removeAllListeners(): Unit
- Definition Classes
- GpioProviderBase → GpioProvider
- def removeListener(arg0: Pin, arg1: PinListener): Unit
- Definition Classes
- GpioProviderBase → GpioProvider
- def reset(): Unit
Reset all outputs (set to always OFF)
- def setAlwaysOff(pin: Pin): Unit
Permanently sets the output to Low (no PWM anymore).
The LEDn_OFF_H output control bit 4, when set to logic 1, causes the output to be always OFF.Permanently sets the output to Low (no PWM anymore).
The LEDn_OFF_H output control bit 4, when set to logic 1, causes the output to be always OFF. In this case the values in the LEDn_ON registers are ignored.- pin
represents channel 0..15
- def setAlwaysOn(pin: Pin): Unit
Permanently sets the output to High (no PWM anymore).
The LEDn_ON_H output control bit 4, when set to logic 1, causes the output to be always ON.Permanently sets the output to High (no PWM anymore).
The LEDn_ON_H output control bit 4, when set to logic 1, causes the output to be always ON.- pin
represents channel 0..15
- def setFrequency(targetFrequency: BigDecimal, frequencyCorrectionFactor: BigDecimal): Unit
The built-in Oscillator runs at ~25MHz.
The built-in Oscillator runs at ~25MHz. For better accuracy user can provide a correction factor to meet desired frequency.
Note: correction is limited to a certain degree because the calculated prescale value has to be rounded to an integer value!
Example:
target freq: 50Hz
actual freq: 52.93Hz
correction factor: 52.93 / 50 = 1.0586
- targetFrequency
desired frequency
- frequencyCorrectionFactor
'actual frequency' / 'target frequency'
- def setFrequency(frequency: BigDecimal): Unit
Target frequency (accuracy is around +/- 5%!)
Target frequency (accuracy is around +/- 5%!)
- frequency
desired PWM frequency
- See also
#setFrequency(BigDecimal, BigDecimal)
- def setMode(arg0: Pin, arg1: PinMode): Unit
- Definition Classes
- GpioProviderBase → GpioProvider
- def setPullResistance(arg0: Pin, arg1: PinPullResistance): Unit
- Definition Classes
- GpioProviderBase → GpioProvider
- def setPwm(pin: Pin, onPosition: Int, offPosition: Int): Unit
The LEDn_ON and LEDn_OFF counts can vary from 0 to 4095 max.
The LEDn_ON and LEDn_OFF count registers should never be programmed with the same values.The LEDn_ON and LEDn_OFF counts can vary from 0 to 4095 max.
The LEDn_ON and LEDn_OFF count registers should never be programmed with the same values.Because the loading of the LEDn_ON and LEDn_OFF registers is via the I2C-bus, and asynchronous to the internal oscillator, we want to ensure that we do not see any visual artifacts of changing the ON and OFF values. This is achieved by updating the changes at the end of the LOW cycle.
- pin
represents channel 0..15
- onPosition
value between 0 and 4095
- offPosition
value between 0 and 4095
- def setPwm(pin: Pin, duration: Int): Unit
Set pulse duration in microseconds.
Make sure duration doesn't exceed period time(1'000'000/freq)!Set pulse duration in microseconds.
Make sure duration doesn't exceed period time(1'000'000/freq)!- pin
represents channel 0..15
- duration
pulse duration in microseconds
- Definition Classes
- PCA9685GpioProvider → GpioProviderBase → GpioProvider
- Annotations
- @Override()
- def setPwmRange(arg0: Pin, arg1: Int): Unit
- Definition Classes
- GpioProviderBase → GpioProvider
- def setState(arg0: Pin, arg1: PinState): Unit
- Definition Classes
- GpioProviderBase → GpioProvider
- def setValue(arg0: Pin, arg1: Double): Unit
- Definition Classes
- GpioProviderBase → GpioProvider
- def shutdown(): Unit
- Definition Classes
- PCA9685GpioProvider → GpioProviderBase → GpioProvider
- Annotations
- @Override()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def unexport(pin: Pin): Unit
- Definition Classes
- PCA9685GpioProvider → GpioProviderBase → GpioProvider
- Annotations
- @Override()
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @Deprecated
- Deprecated