InetrfaceProducts NXP / PCA962x

Dependencies:   CompLedDvr

Dependents:   PCA9626_Hello PCA9624_Hello PCA9622_Hello

Files at this revision

API Documentation at this revision

Comitter:
nxp_ip
Date:
Thu Mar 19 10:02:57 2015 +0000
Parent:
6:ff79c5615d4f
Commit message:
API document update

Changed in this revision

PCA9622/PCA9622.h Show annotated file Show diff for this revision Revisions of this file
PCA9624/PCA9624.h Show annotated file Show diff for this revision Revisions of this file
PCA9626/PCA9626.h Show annotated file Show diff for this revision Revisions of this file
base_class/CompLedDvr.lib Show annotated file Show diff for this revision Revisions of this file
base_class/PCA962x.h Show annotated file Show diff for this revision Revisions of this file
--- a/PCA9622/PCA9622.h	Wed Mar 04 08:31:40 2015 +0000
+++ b/PCA9622/PCA9622.h	Thu Mar 19 10:02:57 2015 +0000
@@ -28,11 +28,15 @@
  *  Detail information is available on next URL.
  *    http://www.nxp.com/products/lighting_driver_and_controller_ics/i2c_led_display_control/series/PCA9622.html
  *
+ *  Next sample code shows operation based on low-level-API (operated by just device instane)
+ *
  *  Example:
  *  @code
- *  #include "mbed.h"
+ *  //  PCA9622 operation sample using its device instance
  *  
+ *  #include "mbed.h"
  *  #include "PCA9622.h"
+ *  
  *  PCA9622    led_cntlr( p28, p27, 0x3E );    //  SDA, SCL, Slave_address(option)
  *  
  *  int main()
@@ -48,28 +52,108 @@
  *      }
  *  }
  *  @endcode
