STM32L is programmed in STM32CubeIDE with its HAL.
The code will be available in GitHub but this moment it is still working in progress. The snippets I have posted in the thread Screen rotation like a smartphone in runtime exposes all relevant code for rotation related.