uint8 readExpanderPins( uint8 addr)
{
uint8 stat;
uint8 buff;
buff = 0x00; //read the input port register
stat = write_readI2C( ADDR_1, 1, 0x00, &buff, 1 ); //passing the addr, readSize, offset, buffer, bus
if(!stat)
{
bit2status = ( buff & 0x04 ); //buff[2]; bit2
bit3tatus = ( buff & 0x08 ); //buff[3]; bit3
bit4status = ( buff & 0x01 ); //buff[4]; bit4
bit5status = ( buff & 0x20 ); //buff[5]; bit5
bit6status = ( buff & 0x40 ); //buff[6]; bit6
}
return stat;
|