ugfx/gui.h

80 lines
2.0 KiB
C
Raw Normal View History

2012-06-07 12:37:29 +00:00
#ifndef GUI_H
#define GUI_H
2012-06-09 13:41:28 +00:00
struct button_t {
2012-06-07 17:01:37 +00:00
uint16_t x0;
uint16_t y0;
uint16_t x1;
uint16_t y1;
2012-06-09 13:41:28 +00:00
uint32_t *state;
uint16_t interval;
};
2012-06-09 17:29:35 +00:00
struct bar_t {
uint16_t x0;
uint16_t y0;
uint16_t x1;
uint16_t y1;
uint16_t orientation;
uint16_t frameColor;
uint16_t bkColor;
uint16_t valueColor;
uint16_t interval;
uint8_t *percent;
};
enum {horizontal, vertical};
#ifdef __cplusplus
extern "C" {
#endif
2012-06-07 21:48:51 +00:00
/*
* Description: starts main GUI thread which keeps X and Y coordinates of touchpad updated for guiDraw() threads
*
* param:
* - updateInterval: update interval in milliseconds until next coordinates read-out
*
* return: none
*/
void guiInit(uint16_t updateIntervl);
/*
* Description: draws button and creates thread which keeps pressed/unpressed state up-to-date
*
* param:
* - x0, y0, x1, y1: coordinates where button gets drawn
* - str: string written centered into button
* - fontColor: color of string
* - buttonColor: color of button
2012-06-09 17:29:35 +00:00
* - interval: interval in ms which updates state
2012-06-07 21:48:51 +00:00
* - state: pointer to variable which keeps state (1 = pressed, 0 = unpressed)
*
* return: pointer to created thread
*/
2012-06-09 13:41:28 +00:00
Thread *guiDrawButton(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, unsigned char *str, uint16_t fontColor, uint16_t buttonColor, uint16_t inverval, uint8_t *state);
2012-06-09 17:29:35 +00:00
/*
* Description: draws a bar graph and updates it's value
*
* param:
* - x0, y0, x1, y1: coordinates where bar graph gets drawn
* - orientation: horizontal or vertical
* - frameColor: color of the frame
* - bkColor: color of piece inside bar with is not set
* - valueColor: color of value that will be drawn into bar
* - interval: interval in ms which updates percentage
* - percent: pointer value from 0 to 100 percent
*
* return : pointer to created thread
*/
Thread *guiDrawBarGraph(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t orientation, uint16_t frameColor, uint16_t bkColor, uint16_t valueColor, uint16_t interval, uint16_t *percent);
#ifdef __cplusplus
}
#endif
2012-06-07 12:37:29 +00:00
#endif