STM32F411 Blackpill: how to configure components

What I still don’t get is how to “activate” certain modules in the chip:
When I want a TIM2 1/10 sec tick starting the ADC1 CH1 and EOC to trigger a DMA transfer and want to send the data out via USB_CDC in CubeIDE I have “configure” the board (actually the IDE) to setup/include

TIM2
ADC1
DMA
USB
USB_CDC

and have to “connect” then to work together.

How ist that done in PlatformIO?

Are there examples available that “connect” STM32 features like I described ?