PCA9624, PCA9622 and PCA9626 class library. The PCA9624 is a 8-channel, the PCA9622 is a 16-channel and the PCA9956A is a 24-channel Fm+ I2C-bus 100mA/40V LED driver.

Dependencies:   CompLedDvr

Dependents:   PCA9626_Hello PCA9624_Hello PCA9622_Hello

What is this?

Code for PCA9626, PCA9622 and PCA9624.
24-channel, 16-channel and 8-channel PWM output LED driver component class.

Please refer to the component page for details

8, 16 & 24-channel Fm+ I2C-bus 100mA/40 V LED driver

High-level API is available

A high-level API that can be used as the "PwmOut" of bed-SDK is available.
This API enables to make instances of each LED output pins and control PWM duty cycle by assignment.
For detail information, refer API document of LedPwmOut Class class which is included in PCA962xA class library.

#include "mbed.h"
#include "PCA9626.h"

PCA9626     led_cntlr( p28, p27, 0xC4 );  //  SDA, SCL, Slave_address(option)
LedPwmOut   led( led_cntlr, L0 );

int main()
{
    while( 1 ) {
        for( float p = 0.0f; p < 1.0f; p += 0.1f ) {
            led     = p;
            wait( 0.1 );
        }
    }
}

About the chips

PCA9626

The PCA9626 is an I2C-bus controlled 24-bit LED driver optimized for voltage switch dimming and blinking 100 mA LEDs. Each LED output has its own 8-bit resolution (256 steps) fixed frequency individual PWM controller that operates at 97 kHz with a duty cycle that is adjustable from 0 % to 99.6 % to allow the LED to be set to a specific brightness value.

Datasheet: http://www.nxp.com/documents/data_sheet/PCA9626.pdf

PCA9622

The PCA9622 is an I2C-bus controlled 16-bit LED driver optimized for voltage switch dimming and blinking 100 mA LEDs. Each LED output has its own 8-bit resolution (256 steps) fixed frequency individual PWM controller that operates at 97 kHz with a duty cycle that is adjustable from 0 % to 99.6 % to allow the LED to be set to a specific brightness value.

Datasheet: http://www.nxp.com/documents/data_sheet/PCA9622.pdf

PCA9624

The PCA9624 is an I2C-bus controlled 8-bit LED driver optimized for voltage switch dimming and blinking 100 mA Red/Green/Blue/Amber (RGBA) LEDs. Each LED output has its own 8-bit resolution (256 steps) fixed frequency individual PWM controller that operates at 97 kHz with a duty cycle that is adjustable from 0 % to 99.6 % to allow the LED to be set to a specific brightness value.

Datasheet: http://www.nxp.com/documents/data_sheet/PCA9624.pdf

How the API works?

When the instance is made, all set up for PWM operation are done automatically.
PCA9626, PCA9624 and PCA9622 have internal 97kHz oscillator to generate internal PWM waveform. This signal switchs the output current ON and OFF. The class' function pwm() controls duty-cycle of this output.

API_and_output

Tips for the chips

PCA962x family

This PCA962x components library can be used for all PCA9926(24-channel), PCA9922(16-channel) and PCA9624(8-channel).
If you are using both chips on the I2C bus, those can be operated like..

#include "mbed.h"
 
#include "PCA9622.h"
#include "PCA9626.h"

PCA9622    led0( p28, p27, 0xC0 );    //  SDA, SCL, Slave_address=0xC0 (16-channel chip)
PCA9626    led1( p28, p27, 0xC2 );    //  SDA, SCL, Slave_address=0xC2 (24-channel chip)
 
