Please read in the documentation of that expansion module: https://docs.m5stack.com/en/module/extport_for_core2
the section "PinMap" will explain it all. In the section "Schematic" you see how it is done.