Packages

c

pi4j.gpio.extension.pca

PCA9685GpioProvider

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

Linear Supertypes
GpioProviderBase, GpioProvider, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. PCA9685GpioProvider
  2. GpioProviderBase
  3. GpioProvider
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new PCA9685GpioProvider(bus: I2CBus, address: Int, targetFrequency: BigDecimal, frequencyCorrectionFactor: BigDecimal)
  2. new PCA9685GpioProvider(bus: I2CBus, address: Int, targetFrequency: BigDecimal)
  3. new PCA9685GpioProvider(bus: I2CBus, address: Int)
  4. new PCA9685GpioProvider(busNumber: Int, address: Int)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def addListener(arg0: Pin, arg1: PinListener): Unit
    Definition Classes
    GpioProviderBase → GpioProvider
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. 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)

  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  8. def dispatchPinAnalogValueChangeEvent(arg0: Pin, arg1: Double): Unit
    Attributes
    protected[com.pi4j.io.gpio]
    Definition Classes
    GpioProviderBase
  9. def dispatchPinDigitalStateChangeEvent(arg0: Pin, arg1: PinState): Unit
    Attributes
    protected[com.pi4j.io.gpio]
    Definition Classes
    GpioProviderBase
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  12. def export(pin: Pin, mode: PinMode): Unit
    Definition Classes
    PCA9685GpioProvider → GpioProviderBase → GpioProvider
    Annotations
    @Override()
  13. def export(arg0: Pin, arg1: PinMode, arg2: PinState): Unit
    Definition Classes
    GpioProviderBase → GpioProvider
  14. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. def getFrequency(): BigDecimal
  16. def getMode(arg0: Pin): PinMode
    Definition Classes
    GpioProviderBase → GpioProvider
  17. def getName(): String
    Definition Classes
    PCA9685GpioProvider → GpioProviderBase → GpioProvider
    Annotations
    @Override()
  18. def getPeriodDurationMicros(): Int
  19. def getPinCache(pin: Pin): PCA9685GpioProviderPinCache
    Attributes
    protected[pca]
    Definition Classes
    PCA9685GpioProvider → GpioProviderBase
    Annotations
    @Override()
  20. def getPullResistance(arg0: Pin): PinPullResistance
    Definition Classes
    GpioProviderBase → GpioProvider
  21. def getPwm(pin: Pin): Int
    Definition Classes
    PCA9685GpioProvider → GpioProviderBase → GpioProvider
    Annotations
    @Override()
  22. def getPwmOnOffValues(pin: Pin): Array[Int]

    pin

    represents channel 0..15

    returns

    [0]: onValue, [1]: offValue

  23. def getState(arg0: Pin): PinState
    Definition Classes
    GpioProviderBase → GpioProvider
  24. def getValue(arg0: Pin): Double
    Definition Classes
    GpioProviderBase → GpioProvider
  25. def hasPin(arg0: Pin): Boolean
    Definition Classes
    GpioProviderBase → GpioProvider
  26. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  27. def isExported(arg0: Pin): Boolean
    Definition Classes
    GpioProviderBase → GpioProvider
  28. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  29. def isShutdown(): Boolean
    Definition Classes
    GpioProviderBase → GpioProvider
  30. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  31. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  32. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  33. def removeAllListeners(): Unit
    Definition Classes
    GpioProviderBase → GpioProvider
  34. def removeListener(arg0: Pin, arg1: PinListener): Unit
    Definition Classes
    GpioProviderBase → GpioProvider
  35. def reset(): Unit

    Reset all outputs (set to always OFF)

  36. 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

  37. 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

  38. 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'

  39. 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)

  40. def setMode(arg0: Pin, arg1: PinMode): Unit
    Definition Classes
    GpioProviderBase → GpioProvider
  41. def setPullResistance(arg0: Pin, arg1: PinPullResistance): Unit
    Definition Classes
    GpioProviderBase → GpioProvider
  42. 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

  43. 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()
  44. def setPwmRange(arg0: Pin, arg1: Int): Unit
    Definition Classes
    GpioProviderBase → GpioProvider
  45. def setState(arg0: Pin, arg1: PinState): Unit
    Definition Classes
    GpioProviderBase → GpioProvider
  46. def setValue(arg0: Pin, arg1: Double): Unit
    Definition Classes
    GpioProviderBase → GpioProvider
  47. def shutdown(): Unit
    Definition Classes
    PCA9685GpioProvider → GpioProviderBase → GpioProvider
    Annotations
    @Override()
  48. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  49. def toString(): String
    Definition Classes
    AnyRef → Any
  50. def unexport(pin: Pin): Unit
    Definition Classes
    PCA9685GpioProvider → GpioProviderBase → GpioProvider
    Annotations
    @Override()
  51. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  52. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  53. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated @Deprecated
    Deprecated

Inherited from GpioProviderBase

Inherited from GpioProvider

Inherited from AnyRef

Inherited from Any

Ungrouped