Mcp23xxx read function error

Hi;

We are using mcp23xxx mongoose library. When we configure pins as output, we can controll all pins. But when we configure some pins input, some pins output we can’t read correctly states about input pins. mgos_mcp23xxx_gpio_read() function is not work properly for us. When the input logic level changed, we can not read it on console. Our code example:

#include "mgos.h"
#include "mgos_config.h"
#include "mgos_mcp23xxx.h"

static struct mgos_mcp23xxx *mcp23_expanders[1];




#define MCP23_ADDRESS_RELAY_BOARD_1 0x27 //0100{A2}{A1}{A0} 0100000


static void main_function(void *arg) {
  LOG(LL_INFO, ("IN main function"));
  LOG(LL_INFO, ("0. Pin Value: %d", mgos_mcp23xxx_gpio_read(mcp23_expanders[0], 0)));
  LOG(LL_INFO, ("4. Pin Value: %d", mgos_mcp23xxx_gpio_read(mcp23_expanders[0], 4)));
  LOG(LL_INFO, ("9. Pin Value: %d", mgos_mcp23xxx_gpio_read(mcp23_expanders[0], 9)));
  LOG(LL_INFO, ("15. Pin Value: %d", mgos_mcp23xxx_gpio_read(mcp23_expanders[0], 15)));

}

enum mgos_app_init_result mgos_app_init(void) {


  if (!(mcp23_expanders[0] = mgos_mcp23017_create(mgos_i2c_get_global(), MCP23_ADDRESS_RELAY_BOARD_1,
                                mgos_sys_config_get_mcp23xxx_int_gpio()))) {
    LOG(LL_ERROR, ("Could not create MCP230XX"));
    return MGOS_APP_INIT_ERROR;
  }

  for(int i=0; i<16; i++) {
    mgos_mcp23xxx_gpio_set_mode(mcp23_expanders[0], i, MGOS_GPIO_MODE_INPUT);  
  }



  mgos_set_timer(5000 /* ms */, true /* repeat */, main_function, NULL /* arg */);

  return MGOS_APP_INIT_SUCCESS;
}