How to address MCP23017 GPIO in functions?

Question from a newbie.

Imagine there is a library that I use; for example: TMC2130Stepper.h
I enter the pin number (EN_PIN = 4) into TMC2130Stepper(…)

#define EN_PIN 4     
  
#include <TMC2130Stepper.h>

TMC2130Stepper driver = TMC2130Stepper(EN_PIN);

While,

On MCP23017 GPIO expander, ports are named from 0 to 16 but I can only access them as below.

#include <Wire.h>
#include <Adafruit_MCP23017.h>

#define EN_PIN 0 

Adafruit_MCP23017 mcp;

mcp.digitalWrite(EN_PIN, HIGH);

My question is; how I can use a pin (GPIO) number that is on MCP23017 in TMC2130Stepper function?

Thank you.

My question is; how I can use a pin (GPIO) number that is on MCP23017 in TMC2130Stepper function?

You cannot. If you want to use that functionality you have to modify the TMC2130Stepper library.

pylon: You cannot. If you want to use that functionality you have to modify the TMC2130Stepper library.

Thank you so much. This will save time.

Speaking of time,

you may want to check and be sure that using an i/o expander will be fast enough to operate the stepper motor properly.

I didn’t try to speed it up, but out of the box the i/o expander library seemed quite slow compared to direct pin manipulation.

Just sayin’.

alto