Add the code to change the voltage of TELEM2 pins, but there is no change

Hi,
I want to change the output voltage of TELEM2 pins to 0V,so I download the pixhawk_toolchain and ardupilot code,and I just add some very simple code in ArduCopter.cpp like this(the code I added is in the end of setup() and the end of fast_loop() and the void Copter::pin(void) ):

void Copter::setup()
{
    // Load the default values of variables listed in var_info[]s
    AP_Param::setup_sketch_defaults();

    // setup storage layout for copter
    StorageManager::set_layout_copter();

    init_ardupilot();

    // initialise the main loop scheduler
    scheduler.init(&scheduler_tasks[0], ARRAY_SIZE(scheduler_tasks), MASK_LOG_PM);

    hal.gpio->pinMode(72, HAL_GPIO_OUTPUT) ;

 }

void Copter::loop()
{
    scheduler.loop();
    G_Dt = scheduler.get_last_loop_time_s();
}


// Main loop - 400hz
void Copter::fast_loop()
{
    // update INS immediately to get current gyro data populated
    ins.update();

    // run low level rate controllers that only require IMU data
    attitude_control->rate_controller_run();

    // send outputs to the motors library immediately
    motors_output();

    // run EKF state estimator (expensive)
    // --------------------
    read_AHRS();

#if FRAME_CONFIG == HELI_FRAME
    update_heli_control_dynamics();
#endif //HELI_FRAME

    // Inertial Nav
    // --------------------
    read_inertia();

    // check if ekf has reset target heading or position
    check_ekf_reset();

    // run the attitude controllers
    update_flight_mode();

    // update home from EKF if necessary
    update_home_from_EKF();

    // check if we've landed or crashed
    update_land_and_crash_detectors();

#if MOUNT == ENABLED
    // camera mount's fast update
    camera_mount.update_fast();
#endif

    // log sensor health
    if (should_log(MASK_LOG_ANY)) {
        Log_Sensor_Health();
    }
    pin();
}


void Copter::pin(void)
  {
      hal.gpio->write(72, 0) ;
   }

then I add code in Copter.h like this:
void pin();

after those,I compile the code to px4-v2,and download px4-v2 to pixhawk,but the voltage of TELEM2 pins is still 3.3V, no change.I know there is something wrong,but I don’t know where it is.
I hope someone can help me .Thank You!

Your function will only get called once, and will overwritten later by other code.

Thank you for your reply!
I thought fast_loop() ran in cycle.But if my function only get called once and overwritten later by other code,how could I keep my code run in cycle?
Besides,I don’t kown if the pin of TELEM2 in the code is right.Where can I get the pins of pixhawk?
Thank you so much!