I'm revamping my phi-menu after some initial defeat trying to turn it into a class.
So regarding turning the interactive LCD functions and menu into a library, I have the following two directions to take:
The functions I want to make available in the library are input functions that ask a user to enter information, integer, float, select from list, and input arbitrary texts.
They all return status of the user input (confirmed or escaped or else) and return values through the very first pointer.
Here's some prototypes if I pass individual parameters:
int input_integer(int *buffer, int low, int high, int step, byte col, byte row, int options)
int input_float(float *buffer, float low, float high, float step, byte col, byte row, int options)
int select_list(int *buffer, byte col, byte row, char ** list, byte total_items, byte list_style, int options)
int input_panel(char* msg, byte length, byte col, byte row, char _start, char _end)
I can have prototypes like:
int input_integer(phi_menu_parameters *para)
int input_float(phi_menu_parameters *para)
int select_list(phi_menu_parameters *para)
int input_panel(phi_menu_parameters *para)
Can someone critic on the pros and cons of each way on memory usage, FLASH usage, understandability of the above as a library, especially for newbies to use the library to construct decent interactive programs with LCD and buttons? Thank you. Been thinking too much and will listen to any input.
If instead I use a struct which is like this:
struct phi_menu_para
{
int *buffer;
int i_low;
int i_high;
int i_step;
float * f_buffer;
float f_low;
float f_high;
float f_step;
byte col;
byte row;
int options;
char ** list;
byte total_items;
byte list_style;
char* msg;
byte length;
char _start;
char _end;
};