gfdgd
Fork of PCA995xA by
base_class/PCA995xA.h@1:3522be54a4f5, 2015-02-28 (annotated)
- Committer:
- nxp_ip
- Date:
- Sat Feb 28 23:15:51 2015 +0000
- Revision:
- 1:3522be54a4f5
- Parent:
- 0:a624e2eeccac
- Child:
- 2:eeea2e848b81
Doxygen update
Who changed what in which revision?
User | Revision | Line number | New 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 | 0:a624e2eeccac | 18 | |
nxp_ip | 0:a624e2eeccac | 19 | #define ALLPORTS 0xFF |
nxp_ip | 0:a624e2eeccac | 20 | #define DEFAULT_PWM 1.0 |
nxp_ip | 0:a624e2eeccac | 21 | #define DEFAULT_CURRENT 0.1 |
nxp_ip | 0:a624e2eeccac | 22 | |
nxp_ip | 1:3522be54a4f5 | 23 | /** Abstract class for PCA995xA family |
nxp_ip | 1:3522be54a4f5 | 24 | * |
nxp_ip | 0:a624e2eeccac | 25 | * No instance can be made from this class |
nxp_ip | 0:a624e2eeccac | 26 | */ |
nxp_ip | 0:a624e2eeccac | 27 | class PCA995xA |
nxp_ip | 0:a624e2eeccac | 28 | { |
nxp_ip | 0:a624e2eeccac | 29 | public: |
nxp_ip | 0:a624e2eeccac | 30 | PCA995xA( PinName i2c_sda, PinName i2c_scl, char i2c_address = DEFAULT_I2C_ADDR ); |
nxp_ip | 0:a624e2eeccac | 31 | PCA995xA( I2C &i2c_obj, char i2c_address = DEFAULT_I2C_ADDR ); |
nxp_ip | 0:a624e2eeccac | 32 | virtual ~PCA995xA(); |
nxp_ip | 0:a624e2eeccac | 33 | |
nxp_ip | 0:a624e2eeccac | 34 | void reset( void ); |
nxp_ip | 0:a624e2eeccac | 35 | |
nxp_ip | 0:a624e2eeccac | 36 | void pwm( int port, float v ); |
nxp_ip | 0:a624e2eeccac | 37 | void pwm( float *vp ); |
nxp_ip | 0:a624e2eeccac | 38 | void current( int port, float vp ); |
nxp_ip | 0:a624e2eeccac | 39 | void current( float *vP ); |
nxp_ip | 0:a624e2eeccac | 40 | virtual int number_of_ports( void ) = 0; |
nxp_ip | 0:a624e2eeccac | 41 | |
nxp_ip | 0:a624e2eeccac | 42 | void write( char reg_addr, char data ); |
nxp_ip | 0:a624e2eeccac | 43 | void write( char *data, int length ); |
nxp_ip | 0:a624e2eeccac | 44 | char read( char reg_addr ); |
nxp_ip | 0:a624e2eeccac | 45 | void read( char reg_addr, char *data, int length ); |
nxp_ip | 0:a624e2eeccac | 46 | |
nxp_ip | 0:a624e2eeccac | 47 | protected: |
nxp_ip | 0:a624e2eeccac | 48 | enum { |
nxp_ip | 0:a624e2eeccac | 49 | DEFAULT_I2C_ADDR = 0xC0, |
nxp_ip | 0:a624e2eeccac | 50 | AUTO_INCREMENT = 0x80 |
nxp_ip | 0:a624e2eeccac | 51 | }; |
nxp_ip | 0:a624e2eeccac | 52 | |
nxp_ip | 0:a624e2eeccac | 53 | private: |
nxp_ip | 0:a624e2eeccac | 54 | virtual char pwm_register_access( int port ) = 0; |
nxp_ip | 0:a624e2eeccac | 55 | virtual char current_register_access( int port ) = 0; |
nxp_ip | 0:a624e2eeccac | 56 | |
nxp_ip | 0:a624e2eeccac | 57 | I2C *i2c_p; |
nxp_ip | 0:a624e2eeccac | 58 | I2C &i2c; |
nxp_ip | 0:a624e2eeccac | 59 | char address; // I2C slave address |
nxp_ip | 0:a624e2eeccac | 60 | } |
nxp_ip | 0:a624e2eeccac | 61 | ; |
nxp_ip | 0:a624e2eeccac | 62 | |
nxp_ip | 0:a624e2eeccac | 63 | #endif // MBED_PCA995xA |