When you compile a piece of code that has files included in it. What parts get compiled?
Everything fed to the compiler gets compiled into an "object file" (dot-obj file).
For instance, if I've created a library to take advantage of the full function of my MCP23017 I/O expander but I never call a specific function that I've coded in the header file, does that get compiled with everything
Yes. However, the linker removes most "dead code". From what you've described it is very likely that the unreferenced function will be removed by the linker.