# Reprogram Marlin to assign endstop pins to arbitrary tasks [Arduino Mega]

Can someone point me out an appropriate entry code for this task in Marlin source code?

• has already enabled USE_<AXIS>_PLUG (for example <AXIS> = XMIN) in Marlin's Configuration.h,
• one can add an additional define (for example <AXIS>_ENDSTOP_CUSTOM) in Configuration.h and
• make this block the else statement in an <AXIS>_ENDSTOP_CUSTOM existence check, with the positive case being your arbitrary task.
The function that gets executed in the standard case in the linked block is PROCESS_ENDSTOP, so cloning it would be a good starting point to make a PROCESS_ENDSTOP_CUSTOM task, too.