From a1cc224472060b08e18a6f17e94852d8a461ccf9 Mon Sep 17 00:00:00 2001 From: Tectu Date: Tue, 26 Jun 2012 21:43:21 +0200 Subject: [PATCH] added wheel as GUI type --- gui.c | 33 ++++++++++++++++++++++++++++++++- gui.h | 5 ++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/gui.c b/gui.c index 99db4133..0ecaf52d 100644 --- a/gui.c +++ b/gui.c @@ -103,6 +103,11 @@ static void guiThread(const uint16_t interval) { } + // we got a wheel + if(node->type == wheel) { + + } + // we got a keymatrix if(node->type == keymatrix) { @@ -129,11 +134,11 @@ uint8_t guiDrawButton(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, char * if(newNode == NULL) return 0; + newNode->type = button; newNode->x0 = x0; newNode->y0 = y0; newNode->x1 = x1; newNode->y1 = y1; - newNode->type = button; newNode->name = str; newNode->active = active; newNode->state = state; @@ -148,3 +153,29 @@ uint8_t guiDrawButton(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, char * return 1; } +uint8_t guiDrawSlider(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t orientation, uint16_t frameColor, uint16_t bkColor, uint16_t valueColor, uint8_t *active, uint8_t *value) { + struct guiNode_t *newNode; + + newNode = chHeapAlloc(NULL, sizeof(struct guiNode_t)); + if(newNode == NULL) + return 0; + + newNode->type = slider; + newNode->x0 = x0; + newNode->y0 = y0; + newNode->x1 = x1; + newNode->y1 = y1; + newNode->state = value; + newNode->active = active; + newNode->orientation = orientation; + + if(addNode(newNode) != 1) + return 0; + + // lcdDraw functions + + chHeapFree(newNode); + + return 1; +} + diff --git a/gui.h b/gui.h index 05e4c383..9d1842da 100644 --- a/gui.h +++ b/gui.h @@ -12,6 +12,7 @@ static struct guiNode_t { uint16_t y0; uint16_t x1; uint16_t y1; + uint8_t orientation; uint8_t *active; uint8_t *state; char *name; @@ -22,7 +23,7 @@ static struct guiNode_t { extern "C" { #endif -enum {button, slider, keymatrix}; +enum {button, slider, wheel, keymatrix}; enum {horizontal, vertical}; enum {inactive, active}; @@ -59,6 +60,8 @@ void guiPrintNode(BaseSequentialStream *chp); */ uint8_t guiDrawButton(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, char *str, uint16_t fontColor, uint16_t buttonColor, uint8_t *active, uint8_t *state); +uint8_t guiDrawSlider(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t orientation, uint16_t frameColor, uint16_t bkColor, uint16_t valueColor, uint8_t *active, uint8_t *value); + #ifdef __cplusplus } #endif