I'm working on a safety system that requires me to implement 2oo3 voting. I roughly have an idea of implementing this using state machines using function pointers. Assume there are 3 systems, A B C. With respect to A, C is left system and B is right system With respect to B, A is left system and C is right system With respect to C, B is left system and C is right system
For every decision that a system takes,it shall cause the function pointer to point to the "exchange data with left system" function. After data is sent to the Left system it shall point to a dummy function and wait for the Left system to reply.
When the Left system replies and its decision(left system) also agrees with decision made by the system(my system),it shall proceed to the next state. If it disagrees it shall repeat the same with "exchange data with right system" and proceed.
My doubt here is since i dont want to implement using Flags for state transition control,is implementation using function pointers ok cause nowhere does MISRA 2004 onwards say not to use function pointers??
Is the approach to a 2oo3 implementation as above ok or is there something else to be taken care of?
Are there any other approaches to implementing a 2oo3 architecture(No external comparator for decisions made by each system. That is, each uC shall form a decision itself and consult its decision with the other 2.It will not place its decision in an external comparator(ex:shared memory, fpga based comparator etc) for access and comparison by the other 2 systems)??
Please forgive me if i have approached it wrongly. Im a newbie to this.
(Note:The 3 systems have only microcontrollers)
UPDATE: Some Useful points were added by @Lundin here - State Machine design with no function pointers