@@ -628,7 +628,7 @@ void MCP23xModuleInit(void) {
628
628
#endif
629
629
while ((Mcp23x.max_devices < MCP23XXX_MAX_DEVICES) && PinUsed (GPIO_MCP23SXX_CS, Mcp23x.max_devices )) {
630
630
Mcp23x.chip = Mcp23x.max_devices ;
631
- uint32_t pin_int = (Mcp23x.iocon .ODR ) ? 0 : Mcp23x.chip ; // INT pins are open-drain outputs and supposedly connected together to one GPIO
631
+ uint32_t pin_int = (Mcp23x.iocon .ODR ) ? 0 : Mcp23x.chip ; // INT ODR pins are open-drain outputs and supposedly connected together to one GPIO
632
632
Mcp23x.device [Mcp23x.chip ].pin_int = (PinUsed (GPIO_MCP23XXX_INT, pin_int)) ? Pin (GPIO_MCP23XXX_INT, pin_int) : -1 ;
633
633
Mcp23x.device [Mcp23x.chip ].pin_cs = Pin (GPIO_MCP23SXX_CS, Mcp23x.max_devices );
634
634
digitalWrite (Mcp23x.device [Mcp23x.chip ].pin_cs , 1 );
@@ -719,6 +719,8 @@ void MCP23xModuleInit(void) {
719
719
return ;
720
720
}
721
721
722
+ AddLog (LOG_LEVEL_DEBUG_MORE, PSTR (" MCP: INT open-drain %d" ), Mcp23x.iocon .ODR );
723
+
722
724
Mcp23x.relay_offset = TasmotaGlobal.devices_present ;
723
725
Mcp23x.relay_max -= UpdateDevicesPresent (Mcp23x.relay_max );
724
726
@@ -774,7 +776,8 @@ void MCP23xInit(void) {
774
776
gpio = MCP23xRead16 (MCP23X17_GPIOA); // Clear MCP23x17 interrupt
775
777
}
776
778
if (Mcp23x.iocon .ODR && Mcp23x.chip ) { continue ; }
777
- pinMode (Mcp23x.device [Mcp23x.chip ].pin_int , (Mcp23x.iocon .ODR ) ? INPUT_PULLUP : INPUT);
779
+ // pinMode(Mcp23x.device[Mcp23x.chip].pin_int, (Mcp23x.iocon.ODR) ? INPUT_PULLUP : INPUT);
780
+ pinMode (Mcp23x.device [Mcp23x.chip ].pin_int , INPUT_PULLUP);
778
781
attachInterrupt (Mcp23x.device [Mcp23x.chip ].pin_int , MCP23xInputIsr, (Mcp23x.iocon .ODR ) ? FALLING : CHANGE);
779
782
}
780
783
}
0 commit comments