+ *  
+ *  The high-level-API:LedPwmOutCC is also available.
+ *  It can be used like next sample code.
+ *  
+ *  @code
+ *  //  PCA9624 operation sample using high-level-API
+ *
+ *  #include "mbed.h"
+ *  #include "PCA9622.h"
+ *
+ *  PCA9622     led_cntlr( p28, p27, 0x3E );    //  SDA, SCL, Slave_address(option)
+ *  LedPwmOut   led0( led_cntlr, L0  );         //  Instance for LED0 pin
+ *  LedPwmOut   led1( led_cntlr, L1  );         //  Instance for LED1 pin
+ *  LedPwmOut   led2( led_cntlr, L2  );         //  Instance for LED2 pin
+ *
+ *  int main()
+ *  {
+ *      while(1) {
+ *
+ *          for ( float p = 1.0; p >= 0.0; p -= 0.01 ) {
+ *              led0    = p;    //  Set LED0 output PWM dutycycle as 'p'
+ *              wait( 0.01 );
+ *          }
+ *
+ *          for ( float p = 1.0; p >= 0.0; p -= 0.01 ) {
+ *              led1    = p;    //  Set LED1 output PWM dutycycle as 'p'
+ *              wait( 0.01 );
+ *          }
+ *
+ *          for ( float p = 1.0; p >= 0.0; p -= 0.01 ) {
+ *              led2    = p;    //  Set LED2 output PWM dutycycle as 'p'
+ *              wait( 0.01 );
+ *          }
+ *      }
+ *  }
+ *  @endcode
  */
 
 class PCA9622 : public PCA962x
 {
 public:
-    /** Name of the PCA9622 registers */
+
+#if DOXYGEN_ONLY
+    /** PCA9622 pin names high-level API i.e. LedPwmOut */
+    typedef enum {
+        L0,            /**< LED0 pin                               */
+        L1,            /**< LED2 pin                               */
+        L2,            /**< LED2 pin                               */
+        L3,            /**< LED2 pin                               */
+        L4,            /**< LED2 pin                               */
+        L5,            /**< LED2 pin                               */
+        L6,            /**< LED2 pin                               */
+        L7,            /**< LED2 pin                               */
+        L8,            /**< LED2 pin                               */
+        L9,            /**< LED2 pin                               */
+        L10,           /**< LED2 pin                               */
+        L11,           /**< LED2 pin                               */
+        L12,           /**< LED2 pin                               */
+        L13,           /**< LED2 pin                               */
+        L14,           /**< LED2 pin                               */
+        L15,           /**< LED2 pin                               */
+        L_NC = ~0x0L   /**< for when the pin is left no-connection */
+    } LedPinName;
+#endif // DOXYGEN_ONLY
+
+    /** Name of the PCA9622 registers (for direct register access) */
     enum command_reg {
-        MODE1, MODE2,
-        PWM0,   PWM1,   PWM2,   PWM3,  
-        PWM4,   PWM5,   PWM6,   PWM7,
-        PWM8,   PWM9,   PWM10,  PWM11, 
-        PWM12,  PWM13,  PWM14,  PWM15,
-        GRPPWM, GRPFREQ, 
-        LEDOUT0, LEDOUT1, LEDOUT2, LEDOUT3, 
-        SUBADR1, SUBADR2, SUBADR3, ALLCALLADR,
+        MODE1,      /**< MODE1 register      */
+        MODE2,      /**< MODE2 register      */
+        PWM0,       /**< PWM0 register       */
+        PWM1,       /**< PWM1 register       */
+        PWM2,       /**< PWM2 register       */
+        PWM3,       /**< PWM3 register       */
+        PWM4,       /**< PWM4 register       */
+        PWM5,       /**< PWM5 register       */
+        PWM6,       /**< PWM6 register       */
+        PWM7,       /**< PWM7 register       */
+        PWM8,       /**< PWM8 register       */
+        PWM9,       /**< PWM9 register       */
+        PWM10,      /**< PWM10 register      */
+        PWM11,      /**< PWM11 register      */
+        PWM12,      /**< PWM12 register      */
+        PWM13,      /**< PWM13 register      */
+        PWM14,      /**< PWM14 register      */
+        PWM15,      /**< PWM15 register      */
+        GRPPWM,     /**< GRPPWM register     */
+        GRPFREQ,    /**< GRPFREQ register    */
+        LEDOUT0,    /**< LEDOUT0 register    */
+        LEDOUT1,    /**< LEDOUT1 register    */
+        LEDOUT2,    /**< LEDOUT2 register    */
+        LEDOUT3,    /**< LEDOUT3 register    */
+        SUBADR1,    /**< SUBADR1 register    */
+        SUBADR2,    /**< SUBADR2 register    */
+        SUBADR3,    /**< SUBADR3 register    */
+        ALLCALLADR, /**< ALLCALLADR register */
 
         REGISTER_START          = MODE1,
         LEDOUT_REGISTER_START   = LEDOUT0,
         PWM_REGISTER_START      = PWM0,
     };
 
-    /** Create a PCA9629A instance connected to specified I2C pins with specified address
+    /** Create a PCA9622 instance connected to specified I2C pins with specified address
      *
      * @param i2c_sda       I2C-bus SDA pin
      * @param i2c_sda       I2C-bus SCL pin
@@ -77,7 +161,7 @@
      */
     PCA9622( PinName i2c_sda, PinName i2c_scl, char i2c_address = PCA962x::DEFAULT_I2C_ADDR );
 
-    /** Create a PCA9629A instance connected to specified I2C pins with specified address
+    /** Create a PCA9622 instance connected to specified I2C pins with specified address
      *
      * @param i2c_obj       I2C object (instance)
      * @param i2c_address   I2C-bus address (default: 0xC0)
--- a/PCA9624/PCA9624.h	Wed Mar 04 08:31:40 2015 +0000
+++ b/PCA9624/PCA9624.h	Thu Mar 19 10:02:57 2015 +0000
@@ -28,11 +28,15 @@
  *  Detail information is available on next URL.
  *    http://www.nxp.com/products/lighting_driver_and_controller_ics/i2c_led_display_control/series/PCA9624.html
  *
+ *  Next sample code shows operation based on low-level-API (operated by just device instane)
+ *
  *  Example:
  *  @code
- *  #include "mbed.h"
+ *  //  PCA9624 operation sample using its device instance
  *  
+ *  #include "mbed.h"
  *  #include "PCA9624.h"
+ *  
  *  PCA9624    led_cntlr( p28, p27, 0x3E );    //  SDA, SCL, Slave_address(option)
  *  
  *  int main()
@@ -48,26 +52,91 @@
  *      }
  *  }
  *  @endcode
+ *  
+ *  The high-level-API:LedPwmOutCC is also available.
+ *  It can be used like next sample code.
+ *  
+ *  @code
+ *  //  PCA9624 operation sample using high-level-API
+ *
+ *  #include "mbed.h"
+ *  #include "PCA9624.h"
+ *
+ *  PCA9624     led_cntlr( p28, p27, 0x3E );    //  SDA, SCL, Slave_address(option)
+ *  LedPwmOut   led0( led_cntlr, L0  );         //  Instance for LED0 pin
+ *  LedPwmOut   led1( led_cntlr, L1  );         //  Instance for LED1 pin
+ *  LedPwmOut   led2( led_cntlr, L2  );         //  Instance for LED2 pin
+ *
+ *  int main()
+ *  {
+ *      while(1) {
+ *
+ *          for ( float p = 1.0; p >= 0.0; p -= 0.01 ) {
+ *              led0    = p;    //  Set LED0 output PWM dutycycle as 'p'
+ *              wait( 0.01 );
+ *          }
+ *
+ *          for ( float p = 1.0; p >= 0.0; p -= 0.01 ) {
+ *              led1    = p;    //  Set LED1 output PWM dutycycle as 'p'
+ *              wait( 0.01 );
+ *          }
+ *
+ *          for ( float p = 1.0; p >= 0.0; p -= 0.01 ) {
+ *              led2    = p;    //  Set LED2 output PWM dutycycle as 'p'
+ *              wait( 0.01 );
+ *          }
+ *      }
+ *  }
+ *  @endcode
  */
 
 class PCA9624 : public PCA962x
 {
 public:
-    /** Name of the PCA9624 registers */
+
+#if DOXYGEN_ONLY
+    /** PCA9624 pin names high-level API i.e. LedPwmOut */
+    typedef enum {
+        L0,            /**< LED0 pin                               */
+        L1,            /**< LED2 pin                               */
+        L2,            /**< LED2 pin                               */
+        L3,            /**< LED2 pin                               */
+        L4,            /**< LED2 pin                               */
+        L5,            /**< LED2 pin                               */
+        L6,            /**< LED2 pin                               */
+        L7,            /**< LED2 pin                               */
+        L_NC = ~0x0L   /**< for when the pin is left no-connection */
+    } LedPinName;
+#endif // DOXYGEN_ONLY
+
+    /** Name of the PCA9624 registers (for direct register access) */
     enum command_reg {
-        MODE1, MODE2,
-        PWM0,   PWM1,   PWM2,   PWM3,  
-        PWM4,   PWM5,   PWM6,   PWM7,
-        GRPPWM, GRPFREQ,
-        LEDOUT0, LEDOUT1,
-        SUBADR1, SUBADR2, SUBADR3, ALLCALLADR,
+        MODE1,      /**< MODE1 register      */
+        MODE2,      /**< MODE2 register      */
+        PWM0,       /**< PWM0 register       */
+        PWM1,       /**< PWM1 register       */
+        PWM2,       /**< PWM2 register       */
+        PWM3,       /**< PWM3 register       */
+        PWM4,       /**< PWM4 register       */
+        PWM5,       /**< PWM5 register       */
+        PWM6,       /**< PWM6 register       */
+        PWM7,       /**< PWM7 register       */
+        GRPPWM,     /**< GRPPWM register     */
+        GRPFREQ,    /**< GRPFREQ register    */
+        LEDOUT0,    /**< LEDOUT0 register    */
+        LEDOUT1,    /**< LEDOUT1 register    */
+        SUBADR1,    /**< SUBADR1 register    */
+        SUBADR2,    /**< SUBADR2 register    */
+        SUBADR3,    /**< SUBADR3 register    */
+        ALLCALLADR, /**< ALLCALLADR register */
+
 
         REGISTER_START          = MODE1,
         LEDOUT_REGISTER_START   = LEDOUT0,
         PWM_REGISTER_START      = PWM0,
     };
 
-    /** Create a PCA9629A instance connected to specified I2C pins with specified address
+    /** Create a PCA9626 instance connected to specified I2C pins with specified address
      *
      * @param i2c_sda       I2C-bus SDA pin
      * @param i2c_sda       I2C-bus SCL pin
@@ -75,7 +144,7 @@
      */
     PCA9624( PinName i2c_sda, PinName i2c_scl, char i2c_address = PCA962x::DEFAULT_I2C_ADDR );
 
-    /** Create a PCA9629A instance connected to specified I2C pins with specified address
+    /** Create a PCA9626 instance connected to specified I2C pins with specified address
      *
      * @param i2c_obj       I2C object (instance)
      * @param i2c_address   I2C-bus address (default: 0xC0)
--- a/PCA9626/PCA9626.h	Wed Mar 04 08:31:40 2015 +0000
+++ b/PCA9626/PCA9626.h	Thu Mar 19 10:02:57 2015 +0000
@@ -28,13 +28,17 @@
  *  Detail information is available on next URL.
  *    http://www.nxp.com/products/lighting_driver_and_controller_ics/i2c_led_display_control/series/PCA9626.html
  *
+ *  Next sample code shows operation based on low-level-API (operated by just device instane)
+ *
  *  Example:
  *  @code
+ *  //  PCA9626 operation sample using its device instance
+ *  
  *  #include "mbed.h"
- *  
  *  #include "PCA9626.h"
+ *
  *  PCA9626    led_cntlr( p28, p27, 0x3E );    //  SDA, SCL, Slave_address(option)
- *  
+ *
  *  int main()
  *  {
  *      while(1) {
@@ -48,30 +52,127 @@
  *      }
  *  }
  *  @endcode
+ *
+ *  The high-level-API:LedPwmOutCC is also available.
+ *  It can be used like next sample code.
+ *
+ *  @code
+ *  //  PCA9626 operation sample using high-level-API
+ *
+ *  #include "mbed.h"
+ *  #include "PCA9626.h"
+ *
+ *  PCA9626     led_cntlr( p28, p27, 0x3E );    //  SDA, SCL, Slave_address(option)
+ *  LedPwmOut   led0( led_cntlr, L0  );         //  Instance for LED0 pin
+ *  LedPwmOut   led1( led_cntlr, L1  );         //  Instance for LED1 pin
+ *  LedPwmOut   led2( led_cntlr, L2  );         //  Instance for LED2 pin
+ *
+ *  int main()
+ *  {
+ *      while(1) {
+ *
+ *          for ( float p = 1.0; p >= 0.0; p -= 0.01 ) {
+ *              led0    = p;    //  Set LED0 output PWM dutycycle as 'p'
+ *              wait( 0.01 );
+ *          }
+ *
+ *          for ( float p = 1.0; p >= 0.0; p -= 0.01 ) {
+ *              led1    = p;    //  Set LED1 output PWM dutycycle as 'p'
+ *              wait( 0.01 );
+ *          }
+ *
+ *          for ( float p = 1.0; p >= 0.0; p -= 0.01 ) {
+ *              led2    = p;    //  Set LED2 output PWM dutycycle as 'p'
+ *              wait( 0.01 );
+ *          }
+ *      }
+ *  }
+ *  @endcode
  */
 
 class PCA9626 : public PCA962x
 {
 public:
-    /** Name of the PCA9626 registers */
+
+#if DOXYGEN_ONLY
+    /** PCA9626 pin names high-level API i.e. LedPwmOut */
+    typedef enum {
+        L0,            /**< LED0 pin                               */
+        L1,            /**< LED2 pin                               */
+        L2,            /**< LED2 pin                               */
+        L3,            /**< LED2 pin                               */
+        L4,            /**< LED2 pin                               */
+        L5,            /**< LED2 pin                               */
+        L6,            /**< LED2 pin                               */
+        L7,            /**< LED2 pin                               */
+        L8,            /**< LED2 pin                               */
+        L9,            /**< LED2 pin                               */
+        L10,           /**< LED2 pin                               */
+        L11,           /**< LED2 pin                               */
+        L12,           /**< LED2 pin                               */
+        L13,           /**< LED2 pin                               */
+        L14,           /**< LED2 pin                               */
+        L15,           /**< LED2 pin                               */
+        L16,           /**< LED2 pin                               */
+        L17,           /**< LED2 pin                               */
+        L18,           /**< LED2 pin                               */
+        L19,           /**< LED2 pin                               */
+        L20,           /**< LED2 pin                               */
+        L21,           /**< LED2 pin                               */
+        L22,           /**< LED2 pin                               */
+        L23,           /**< LED23 pin                               */
+        L_NC = ~0x0L   /**< for when the pin is left no-connection */
+    } LedPinName;
+#endif // DOXYGEN_ONLY
+
+    /** Name of the PCA9626 registers (for direct register access) */
     enum command_reg {
-        MODE1, MODE2,
-        PWM0,   PWM1,   PWM2,   PWM3,  
-        PWM4,   PWM5,   PWM6,   PWM7,
-        PWM8,   PWM9,   PWM10,  PWM11, 
-        PWM12,  PWM13,  PWM14,  PWM15,
-        PWM16,  PWM17,  PWM18,  PWM19, 
-        PWM20,  PWM21,  PWM22,  PWM23,
-        GRPPWM, GRPFREQ, CHASE,
-        LEDOUT0, LEDOUT1, LEDOUT2, LEDOUT3, LEDOUT4, LEDOUT5,
-        SUBADR1, SUBADR2, SUBADR3, ALLCALLADR,
+        MODE1,      /**< MODE1 register      */
+        MODE2,      /**< MODE2 register      */
+        PWM0,       /**< PWM0 register       */
+        PWM1,       /**< PWM1 register       */
+        PWM2,       /**< PWM2 register       */
+        PWM3,       /**< PWM3 register       */
+        PWM4,       /**< PWM4 register       */
+        PWM5,       /**< PWM5 register       */
+        PWM6,       /**< PWM6 register       */
+        PWM7,       /**< PWM7 register       */
+        PWM8,       /**< PWM8 register       */
+        PWM9,       /**< PWM9 register       */
+        PWM10,      /**< PWM10 register      */
+        PWM11,      /**< PWM11 register      */
+        PWM12,      /**< PWM12 register      */
+        PWM13,      /**< PWM13 register      */
+        PWM14,      /**< PWM14 register      */
+        PWM15,      /**< PWM15 register      */
+        PWM16,      /**< PWM16 register      */
+        PWM17,      /**< PWM17 register      */
+        PWM18,      /**< PWM18 register      */
+        PWM19,      /**< PWM19 register      */
+        PWM20,      /**< PWM20 register      */
+        PWM21,      /**< PWM21 register      */
+        PWM22,      /**< PWM22 register      */
+        PWM23,      /**< PWM23 register      */
+        GRPPWM,     /**< GRPPWM register     */
+        GRPFREQ,    /**< GRPFREQ register    */
+        CHASE,      /**< CHASE register      */
+        LEDOUT0,    /**< LEDOUT0 register    */
+        LEDOUT1,    /**< LEDOUT1 register    */
+        LEDOUT2,    /**< LEDOUT2 register    */
+        LEDOUT3,    /**< LEDOUT3 register    */
+        LEDOUT4,    /**< LEDOUT4 register    */
+        LEDOUT5,    /**< LEDOUT5 register    */
+        SUBADR1,    /**< SUBADR1 register    */
+        SUBADR2,    /**< SUBADR2 register    */
+        SUBADR3,    /**< SUBADR3 register    */
+        ALLCALLADR, /**< ALLCALLADR register */
 
         REGISTER_START          = MODE1,
         LEDOUT_REGISTER_START   = LEDOUT0,
         PWM_REGISTER_START      = PWM0,
     };
 
-    /** Create a PCA9629A instance connected to specified I2C pins with specified address
+    /** Create a PCA9626 instance connected to specified I2C pins with specified address
      *
      * @param i2c_sda       I2C-bus SDA pin
      * @param i2c_sda       I2C-bus SCL pin
@@ -79,7 +180,7 @@
      */
     PCA9626( PinName i2c_sda, PinName i2c_scl, char i2c_address = PCA962x::DEFAULT_I2C_ADDR );
 
-    /** Create a PCA9629A instance connected to specified I2C pins with specified address
+    /** Create a PCA9626 instance connected to specified I2C pins with specified address
      *
      * @param i2c_obj       I2C object (instance)
      * @param i2c_address   I2C-bus address (default: 0xC0)
@@ -90,13 +191,13 @@
      *
      */
     virtual         ~PCA9626();
-    
+
     /** Returns the number of output ports
      *
      *  @returns
      *    The number of output ports
      */
-     virtual int     number_of_ports( void );
+    virtual int     number_of_ports( void );
 
 #if DOXYGEN_ONLY
     /** Set the output duty-cycle, specified as a percentage (float)
@@ -109,7 +210,7 @@
      *    Values outside this range will have undefined behavior.
      */
     void            pwm( int port, float v );
-    
+
     /** Set all output port duty-cycle, specified as a percentage (array of float)
      *
      * @param vp    Aray to floating-point values representing the output duty-cycle,
@@ -120,26 +221,26 @@
      *    The aray should have length of 24
      */
     void            pwm( float *vp );
-    
+
     /** Register write (single byte) : Low level access to device register
      *
      * @param reg_addr  Register address
      * @param data      Value for setting into the register
-     */    
+     */
     void            write( char reg_addr, char data );
 
     /** Register write (multiple bytes) : Low level access to device register
      *
      * @param data      Pointer to an array. First 1 byte should be the writing start register address
      * @param length    Length of data
-     */    
+     */
     void            write( char *data, int length );
 
     /** Register read (single byte) : Low level access to device register
      *
      * @param reg_addr  Register address
      * @return          Read value from register
-     */    
+     */
     char            read( char reg_addr );
 
     /** Register write (multiple bytes) : Low level access to device register
@@ -147,7 +248,7 @@
      * @param reg_addr  Register address
      * @param data      Pointer to an array. The values are stored in this array.
      * @param length    Length of data
-     */    
+     */
     void            read( char reg_addr, char *data, int length );
 #endif
 
--- a/base_class/CompLedDvr.lib	Wed Mar 04 08:31:40 2015 +0000
+++ b/base_class/CompLedDvr.lib	Thu Mar 19 10:02:57 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/nxp_ip/code/CompLedDvr/#a0e4342d3b3d
+http://developer.mbed.org/users/nxp_ip/code/CompLedDvr/#8a0aa36b236c
--- a/base_class/PCA962x.h	Wed Mar 04 08:31:40 2015 +0000
+++ b/base_class/PCA962x.h	Thu Mar 19 10:02:57 2015 +0000
@@ -3,7 +3,7 @@
  *  Abstract class for PCA962x family
  *  No instance can be made from this class
  *
- *  @class   PCA9956A
+ *  @class   PCA962x
  *  @author  Akifumi (Tedd) OKANO, NXP Semiconductors
  *  @version 0.6
  *  @date    04-Mar-2015