Skip to content

Commit

Permalink
fix pca6416 pin level read function
Browse files Browse the repository at this point in the history
Signed-off-by: Clark Wang <[email protected]>
  • Loading branch information
wangxiaoningnxp committed Aug 18, 2020
1 parent 972ad1c commit e34c3cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
1 change: 1 addition & 0 deletions bcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ static void print_help(char* cmd)
printf(" %s%-50s%s%s\n", g_vt_default, " [-nodisplay] [-hz=] [-hwfilter]", g_vt_green, "");
printf(" %s%-50s%s%s\n", g_vt_default, " [-unipolar]", g_vt_green, "");
printf("\n");
printf(" %s%-50s%s%s\n", g_vt_default, "get_level [GPIO_NAME] [-board=] [-id=]", g_vt_green, "get level state of pin GPIO_NAME");
printf(" %s%-50s%s%s\n", g_vt_default, "set_gpio [GPIO_NAME] [1/0] [-board=] [-id=]", g_vt_green, "set pin GPIO_NAME to be high(1) or low(0)");
printf(" %s%-50s%s%s\n", g_vt_default, "set_boot_mode [BOOTMODE_NAME] [-board=] [-id=]", g_vt_green, "set BOOTMODE_NAME as boot mode");
printf("\n");
Expand Down
8 changes: 1 addition & 7 deletions chip.c
Original file line number Diff line number Diff line change
Expand Up @@ -882,9 +882,6 @@ int pca6416a_read(void* pca6416a, unsigned char* bit_value_buffer)
unsigned char input_cmd = (pca->port) + 0x00; //x00h is the input command
int bSucceed = 0;

if(pca->gpio_device.opendrain > 0)
input_cmd = (pca->port) + 0x6;

bSucceed = parent->i2c_start(parent);
if (bSucceed) return bSucceed;
bSucceed = parent->i2c_write(parent, addr_plus_write, I2C_TYPE_GPIO);
Expand All @@ -901,7 +898,7 @@ int pca6416a_read(void* pca6416a, unsigned char* bit_value_buffer)
if (bSucceed) return bSucceed;

//mask away unwanted value;
*bit_value_buffer = (*bit_value_buffer) & (~pca->gpio_device.pin_bitmask);
*bit_value_buffer = (*bit_value_buffer) & (pca->gpio_device.pin_bitmask);
return 0;
}

Expand Down Expand Up @@ -1111,9 +1108,6 @@ int pcal6524h_read(void* pcal6524h, unsigned char* bit_value_buffer)
unsigned char input_cmd = (pca->port) + 0x00; //x00h is the input command
int bSucceed = 0;

if (pca->gpio_device.opendrain > 0)
input_cmd = (pca->port) + 0x6;

bSucceed = parent->i2c_start(parent);
if (bSucceed) return bSucceed;
bSucceed = parent->i2c_write(parent, addr_plus_write, I2C_TYPE_GPIO);
Expand Down

0 comments on commit e34c3cc

Please sign in to comment.