#define MCP23017_I2C_ADDR(ADx)  (0x40 + 2*(ADx))

MCP23017_I2C_ADDR returns the 8-bit I2C address for the MCP23017 for the address configuration signals AD0, AD1, and AD2 presented in X. AD0 is the least significant bit and AD2 is the most significant bit, hence 0x6 represents AD2=1, AD1=1, AD0=0.

The address is calculated as 0x40 + 2*ADx).