FabGL
ESP32 Display Controller and Graphics Library

◆ initDevice()

void initDevice ( uint8_t  hwAddr)

Initializes additional MCP23S17 devices connected to the same SPI bus but with a different hardware address.

It is not necessary to call initDevice() having a single MCP23S17 device.

Parameters
hwAddrHardware address of additional device

Example:

MCP23S17 io;
io.begin(35, 12, 14, 13);                            // MISO = 35, MOSI = 12, CLK = 14, CS = 13
io.initDevice(0);                                    // initializes device with hardware address 0
io.initDevice(1);                                    // initializes device with hardware address 1
io.configureGPIO(MCP_A0, MCPDir::Output, false, 0);  // set A0 of device 0 as output
io.configureGPIO(MCP_A0, MCPDir::Input, false, 1);   // set A0 of device 1 as input

Definition at line 105 of file MCP23S17.cpp.