InetrfaceProducts NXP / PCA962x

Dependencies:   CompLedDvr

Dependents:   PCA9626_Hello PCA9624_Hello PCA9622_Hello

Committer:
nxp_ip
Date:
Wed Mar 04 05:59:40 2015 +0000
Revision:
3:40f83904f0a8
Parent:
2:7287d10e1fcc
Child:
7:7ebf563f6e6c
API of "LedPwmOut class" implemented

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nxp_ip 0:7a206e6db594 1 /** PCA962x PWM control LED driver family
nxp_ip 0:7a206e6db594 2 *
nxp_ip 0:7a206e6db594 3 * Abstract class for PCA962x family
nxp_ip 0:7a206e6db594 4 * No instance can be made from this class
nxp_ip 0:7a206e6db594 5 *
nxp_ip 3:40f83904f0a8 6 * @class PCA9956A
nxp_ip 0:7a206e6db594 7 * @author Akifumi (Tedd) OKANO, NXP Semiconductors
nxp_ip 3:40f83904f0a8 8 * @version 0.6
nxp_ip 3:40f83904f0a8 9 * @date 04-Mar-2015
nxp_ip 0:7a206e6db594 10 *
nxp_ip 3:40f83904f0a8 11 * Released under the Apache 2 license License
nxp_ip 0:7a206e6db594 12 */
nxp_ip 0:7a206e6db594 13
nxp_ip 0:7a206e6db594 14 #ifndef MBED_PCA962x
nxp_ip 0:7a206e6db594 15 #define MBED_PCA962x
nxp_ip 0:7a206e6db594 16
nxp_ip 0:7a206e6db594 17 #include "mbed.h"
nxp_ip 3:40f83904f0a8 18 #include "CompLedDvr.h"
nxp_ip 0:7a206e6db594 19
nxp_ip 0:7a206e6db594 20 #define ALLPORTS 0xFF
nxp_ip 0:7a206e6db594 21 #define DEFAULT_PWM 1.0
nxp_ip 0:7a206e6db594 22
nxp_ip 3:40f83904f0a8 23 /** PCA962x class
nxp_ip 3:40f83904f0a8 24 *
nxp_ip 3:40f83904f0a8 25 * Abstract class for PCA962x family
nxp_ip 0:7a206e6db594 26 * No instance can be made from this class
nxp_ip 0:7a206e6db594 27 */
nxp_ip 3:40f83904f0a8 28 class PCA962x : public CompLedDvr
nxp_ip 0:7a206e6db594 29 {
nxp_ip 0:7a206e6db594 30 public:
nxp_ip 0:7a206e6db594 31 PCA962x( PinName i2c_sda, PinName i2c_scl, char i2c_address = DEFAULT_I2C_ADDR );
nxp_ip 0:7a206e6db594 32 PCA962x( I2C &i2c_obj, char i2c_address = DEFAULT_I2C_ADDR );
nxp_ip 0:7a206e6db594 33 virtual ~PCA962x();
nxp_ip 0:7a206e6db594 34
nxp_ip 0:7a206e6db594 35 void reset( void );
nxp_ip 0:7a206e6db594 36
nxp_ip 3:40f83904f0a8 37 virtual void pwm( int port, float v );
nxp_ip 3:40f83904f0a8 38
nxp_ip 0:7a206e6db594 39 void pwm( float *vp );
nxp_ip 0:7a206e6db594 40 virtual int number_of_ports( void ) = 0;
nxp_ip 0:7a206e6db594 41
nxp_ip 0:7a206e6db594 42 void write( char reg_addr, char data );
nxp_ip 0:7a206e6db594 43 void write( char *data, int length );
nxp_ip 0:7a206e6db594 44 char read( char reg_addr );
nxp_ip 0:7a206e6db594 45 void read( char reg_addr, char *data, int length );
nxp_ip 0:7a206e6db594 46
nxp_ip 0:7a206e6db594 47 protected:
nxp_ip 0:7a206e6db594 48 enum {
nxp_ip 0:7a206e6db594 49 DEFAULT_I2C_ADDR = 0xC0,
nxp_ip 0:7a206e6db594 50 AUTO_INCREMENT = 0x80,
nxp_ip 0:7a206e6db594 51 PWMALL = 0xFF
nxp_ip 0:7a206e6db594 52 };
nxp_ip 0:7a206e6db594 53
nxp_ip 0:7a206e6db594 54 private:
nxp_ip 0:7a206e6db594 55 virtual void initialize( void ) = 0;
nxp_ip 0:7a206e6db594 56 virtual char pwm_register_access( int port ) = 0;
nxp_ip 0:7a206e6db594 57
nxp_ip 0:7a206e6db594 58 I2C *i2c_p;
nxp_ip 0:7a206e6db594 59 I2C &i2c;
nxp_ip 0:7a206e6db594 60 char address; // I2C slave address
nxp_ip 0:7a206e6db594 61 }
nxp_ip 0:7a206e6db594 62 ;
nxp_ip 0:7a206e6db594 63
nxp_ip 0:7a206e6db594 64 #endif // MBED_PCA962x