MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / begin

Method begin

libraries/MCP23017_RT/MCP23017.cpp:47–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46#if defined(ESP8266) || defined(ESP32)
47bool MCP23017::begin(const uint8_t dataPin, const uint8_t clockPin)
48{
49 _wire = &Wire;
50 _wire->begin(dataPin, clockPin);
51 // check connected
52 if (! isConnected()) return false;
53 // disable address increment (datasheet)
54 if (! writeReg(MCP23017_IOCR, 0b00100000)) return false;
55 // Force INPUT_PULLUP
56 if (! writeReg(MCP23017_PUR_A, 0xFF)) return false;
57 if (! writeReg(MCP23017_PUR_B, 0xFF)) return false;
58 return true;
59}
60#endif
61
62

Callers 1

unittestFunction · 0.45

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.36