| 315 | |
| 316 | |
| 317 | bool 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 | |
| 341 | void MCP23S17::setSPIspeed(uint32_t speed) |