Custom uses for the analog pins on APM 2 board

I am currently working on a project that requires some custom modifications to the arducopter source code. I have experience writing arduino code but this doesn’t seem that straight forward. I’ve figured out where to put the code but am having trouble with the code itself. Accessing digital pins on a regular arduino would involve the function
My aim is to utilise the pins A0-A9, to have 8 digital outputs and 1 analog input could someone please provide some sample code about pin declaration and accessing.
I am aware that in order to use a pin for digital use it is declared with a different number than if the same pin is to be used for analog purposes. But then how would inputs or outputs be represented.

Thank you