diff --git a/gui.c b/gui.c index 29a40564..a1dc3431 100644 --- a/gui.c +++ b/gui.c @@ -29,7 +29,7 @@ static uint16_t addNode(struct guiNode_t *newNode) { return 1; } -static void deleteNode(char *name) { +static uint8_t deleteNode(char *name) { struct guiNode_t *pointer, *pointer1; if(firstGUI != NULL) { @@ -53,7 +53,11 @@ static void deleteNode(char *name) { } } + + return 1; // successful } + + return 0; // not successful } void guiPrintNodes(BaseSequentialStream *chp) { @@ -127,6 +131,10 @@ Thread *guiInit(uint16_t interval, tprio_t priority) { return tp; } +uint8_t guiDeleteElement(char *name) { + return deleteNode(name); +} + uint8_t guiDrawButton(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, char *str, uint16_t fontColor, uint16_t buttonColor, char *name, uint8_t *active, uint8_t *state) { struct guiNode_t *newNode; diff --git a/gui.h b/gui.h index 5e08ac00..18251291 100644 --- a/gui.h +++ b/gui.h @@ -48,6 +48,14 @@ Thread *guiInit(uint16_t interval, tprio_t priority); */ void guiPrintNode(BaseSequentialStream *chp); +/* + * Description: deletes a GUI element from the linked list + * + * param: - name: name of the element (parameter of each guiDrawXXX function) + * + * return: 1 if successful, 0 otherwise + */ +uint8_t guiDeleteElement(char *name); /* * Description: draws a button on the screen and keeps it's state up to date *