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

Method getPullup

libraries/MCP23S17/MCP23S17.cpp:317–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

315
316
317bool MCP23S17::getPullup(uint8_t pin, bool &pullup)
318{
319 if (pin > 15)
320 {
321 _error = MCP23S17_PIN_ERROR;
322 return false;
323 }
324 uint8_t inputPullupRegister = MCP23S17_PUR_A;
325 if (pin > 7)
326 {
327 inputPullupRegister = MCP23S17_PUR_B;
328 pin -= 8;
329 }
330 uint8_t val = readReg(inputPullupRegister);
331 if (_error != MCP23S17_OK)
332 {
333 return false;
334 }
335 uint8_t mask = 1 << pin;
336 pullup = (val & mask) > 0;
337 return true;
338}
339
340
341void MCP23S17::setSPIspeed(uint32_t speed)

Callers 1

unittestFunction · 0.45

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.36