I'm not sure how to proceed on a project when it comes to the code design.
Think of a device which has to monitor a voltage value with an analog/digital converter and sometimes has to regulate it's pwm output if the measured values leave certain limits. The device also has an interface, e.g. LEDs and buttons and a potentiometer.
If the user changes the potentiometer value, the device will still have to monitor the voltage while the device is waiting for user input. And another concern is that the device will have to act fast (shutting down the driver for a supply within 10ms). Would you recommend a state machine or rather procedural programming?
How hard would it be to build up a state machine in C? Would it be fast enough when the Controller (STM32F0) has to read 4 ADC inputs and generate 2 PWMs?