diff --git a/common/app/screen_main.h b/common/app/screen_main.h index 1be9ea9..94bbdef 100644 --- a/common/app/screen_main.h +++ b/common/app/screen_main.h @@ -7,7 +7,7 @@ /** * @defgroup screens Screens - * The Screens of the application. \sa Screen + * The Screens of the application. \sa \ref screen */ /*@}*/ diff --git a/common/gui/button.h b/common/gui/button.h index b8c6a98..b0d0bac 100644 --- a/common/gui/button.h +++ b/common/gui/button.h @@ -17,17 +17,54 @@ #include "touch.h" +/** + * Prototype for Event Listeners (called when the button is pressed) + * @param button The pointer to the BUTTON_STRUCT where to corresponding Button was pressed + */ +typedef void (*BUTTON_CALLBACK)(void *button); -typedef void (*BUTTON_CALLBACK)(void *button); //!< Function pointer used... + +/** + * Structure to configure the Button + */ typedef struct { - TOUCH_AREA_STRUCT base; - uint16_t bgcolor; - BUTTON_CALLBACK callback; //Callback - uint16_t txtcolor; - uint8_t font; - const char *text; - + TOUCH_AREA_STRUCT base; //!< Basic geometry of the button. You only need to set the x1, y1, x2, y2 members of this struct. + uint16_t bgcolor; //!< The 16-bit background color of the button + BUTTON_CALLBACK callback; //!< Callback + uint16_t txtcolor; //!< The 16-bit text color + uint8_t font; //!< The number of the font to use + const char *text; //!< The label of the button } BUTTON_STRUCT; + + +#define AUTO 0 //!< Use this value instead of x2, y2 in the BUTTON_STRUCT to autocalculate the button width/height + +/** + * Adds a button. Your Callback will be called from now on, if the button was pressed + * @param button A Pointer to the preinitialized BUTTON_STRUCT + * @return true on success + */ +bool gui_button_add(BUTTON_STRUCT* button); + +/** + * Removes the button. You will no longer receive events for this button. This function will not overdraw the region where the button was located. + * @param button A Pointer to the BUTTON_STRUCT + */ +void gui_button_remove(BUTTON_STRUCT* button); + +/** + * Redraws the button. Call this method if you have to redraw the entire screen or if you want to draw a button on top of an image. + * @param button A Pointer to the BUTTON_STRUCT + */ +void gui_button_redraw(BUTTON_STRUCT* button); + +/* +bool guiAddBitmapButton(BITMAPBUTTON_STRUCT* button); +void guiRemoveBitmapButton(BITMAPBUTTON_STRUCT* button); +void guiRedrawBitmapButton(BITMAPBUTTON_STRUCT* button); +*/ + + /* typedef struct { TOUCH_AREA_STRUCT base; @@ -40,17 +77,7 @@ typedef struct { */ //Notice that the first 3 Members are Equal, so it's possible to cast it to a BUTTON_STRUCT even if it's a BITMAPBUTTON_STRUCT (when changeing only the first 3 Members). -#define AUTO 0 -bool gui_button_add(BUTTON_STRUCT* button); -void gui_button_remove(BUTTON_STRUCT* button); -void gui_button_redraw(BUTTON_STRUCT* button); - -/* -bool guiAddBitmapButton(BITMAPBUTTON_STRUCT* button); -void guiRemoveBitmapButton(BITMAPBUTTON_STRUCT* button); -void guiRedrawBitmapButton(BITMAPBUTTON_STRUCT* button); -*/ /*@}@}*/ diff --git a/common/tft/tft.h b/common/tft/tft.h index dde4f8d..66df24b 100644 --- a/common/tft/tft.h +++ b/common/tft/tft.h @@ -41,7 +41,8 @@ #define TRANSPARENT ((uint16_t)0x80C2) /** - * Initializes the display. Call this method before using any tft_* functions + * Initializes the display. + * Call this method before using any tft_* functions * @return true on success */ bool tft_init(); @@ -71,7 +72,8 @@ void tft_draw_line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t void tft_draw_pixel(uint16_t x,uint16_t y,uint16_t color); /** - * Draws the outline of a rectangle onto the display. The outline is one pixel wide and goes through the specified start and endpoint. + * Draws the outline of a rectangle onto the display. + * The outline is one pixel wide and goes through the specified start and endpoint. * @param x1 The x-Coordinate of the start-point * @param y1 The y-Coordinate of the start-point * @param x2 The x-Coordinate of the end-point @@ -91,7 +93,8 @@ void tft_draw_rectangle(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2, uint16_ void tft_fill_rectangle(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2, uint16_t color); /** - * Draws a bitmap onto the display without scaling/cropping. The bitmap must be provided as an array of 16-bit colors + * Draws a bitmap onto the display without scaling/cropping. + * The bitmap must be provided as an array of 16-bit colors * @param x The x-coordinate of the top-left corner to draw the bitmap at * @param y The y-coordinate of the top-left corner to draw the bitmap at * @param width The width of the bitmap in pixels diff --git a/common/touch/touch.h b/common/touch/touch.h index 08eecb1..da9e97d 100644 --- a/common/touch/touch.h +++ b/common/touch/touch.h @@ -25,7 +25,8 @@ typedef enum { } TOUCH_STATE ; /** - * Enum to describe the hooked actions for which you want to receive events for. You can OR-combine them. \sa touch_register_area + * Enum to describe the hooked actions for which you want to receive events for. + * You can OR-combine them. \sa touch_register_area */ typedef enum { NONE=0x00, //!< Do not receive any events @@ -38,7 +39,7 @@ typedef enum { /** * Prototype for Event Listeners (called for every occurring, hooked action) - * @param touchArea The pointer to the touchArea in which the event occurred + * @param touchArea The pointer to the TOUCH_AREA_STRUCT in which the event occurred * @param triggeredAction The Action which occurred */ typedef void (*TOUCH_CALLBACK)(void* touchArea, TOUCH_ACTION triggeredAction); @@ -66,13 +67,16 @@ typedef struct { } POINT_STRUCT; /** - * Initializes the Touch Controller. Call this method before using any touch_* functions + * Initializes the Touch Controller. + * Call this method before using any touch_* functions * @return true on success */ bool touch_init(); /** - * Processes a native touch event. You may call this function from an (SPI)-Interrupt + * Processes a native touch event. + * Call this function when the pen goes down (\ref TOUCH_DOWN), when it moves (\ref TOUCH_DOWN) and also when it goes up again (\ref TOUCH_UP)! + * It's safe to call this function from an (SPI)-Interrupt. * @param x The x-Coordinate of the touch event * @param y The y-Coordinate of the touch event * @param state Whether the pen is up or down @@ -81,7 +85,7 @@ bool touch_init(); bool touch_add_raw_event(uint16_t x, uint16_t y,TOUCH_STATE state); /** - * Checks whether or not we have memory to manage and track additional "num" TOUCH_AREAs + * Checks whether or not we have memory to manage and track additional \p num TOUCH_AREA_STRUCT%s * @param num The number of touch areas you would like to allocate * @return True if there's enough memory to allocate num TOUCH_AREAs */ @@ -89,14 +93,14 @@ bool touch_have_empty(unsigned char num); /** * Registers a new touch Area. You will receive events for this area from now on. - * @param area A pointer to the configured TOUCH_AREA struct - * @return True if everything was successful and the TOUCH_AREA will be monitored from now on + * @param area A pointer to the configured TOUCH_AREA_STRUCT + * @return True if everything was successful and the corresponding Touch Area will be monitored from now on */ bool touch_register_area(TOUCH_AREA_STRUCT* area); /** * Unregisters a touch area. You will no longer receive events for this area - * @param area A pointer to the TOUCH_AREA instance + * @param area A pointer to the TOUCH_AREA_STRUCT instance */ void touch_unregister_area(TOUCH_AREA_STRUCT* area);