Hello,
There is an easy way to do what you want to do provided that it is only for testing purposes and not for actually driving a motor: you need to reconfigure the 6 pins that drive the 6 FETs as pure GPIOs. Doing this will allow you to individually drive each of them, as GPIOs.
Beware! This can be dangerous if you have a motor (or another power equipment) plugged to your hardware, after your FETs: if one or more high side FET is driving for too long or if you close both the high and the low side FET of a phase at the same time, you may experience high currents flowing through your system that may damage or even destroy it. Also, this kind of situation can be dangerous for anyone physically near to the hardware setup.
The code extracts that you highlight in your question do not directly control the FETs. They actually interface an Advanced Timer (most probably TIM1, but it depends on what timer is referenced by the TIMx variable) that does control the FETs. Advanced Timers on STM32 devices can handle both the High and the Low sides for driving a motor phase. They feature at least three channels that allow for handling the three phases of a motor.
When configured to do so, each of the three channels of an Advanced Timer is assigned a duty cycle (on each PWM period) and will toggle the high and low side switches according to this duty cycle.
This is done by the calls to the LL_TIM_OC_SetCompareCh*() functions visible in your code extracts. When setting the duty cycle to 0 for all phases (as in the first code extract), you make sure that the three low sides are closed, while the three high sides are open. Controlling the FETs through the timer means controlling both the high and the low side FETs of a phase at the same time. This prevents hazardous short circuits from happening.
A dead time is configured in the timer to prevent short circuits that can occur when switching a phase from Bus to Ground and vice versa. Also, the BREAKIN2 Timer input can be used to stop energizing the phases when an over current (or over voltage, or any other fault) occurs.
All this information is detailed in the Reference Manual of the STM32G4 devices which is available here: https://www.st.com/resource/en/reference_manual/rm0440-stm32g4-series-advanced-armbased-32bit-mcus-stmicroelectronics.pdf. Aim for chapter 28 - Advanced-control timers, from page 1084 onwards, for a complete description of the features of these timers.
In the hope it will help you.
Best Regards,
Fred.