Added doxygen stuff for button module and some minor changes to touch, screen_main and tft module.

This commit is contained in:
t-moe
2015-05-12 11:07:15 +02:00
parent 0097be0225
commit 1402598b59
4 changed files with 64 additions and 30 deletions

View File

@@ -7,7 +7,7 @@
/** /**
* @defgroup screens Screens * @defgroup screens Screens
* The Screens of the application. \sa Screen * The Screens of the application. \sa \ref screen
*/ */
/*@}*/ /*@}*/

View File

@@ -17,17 +17,54 @@
#include "touch.h" #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 { typedef struct {
TOUCH_AREA_STRUCT base; 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; uint16_t bgcolor; //!< The 16-bit background color of the button
BUTTON_CALLBACK callback; //Callback BUTTON_CALLBACK callback; //!< Callback
uint16_t txtcolor; uint16_t txtcolor; //!< The 16-bit text color
uint8_t font; uint8_t font; //!< The number of the font to use
const char *text; const char *text; //!< The label of the button
} BUTTON_STRUCT; } 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 { typedef struct {
TOUCH_AREA_STRUCT base; 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). //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);
*/
/*@}@}*/ /*@}@}*/

View File

@@ -41,7 +41,8 @@
#define TRANSPARENT ((uint16_t)0x80C2) #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 * @return true on success
*/ */
bool tft_init(); 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); 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 x1 The x-Coordinate of the start-point
* @param y1 The y-Coordinate of the start-point * @param y1 The y-Coordinate of the start-point
* @param x2 The x-Coordinate of the end-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); 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 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 y The y-coordinate of the top-left corner to draw the bitmap at
* @param width The width of the bitmap in pixels * @param width The width of the bitmap in pixels

View File

@@ -25,7 +25,8 @@ typedef enum {
} TOUCH_STATE ; } 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 { typedef enum {
NONE=0x00, //!< Do not receive any events NONE=0x00, //!< Do not receive any events
@@ -38,7 +39,7 @@ typedef enum {
/** /**
* Prototype for Event Listeners (called for every occurring, hooked action) * 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 * @param triggeredAction The Action which occurred
*/ */
typedef void (*TOUCH_CALLBACK)(void* touchArea, TOUCH_ACTION triggeredAction); typedef void (*TOUCH_CALLBACK)(void* touchArea, TOUCH_ACTION triggeredAction);
@@ -66,13 +67,16 @@ typedef struct {
} POINT_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 * @return true on success
*/ */
bool touch_init(); 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 x The x-Coordinate of the touch event
* @param y The y-Coordinate of the touch event * @param y The y-Coordinate of the touch event
* @param state Whether the pen is up or down * @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); 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 * @param num The number of touch areas you would like to allocate
* @return True if there's enough memory to allocate num TOUCH_AREAs * @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. * 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 * @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 * @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); bool touch_register_area(TOUCH_AREA_STRUCT* area);
/** /**
* Unregisters a touch area. You will no longer receive events for this 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); void touch_unregister_area(TOUCH_AREA_STRUCT* area);