I have written a state machine for my motor controller but have run into writers block. How should I implement functions into the table?
For example On some states I want to clear the screen and write 2 new lines. On other I want to clear only one line and change it. I can call functions but I'm unsure how to call them with parameters and make it all useful.
I'm planning on having a timer that updates the LCD regularly so the only actions the states are going to do is modify an LCD buffer to suit that states data.
Thanks!
EDIT:
I cleaned up the code and modularized the project but now have a multiple structure definition problem while linking as well as an implicit declaration of my step function.
I think I have some multiple inclusions but I want my statemachine, lcd library, and bitmask libraries to be flexable as I use them in different projects so I include all the headers each file needs. Will this cause say the delay.h routines to be in every object or does the linker strip out duplicates?
Compiler/Linker Output (shorted for ease):
avr-gcc ......... -c ../Menu_Statemachine.c ../Menu_Statemachine.c: In function 'main': ../Menu_Statemachine.c:24: warning: implicit declaration of function 'step' avr-gcc ......... -o Menu_Statemachine.elf Statemachine.o:(.data+0x0): multiple definition of `the_table' Menu_Statemachine.o:(.data+0x0): first defined here