Update xsns_29_mcp230xx.ino

This commit is contained in:
andrethomas 2018-08-14 21:45:56 +02:00 committed by GitHub
parent 50f2eb3811
commit 1b714b0320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -151,12 +151,12 @@ void MCP230xx_ApplySettings(void) {
void MCP230xx_Detect() void MCP230xx_Detect()
{ {
uint8_t buffer;
if (mcp230xx_type) { if (mcp230xx_type) {
return; return;
} }
uint8_t buffer;
for (byte i = 0; i < sizeof(mcp230xx_addresses); i++) { for (byte i = 0; i < sizeof(mcp230xx_addresses); i++) {
mcp230xx_address = mcp230xx_addresses[i]; mcp230xx_address = mcp230xx_addresses[i];
I2cWrite8(mcp230xx_address, MCP230xx_IOCON, 0x80); // attempt to set bank mode - this will only work on MCP23017, so its the best way to detect the different chips 23008 vs 23017 I2cWrite8(mcp230xx_address, MCP230xx_IOCON, 0x80); // attempt to set bank mode - this will only work on MCP23017, so its the best way to detect the different chips 23008 vs 23017