int main()
{
    led0.pwm( ....    //  PWM control for PCA9955A(16-channel chip)
    led1.pwm( ....    //  PWM control for PCA9956A(24-channel chip)
    ...

Sample code for each types

For PCA9624 (8 channel) : http://developer.mbed.org/users/nxp_ip/code/PCA9624_Hello/
For PCA9622 (16 channel) : http://developer.mbed.org/users/nxp_ip/code/PCA9622_Hello/
For PCA9626 (24 channel) : http://developer.mbed.org/users/nxp_ip/code/PCA9626_Hello/

Committer:
nxp_ip
Date:
Wed Mar 04 05:59:40 2015 +0000
Revision:
3:40f83904f0a8
API of "LedPwmOut class" implemented

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nxp_ip 3:40f83904f0a8 1 /** Abstract class for LED driver component
nxp_ip 3:40f83904f0a8 2 *
nxp_ip 3:40f83904f0a8 3 * Abstract class for LED driver family
nxp_ip 3:40f83904f0a8 4 * No instance can be made from this class
nxp_ip 3:40f83904f0a8 5 *
nxp_ip 3:40f83904f0a8 6 * @author Akifumi (Tedd) OKANO, NXP Semiconductors
nxp_ip 3:40f83904f0a8 7 * @version 0.5
nxp_ip 3:40f83904f0a8 8 * @date 04-Mar-2015
nxp_ip 3:40f83904f0a8 9 *
nxp_ip 3:40f83904f0a8 10 * Released under the Apache 2 license
nxp_ip 3:40f83904f0a8 11 */
nxp_ip 3:40f83904f0a8 12
nxp_ip 3:40f83904f0a8 13 #ifndef MBED_CompLedDvr
nxp_ip 3:40f83904f0a8 14 #define MBED_CompLedDvr
nxp_ip 3:40f83904f0a8 15
nxp_ip 3:40f83904f0a8 16 #include "mbed.h"
nxp_ip 3:40f83904f0a8 17
nxp_ip 3:40f83904f0a8 18 typedef enum {
nxp_ip 3:40f83904f0a8 19 /** Pin names of LED driver. Those are L0 .. L3, not like "LED0" to avoid mbed board LED names */
nxp_ip 3:40f83904f0a8 20 L0, /**< LED0 pin */
nxp_ip 3:40f83904f0a8 21 L1, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 22 L2, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 23 L3, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 24 L4, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 25 L5, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 26 L6, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 27 L7, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 28 L8, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 29 L9, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 30 L10, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 31 L11, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 32 L12, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 33 L13, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 34 L14, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 35 L15, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 36 L16, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 37 L17, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 38 L18, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 39 L19, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 40 L20, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 41 L21, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 42 L22, /**< LED2 pin */
nxp_ip 3:40f83904f0a8 43 L23, /**< LED23 pin */
nxp_ip 3:40f83904f0a8 44 L_NC = ~0x0L /**< for when the pin is left no-connection */
nxp_ip 3:40f83904f0a8 45 } LedPinName;
nxp_ip 3:40f83904f0a8 46
nxp_ip 3:40f83904f0a8 47
nxp_ip 3:40f83904f0a8 48 /** Abstract class for LED driver component
nxp_ip 3:40f83904f0a8 49 *
nxp_ip 3:40f83904f0a8 50 * @class CompLedDvr
nxp_ip 3:40f83904f0a8 51 *
nxp_ip 3:40f83904f0a8 52 * Abstract class for LED driver family
nxp_ip 3:40f83904f0a8 53 * No instance can be made from this class
nxp_ip 3:40f83904f0a8 54 */
nxp_ip 3:40f83904f0a8 55 class CompLedDvr
nxp_ip 3:40f83904f0a8 56 {
nxp_ip 3:40f83904f0a8 57 public:
nxp_ip 3:40f83904f0a8 58 /** Default constructor */
nxp_ip 3:40f83904f0a8 59 CompLedDvr();
nxp_ip 3:40f83904f0a8 60
nxp_ip 3:40f83904f0a8 61 /** Destructor */
nxp_ip 3:40f83904f0a8 62 virtual ~CompLedDvr();
nxp_ip 3:40f83904f0a8 63
nxp_ip 3:40f83904f0a8 64 /** Virtual function to define standard function of the component */
nxp_ip 3:40f83904f0a8 65 virtual void pwm( int port, float v ) = 0;
nxp_ip 3:40f83904f0a8 66 }
nxp_ip 3:40f83904f0a8 67 ;
nxp_ip 3:40f83904f0a8 68
nxp_ip 3:40f83904f0a8 69 #endif // MBED_CompLedDvr
nxp_ip 3:40f83904f0a8 70