This code is in Arduino framework written in VS Code with platformio extension and it can be used for Arduino uno, mega, nano, pro mini, micro as well as STM32f1xx To set the platform open platfromio.ini fine in main repo.
[platformio]
default_envs = bluepill_f103c6
and change default_env from blue_pill to pro16MHzatmega328, uno or other platforms can be added. to compile the code short key ctrl+alt+b for upload to board ctrl+alt+u.