LEDDriver_NXP_Arduino 1.0.2
LED driver device operation sample code for Arduino
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | Static Protected Attributes | List of all members
PCA9955B Class Reference

#include <LEDDriver.h>

Inheritance diagram for PCA9955B:
PCA995x_I2C PCA995x LEDDriver

Public Types

enum  reg_num {
  MODE1 , MODE2 , LEDOUT0 , LEDOUT1 ,
  LEDOUT2 , LEDOUT3 , GRPPWM , GRPFREQ ,
  PWM0 , PWM1 , PWM2 , PWM3 ,
  PWM4 , PWM5 , PWM6 , PWM7 ,
  PWM8 , PWM9 , PWM10 , PWM11 ,
  PWM12 , PWM13 , PWM14 , PWM15 ,
  IREF0 , IREF1 , IREF2 , IREF3 ,
  IREF4 , IREF5 , IREF6 , IREF7 ,
  IREF8 , IREF9 , IREF10 , IREF11 ,
  IREF12 , IREF13 , IREF14 , IREF15 ,
  RAMP_RATE_GRP0 , STEP_TIME_GRP0 , HOLD_CNTL_GRP0 , IREF_GRP0 ,
  RAMP_RATE_GRP1 , STEP_TIME_GRP1 , HOLD_CNTL_GRP1 , IREF_GRP1 ,
  RAMP_RATE_GRP2 , STEP_TIME_GRP2 , HOLD_CNTL_GRP2 , IREF_GRP2 ,
  RAMP_RATE_GRP3 , STEP_TIME_GRP3 , HOLD_CNTL_GRP3 , IREF_GRP3 ,
  GRAD_MODE_SEL0 , GRAD_MODE_SEL1 , GRAD_GRP_SEL0 , GRAD_GRP_SEL1 ,
  GRAD_GRP_SEL2 , GRAD_GRP_SEL3 , GRAD_CNTL , OFFSET ,
  SUBADR1 , SUBADR2 , SUBADR3 , ALLCALLADR ,
  PWMALL , IREFALL , EFLAG0 , EFLAG1 ,
  EFLAG2 , EFLAG3
}
 
enum  board { NONE , ARDUINO_SHIELD }
 
- Public Types inherited from LEDDriver
enum  board { NONE , ARDUINO_SHIELD }
 

Public Member Functions

 PCA9955B (uint8_t i2c_address=(0xBC > > 1))
 
 PCA9955B (TwoWire &wire, uint8_t i2c_address=(0xBC > > 1))
 
void init (float current)
 
void begin (float current=0.1, board env=NONE, bool buffered=false)
 
void pwm (uint8_t ch, float value)
 
void pwm (float *values)
 
void buffer_enable (bool flag)
 
void flush (void)
 
int reg_w (uint8_t reg_adr, uint8_t *data, uint16_t size)
 
int reg_w (uint8_t reg_adr, uint8_t data)
 
int reg_r (uint8_t reg_adr, uint8_t *data, uint16_t size)
 
uint8_t reg_r (uint8_t reg_adr)
 
void write_r8 (uint8_t reg, uint8_t val)
 
uint8_t read_r8 (uint8_t reg)
 
void bit_op8 (uint8_t reg, uint8_t mask, uint8_t value)
 
void bit_op16 (uint8_t reg, uint16_t mask, uint16_t value)
 
- Public Member Functions inherited from PCA995x_I2C
 PCA995x_I2C (uint8_t i2c_address, uint8_t n_ch, uint8_t PWM_r, uint8_t IREF_r, uint8_t IREFALL_r, const uint8_t *ar, uint8_t oe=8)
 
 PCA995x_I2C (TwoWire &wire, uint8_t i2c_address, uint8_t n_ch, uint8_t PWM_r, uint8_t IREF_r, uint8_t IREFALL_r, const uint8_t *ar, uint8_t oe=8)
 
void reg_access (uint8_t reg, uint8_t val)
 
void reg_access (uint8_t reg, uint8_t *vp, int len)
 
uint8_t reg_access (uint8_t reg)
 
void reg_access_r (uint8_t reg, uint8_t *vp, int len)
 
- Public Member Functions inherited from PCA995x
 PCA995x (uint8_t n_ch, uint8_t PWM_r, uint8_t IREF_r, uint8_t IREFALL_r, const uint8_t *ar, uint8_t oe=8)
 
virtual void begin (float current=0.1, board env=NONE, bool buffered=false)
 
void irefall (uint8_t iref)
 
- Public Member Functions inherited from LEDDriver
 LEDDriver (uint8_t n_ch, uint8_t PWM_r, uint8_t oe)
 
void pwm (uint8_t ch, float value)
 
void pwm (float *values)
 
void buffer_enable (bool flag)
 
void flush (void)
 

Static Public Attributes

static constexpr uint8_t n_channel = 16
 
static constexpr uint8_t access_ref [NUM_access_word]
 

Static Protected Attributes

static const int n_group
 

Additional Inherited Members

- Public Attributes inherited from PCA995x
const uint8_t * arp
 
- Public Attributes inherited from LEDDriver
const uint8_t n_channel
 
- Protected Attributes inherited from PCA995x
const uint8_t reg_IREF
 
const uint8_t reg_IREFALL
 
