Skip to content

Commit

Permalink
Fixed the chip identification message and added some chip debug output.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoller2k committed Feb 5, 2013
1 parent f86eaf9 commit 419c5cc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 6 additions & 1 deletion config.c
Expand Up @@ -199,6 +199,7 @@ int init_config(void)
}
}
setup_xio(j);
test_iic(xio_dev[j].addr, xio_dev[j].regno);
}


Expand Down Expand Up @@ -402,12 +403,16 @@ static void setup_xio(int xio)

switch(xio_dev[xio].type){
case IO_MCP23008:
case IO_MCP23017A:
write_iic(addr, 0, cfg_dat, 7);
printf("Configuring MCP23008\n");
break;
case IO_MCP23017A:
write_iic(addr, 0, cfg_dat, 7);
printf("Configuring MCP23017 port A\n");
break;
case IO_MCP23017B:
write_iic(addr, 0x10, cfg_dat, 7);
printf("Configuring MCP23017 port B\n");
break;
default:
break;
Expand Down
6 changes: 3 additions & 3 deletions iic.c
Expand Up @@ -83,11 +83,11 @@ int write_iic(int devAddr, int regno, char *buf, int n)
}


void test_iic(int devAddr)
void test_iic(int devAddr, int regaddr)
{
int i,n;

buffer[0] = 0;
buffer[0] = regaddr;

connect_iic(devAddr);

Expand All @@ -102,7 +102,7 @@ void test_iic(int devAddr)
perror("Error reading from i2c");
}
else{
printf("Read %d bytes\n",n);
printf("Read %d bytes from %02x/%02x\n",n, devAddr, regaddr);
for(i=0;i<n;i++){
printf(" %02x", (unsigned char)buffer[i]);
}
Expand Down
2 changes: 1 addition & 1 deletion iic.h
Expand Up @@ -38,7 +38,7 @@ int init_iic(void);
int connect_iic(int devAddr);
void poll_iic(int xio);
int write_iic(int devAddr, int regno, char *buf, int n);
void test_iic(int devAddr);
void test_iic(int devAddr, int regaddr);
void close_iic(void);

#endif

0 comments on commit 419c5cc

Please sign in to comment.