API Reference

pca9955b

CircuitPython helper library for the NXP 16-Channel I�C-Bus Constant-Current LED Driver

  • Author(s): Noel Anderson

Implementation Notes

Hardware:

Software and Dependencies:

class pca9955b.pca9955b.LedChannel(device: PCA9955, index: int)

A class representing a single PCA9955 channel.

Parameters:
  • device (PCA9955) – The PCA9955 device object.

  • index (int) – The index of the channel.

E_NONE = 0

Constant for no error.

E_OPEN_CIRCUIT = 2

Constant for open circuit error.

E_SHORT_CIRCUIT = 1

Constant for short circuit error.

OFF = 0

Constant for channel off state.

ON = 1

Constant for channel full on state.

PWM = 2

Constant for channel PWM state.

PWM_GRP = 3

Constant for channel PWM group state.

property brightness: int

Channel brightness 0 - 255.

property error: int

LED error state. Read Only

property gain: int

Channel curent gain 0 - 255.

property graduation_mode: bool

1 = grad mode, 0 = normal

property groupId: int

Gradation group Id.

property state: int

Channel Driver output state

class pca9955b.pca9955b.LedChannels(device: PCA9955)

Lazily creates and caches channel objects as needed. Treat it like a sequence.

Parameters:

device (PCA9955) – The PCA9955 device object

class pca9955b.pca9955b.PCA9955(i2c: I2C, address: int = _PCA9955B_DEFAULT_I2C_ADDR, oe_pin: Pin | None = None, reset_pin: Pin | None = None)

A class representing a PCA9955 device.

This class provides an interface to control the PCA9955 LED driver via I2C. It allows for setting various properties such as brightness, gain, and different modes of operation. It also provides methods to read and write to the device’s registers.

channels

An collection of LedChannels objects.

Type:

LedChannels

groups

A collection of Group Objects.

Type:

Groups

subaddresses

A collection of I2CSubAddress objects.

Type:

I2CSubAddresses

Initialize the PCA9955B device at address on i2c_bus If oe and/or reset pins are connected to GPIO outputs, as per the nxp application note then these can be passed in as oe_pin and reset_pin respectively and will be used by the reset and output_enable properties.

Parameters:
  • i2c (I2C) – The I2C bus the device is connected to.

  • address (int, optional) – The I2C address of the device. Default is _PCA9955B_DEFAULT_I2C_ADDR (0x3F).

  • oe_pin (Optional[microcontroller.Pin], optional) – GPIO pin connected to the Output Enable (OE) pin of the device.

  • reset_pin (Optional[microcontroller.Pin], optional) – GPIO pin connected to the Reset pin of the device. Default is None.

Returns:

None

property auto_increment_flag: bool

1 = auto increment, 0 = normal mode. Read only

property auto_increment_mode: int

Auto increment mode 0 - 3

property blinking: bool

1 = global - blinking, 0 = global - dimming (default)

property brightness: NoReturn

Global brightness 0 - 255. Write only

clear_errors() None

Clear errors

deinit() None

Stop using the PCA9955.

property errors_exist: bool

True indicates errors exist. Use LedChannel.error to determine which channel(s) has an error.

property exponential_graduation: bool

1 = exponential adjustment for gradation control, 0 = linear adjustment for gradation control (default)

property frequency: int

Global blinking frequency control when blinking = 1

property gain: NoReturn

Global output currrent 0 - 255. Write only

property low_power_mode: bool

1 = low power mode, 0 = normal mode

property output_delay: int

Output delay offset. Turn-on delay between LED outputs. This helps to reduce peak current for the VDD supply and reduces EMI.

property output_enable: bool | None

If the oe pin is tied to a GPIO then control the PCA9955 oe (output enable).

property over_temp: bool

True indicates over temperature condition. Read only

property pwm: int

Global brightness control when blinking = 0

reset() None

If the Reset pin is tied to a GPIO then reset the PCA9955.

class pca9955b.pca9955b.SubAddress(device: PCA9955, index: int)

A single PCA9955 I2C Sub Address.

Parameters:
  • device (PCA9955) – The PCA9955 device object

  • index (int) – The index of the address

ALLCALLADR = 3

Constant for ALLCALLADR.

SUBADR1 = 0

Constant for SUBADR1.

SUBADR2 = 1

Constant for SUBADR2.

SUBADR3 = 2

Constant for SUBADR3.

property address: int

Bus Address for the I2C Sub Address.

property enable: bool

I2C sub address enabled.

class pca9955b.pca9955b.SubAddresses(device: PCA9955)

Lazily creates and caches I2CSubAddress objects as needed. Treat it like a sequence.

Parameters:

device (PCA9955) – The PCA9955 device object

pca9955b_groups

CircuitPython helper library for Group Control of the NXP 16-Channel I�C-Bus Constant-Current LED Driver

  • Author(s): Noel Anderson

Implementation Notes

Hardware:

Software and Dependencies:

class pca9955b.pca9955b_groups.Group(device: <module 'pca9955b.pca9955b' from '/home/docs/checkouts/readthedocs.org/user_builds/circuitpython-pca9955b/checkouts/stable/pca9955b/pca9955b.py'>, index: int)

A single PCA9955 Graduation Group.

Parameters:
  • device (PCA9955) – The PCA9955 device object

  • index (int) – The index of the group

property cycle_time: int

Cycle time - 0 (0.5ms) or 1 (8ms).

property factor_per_step: int

Multiple factor per step 0 - 64.

property gain: int

Group output current gain (0-255).

property graduation_mode: bool

Graduation mode. 0 = Single Shot, 1 = Continuous.

graduation_start() None

Start defined Group Graduation running.

graduation_stop() None

Stop Group Graduation.

property hold_off: bool

Hold off enable/disable.

property hold_off_time: int

Hold On time - 0 (0s), 1 (0.25s), 2 (0.5s), 3 (0.75s) , 4 (1s), 5 (2s), 6 (4s), 7 (6s).

property hold_on: bool

Hold on enable/disable.

property hold_on_time: int

Hold On time - 0 (0s), 1 (0.25s), 2 (0.5s), 3 (0.75s) , 4 (1s), 5 (2s), 6 (4s), 7 (6s).

property id: int

Group Id. Read Only

property ramp_down: bool

Ramp-down enable/disable.

property ramp_rate: int

Ramp rate per step, 0 - 64.

property ramp_up: bool

Ramp-up enable/disable.

class pca9955b.pca9955b_groups.Groups(device: <module 'pca9955b.pca9955b' from '/home/docs/checkouts/readthedocs.org/user_builds/circuitpython-pca9955b/checkouts/stable/pca9955b/pca9955b.py'>)

Lazily creates and caches Group objects as needed. Treat it like a sequence.

Parameters:

device (PCA9955) – The PCA9955 device object