- Protected Attributes inherited from LEDDriver
const uint8_t reg_PWM
 
const uint8_t oe_pin
 

Detailed Description

PCA9955B class

About PCA9955B: https://www.nxp.com/products/power-management/lighting-driver-and-controller-ics/led-drivers/16-channel-fm-plus-ic-bus-57-ma-20-v-constant-current-led-driver:PCA9955BTW

Definition at line 175 of file LEDDriver.h.

Member Enumeration Documentation

◆ board

Constants for begin() method

Definition at line 233 of file LEDDriver.h.

◆ reg_num

Name of the PCA9955B registers

Definition at line 182 of file LEDDriver.h.

Constructor & Destructor Documentation

◆ PCA9955B() [1/2]

PCA9955B::PCA9955B ( uint8_t i2c_address = (0xBC >> 1))

Create a PCA9955B instance connected to specified I2C pins with specified address

Parameters
i2c_addressI2C-bus address (default: (0xBC>>1))

Definition at line 4 of file PCA9955B.cpp.

◆ PCA9955B() [2/2]

PCA9955B::PCA9955B ( TwoWire & wire,
uint8_t i2c_address = (0xBC >> 1) )

Create a PCA9955B instance connected to specified I2C pins with specified address

Parameters
wireTwoWire instance
i2c_addressI2C-bus address (default: (0xBC>>1))

Definition at line 9 of file PCA9955B.cpp.

◆ ~PCA9955B()

PCA9955B::~PCA9955B ( )
virtual

Definition at line 14 of file PCA9955B.cpp.

Member Function Documentation

◆ begin()

void PCA9955B::begin ( float current = 0.1,
board env = NONE,
bool buffered = false )

Device/board initialization

This method is needed to initialize the LED driver itself and evaluation board.

Parameters
currentOutput current setting. Max is 1.0 for 100% output. Default is 0.1 (10%)
envThis method takes one argument of "PCA9955B::ARDUINO_SHIELD" to set RESET and OE pins. This is required for Arduino-shield type evaluation boards from NXP.
bufferedBuffered mode switch true or false. Default is false

◆ bit_op8()

void PCA9955B::bit_op8 ( uint8_t reg,
uint8_t mask,
uint8_t value )

Register overwriting with bit-mask

Register can be updated by bit level

Parameters
regregister index/address/pointer
maskbit-mask to protect overwriting
valuevalue to overwrite

◆ buffer_enable()

void PCA9955B::buffer_enable ( bool flag)

Buffer mode enable/Disble

Parameters
flag'true' for enabling

◆ flush()

void PCA9955B::flush ( void )

Flushing data

Send buffered PWM data to the LED driver

◆ init()

void PCA9955B::init ( float current)
virtual

Initializing device

Parameters
valuecurrent value in float (0.0 ~ 1.0)

Implements PCA995x.

Definition at line 18 of file PCA9955B.cpp.

Referenced by init().

◆ pwm() [1/2]

void PCA9955B::pwm ( float * values)

Set PWM value for all channels

Parameters
regregister number
*valuepointer to PWM value in float (0.0 ~ 1.0)

◆ pwm() [2/2]

void PCA9955B::pwm ( uint8_t ch,
float value )

Set PWM value for a channel

Parameters
regregister number
valuePWM value in float (0.0 ~ 1.0)

◆ read_r8()

uint8_t PCA9955B::read_r8 ( uint8_t reg)

Register read, 8 bit

Parameters
regregister index/address/pointer
Returns
data value

◆ reg_r() [1/2]

uint8_t PCA9955B::reg_r ( uint8_t reg_adr)

Single register read

Parameters
regregister index/address/pointer
Returns
read data

◆ reg_r() [2/2]

int PCA9955B::reg_r ( uint8_t reg_adr,
uint8_t * data,
uint16_t size )

Multiple register read

Parameters
regregister index/address/pointer
datapointer to data buffer
sizedata size
Returns
transferred data size

◆ reg_w() [1/2]

int PCA9955B::reg_w ( uint8_t reg_adr,
uint8_t * data,
uint16_t size )

Multiple register write

Parameters
regregister index/address/pointer
datapointer to data buffer
sizedata size
Returns
transferred data size

Referenced by init().

◆ reg_w() [2/2]

int PCA9955B::reg_w ( uint8_t reg_adr,
uint8_t data )

Single register write

Parameters
regregister index/address/pointer
datapointer to data buffer
sizedata size
Returns
transferred data size

◆ write_r8()

void PCA9955B::write_r8 ( uint8_t reg,
uint8_t val )

Register write, 8 bit

Parameters
regregister index/address/pointer
valdata value

Referenced by init().

Member Data Documentation

◆ access_ref

constexpr uint8_t PCA9955B::access_ref
staticconstexpr
Initial value:
= {
RAMP_RATE_GRP0,
GRAD_MODE_SEL0,
GRAD_GRP_SEL0,
GRAD_CNTL,
4,
}

Definition at line 223 of file LEDDriver.h.

◆ n_channel

constexpr uint8_t PCA9955B::n_channel = 16
staticconstexpr

Number of channels

Definition at line 179 of file LEDDriver.h.

◆ n_group

const int PCA9955B::n_group
staticprotected

Definition at line 335 of file LEDDriver.h.


The documentation for this class was generated from the following files: