code: func (m *MCP23017Driver) ReadGPIO(pin uint8, portStr string) (val uint8, err error) {
  	selectedPort := m.getPort(portStr)
  	// read current value of IODIR register
  	iodir, err := m.read(selectedPort.IODIR)
  	if err != nil {
  		return 0, err
  	}
  	// set pin as input by setting bit
  	iodirVal := setBit(iodir, uint8(pin))
  	// write IODIR register bit
  	err = m.write(selectedPort.IODIR, uint8(pin), uint8(iodirVal))
  	if err != nil {
  		return 0, err
  	}
  	val, err = m.read(selectedPort.GPIO)
  	if err != nil {
  		return val, err
  	}
  	val = 1 << uint8(pin) & val
  	if val > 1 {
  		val = 1
  	}
  	return val, nil
  }
docs: // ReadGPIO reads a value from a given gpio pin (0-7) and a
  // port (A or B).