gfdgd

Dependencies:   CompLedDvrCC

Fork of PCA995xA by InetrfaceProducts NXP

Committer:
nxp_ip
Date:
Wed Mar 04 10:25:58 2015 +0000
Revision:
2:eeea2e848b81
Parent:
1:3522be54a4f5
LedPwmOut API (Constant-current type device version: LedPwmOutCC) is included

Who changed what in which revision?

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