Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: PCA9626_Hello PCA9624_Hello PCA9622_Hello
PCA9626.cpp
00001 #include "mbed.h" 00002 #include "PCA9626.h" 00003 00004 PCA9626::PCA9626( PinName i2c_sda, PinName i2c_scl, char i2c_address ) 00005 : PCA962x( i2c_sda, i2c_scl, i2c_address ), n_of_ports( 24 ) 00006 { 00007 initialize(); 00008 } 00009 00010 PCA9626::PCA9626( I2C &i2c_obj, char i2c_address ) 00011 : PCA962x( i2c_obj, i2c_address ), n_of_ports( 24 ) 00012 { 00013 initialize(); 00014 } 00015 00016 PCA9626::~PCA9626() 00017 { 00018 } 00019 00020 void PCA9626::initialize( void ) 00021 { 00022 char init_array0[] = { 00023 PCA962x::AUTO_INCREMENT | REGISTER_START, // Command 00024 0x01, 0x00, // MODE1, MODE2 00025 }; 00026 char init_array1[] = { 00027 PCA962x::AUTO_INCREMENT | LEDOUT_REGISTER_START, // Command 00028 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, // LEDOUT[5:0] 00029 }; 00030 00031 write( init_array0, sizeof( init_array0 ) ); 00032 write( init_array1, sizeof( init_array1 ) ); 00033 } 00034 00035 char PCA9626::pwm_register_access( int port ) 00036 { 00037 if ( port < n_of_ports ) 00038 return ( PWM_REGISTER_START + port ); 00039 00040 return ( PWMALL ); 00041 } 00042 00043 int PCA9626::number_of_ports( void ) 00044 { 00045 return ( n_of_ports ); 00046 }
Generated on Wed Jul 13 2022 09:11:28 by
1.7.2
PCA9622, PCA9624, PCA9626 : 8, 16 & 24ch LED driver (Voltage switch type)