Some unstructured thoughts....
To minimize mem impact, we maybee should just load the GUI configuration and load the bmy's at demand ?
One solution could be, having a array of pointers, and when loading a GUI config, malloc space for each of the GUI component description, storing the pointer in the array.
The allocated memory, that describes:
What the GUI component represents, eg. GUI_PROGRESSBAR, should do with a byte ?
Type of GUI component, Text, graphic, should also do with a byte ?
Position x
Position y
And then a char array, if its a graphical GUI component that requires more than one bmy lets use ; as delimiter and then 0x00 teminated.
And then in the GUI update function,
eg. (Just pseudo code...)
while (g_pGuiComponent[idx] != NULL) {
pGuiComp = g_pGuiComponent[idx];
switch (pGuiComp[0]) {
case GUI_PROGRESSBAR:
switch (pGuiComp[1]) {
case GRAPH:
draw grapic at pGuiComp[2], pGuiComp[3], using bmy with index in delimited string based upon the value...
break;
default:
//Handle it as text...
draw text at pGuiComp[2], pGuiComp[3], using string with the value added...
break;
}
...
break;
case GUI_BATTERY:
}
}