Hello @Elliot95 ,
Currently there is no ready-made function to make an emergency stop of the motor, because calling stop motor stops the motor but with inertia it continues to run a little if it is started at high speed. A solution that I can suggest to you is to look at the turn on low side switches, which allows when stopping the motor to apply braking due to the short circuit of the motor phases.

On the workbench you can activate overvoltage with the turn on low side switches function, and if you put the board in overvoltage you will see that it stops immediately the motor. You can try to make an API that calls the PWMC_TurnOnLowSides function used in the mc_tasks file to the TSK_SafetyTask_LSON function and then have the same result.
Regards