This repository was archived by the owner on Apr 28, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -62,18 +62,20 @@ bool pcal6416a_init(void) {
6262 // ERROR HANDLING; you can check errno to see what went wrong
6363 return false;
6464 }
65+
66+ /// Probing known I2C GPIO expander chips
6567 for (i = 0 , i2c_expander_addr = 0 ; i2c_chip [i ].address ; i ++ ) {
6668
67- /// Probing I2C GPIO expander chip
6869 if (ioctl (fd_i2c_expander , I2C_SLAVE_FORCE , i2c_chip [i ]) < 0 ||
6970 pcal6416a_read_mask_interrupts () < 0 ) {
70- printf ("In %s - Failed to acquire bus access and/or talk to slave %s at address 0x%02X.\n" ,
71+ DEBUG_PRINTF ("In %s - Failed to acquire bus access and/or talk to slave %s at address 0x%02X.\n" ,
7172 __func__ , i2c_chip [i ].name , i2c_chip [i ].address );
72- } else {
73- DEBUG_PRINTF ("Found I2C gpio expander chip %s at address 0x%02X\n" ,
74- i2c_chip [i ].name , i2c_chip [i ].address );
75- i2c_expander_addr = i2c_chip [i ].address ;
76- }
73+ } else {
74+ DEBUG_PRINTF ("Found I2C gpio expander chip %s at address 0x%02X\n" ,
75+ i2c_chip [i ].name , i2c_chip [i ].address );
76+ i2c_expander_addr = i2c_chip [i ].address ;
77+ break ;
78+ }
7779 }
7880
7981 /// GPIO expander chip found?
You can’t perform that action at this time.
0 commit comments