Modify digitalWrite

in my core I have a function that defines the default I/O modes, so the user doesn't need to do it. the function which does it is the following:

image

This function is called in cores/myCore/main.cpp
I added the funcion in the main function:

int main( void ){
custom_initDefaultIOPins();
setup();

for (;; ){
loop();
return 0;
}

So my idea is that digitalWrite() function will know about Adafruit_MCP23008 configuration because I'll use and extern object corresponding to the MCP_23008 class properly configured and with the .begin() already done. As I did in the custom function custem_InitDefaultIOPins.