I am developing a firmware application implemented in C, and I want to know what is a good design pattern for this kind of situation
- In main loop, I will get interrupt when I received data from a device using UART communication
- I would send a AT command and wait for the reply from the device, if the device reply OK, i will send the next AT command until all the commands finish
- If the device reply NOK (not ok), i will resend the command again
I have considered STATE machine, but I still think the implementation is not elegant, because I was waiting for the response in the main loop, to transit to another state.
Which design pattern should I implement?
Aucun commentaire:
Enregistrer un commentaire