Long and short button press with stm32f0
The code could be improved greatly. 

First, delays are bad, very bad, don't use delays. It slows your code down and holds it still. The code you have right now can only do one thing. If you ever wanted to code to do anything else it would be difficult. 

There are better ways to write time dependent events. 


Set up a timer that counts some nice amount of time such as a millisecond. 
In the main loop service the timer and set flags for time events. For example; 1 second, 500 milliseconds, 10 milliseconds and so on. 
In the main loop after the timer service have IF statements that trigger depending on time flags. For example blinking a light; every time the 500 millisecond flag is set the IF statement goes into work and inverts the light then resets the flag. 
For the debounce. Store a main variable that keeps track of the button. Every millisecond check the button. If the button does not match the stored state then start a debounce. For the debounce start a counter at 50. Keep checking the button every millisecond. If the button is high add 1 to the counter. If the button is low subtract one from the counter. If the counter reaches 0 the button is low. If the counter reaches 100 then the button is high. Store that value in the main button variable. Finally reset the debounce flag, that way you aren't always debouncing. 


This is just one way of doing it, there are others. This creates a limber operating system that can handle timed events.