How can I send a custom DSHOT output signal?

Hi,

I’m writting my own code to implement a custom controller using a fork of ardupiilot 4.1.5. I was using the basic PWM output protocol and it was working fine, but I wanted to test DSHOT protocol as it is faster and more used nowadays. So basically I just changed the parameter MOT_PWM_TYPE = 6 (was 0 before) to use DSHOT600 and it seems to work, if I try the basic ardupilot code everything works fine but when I try my custom code the motors do not spin. I tried other protocols like Oneshot125 and PWM with good results but I really want to check DSHOT.

In my code I was using the following function to set the output of the motors:

SRV_Channels::set_output_pwm(SRV_Channel::k_motor1,<pwmM1>);

pwmM1 being the output pwm estimated by my controller

and then sending it with the function motors_output() in the fast_loop of Copter.cpp

I believe that this does not work anymore with DSHOT, so my question is how can I send the pwm estimated by my controller to the motors using DSHOT ?

Thanks for the help!