Added doxgen comments to filesyste, checkbox, numupdown and screen module. And some minor changes to the other modules.

This commit is contained in:
t-moe
2015-05-15 11:35:12 +02:00
parent e93b3f145c
commit 9a16865b00
20 changed files with 371 additions and 104 deletions

View File

@@ -1,6 +1,8 @@
#ifndef BUTTON_H
#define BUTTON_H
#include "touch.h"
/**
* @defgroup gui Gui
* The Gui Module
@@ -11,14 +13,18 @@
* @defgroup button Button
* The Button Gui-Element
*/
/*@}*/
/**
* @addtogroup button
*/
/*@{*/
#include "touch.h"
/**
* Prototype for Event Listeners (called when the button is pressed)
* \note You should NOT execute long running things in this callback nor should you update the gui. But you can call gui_screen_navigate() for instance.
* @param button The pointer to the BUTTON_STRUCT where to corresponding Button was pressed
*/
typedef void (*BUTTON_CALLBACK)(void *button);
@@ -30,7 +36,7 @@ typedef void (*BUTTON_CALLBACK)(void *button);
typedef struct {
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
BUTTON_CALLBACK callback; //!< Callback which is executed when the button is pressed
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
@@ -79,6 +85,6 @@ typedef struct {
/*@}@}*/
/*@}*/
#endif /* BUTTON_H */

View File

@@ -1,6 +1,8 @@
#ifndef CHECKBOX_H
#define CHECKBOX_H
#include "touch.h"
/**
* @addtogroup gui
*/
@@ -10,24 +12,58 @@
* @defgroup checkbox Checkbox
* The Checkbox Gui-Element
*/
/*@}*/
/**
* @addtogroup checkbox
*/
/*@{*/
/**
* Prototype for Event Listeners (called when the checkbox state has changed)
* \note You should NOT execute long running things in this callback nor should you update the gui. But you can call gui_screen_navigate() for instance.
* @param checkbox The pointer to the CHECKBOX_STRUCT where to corresponding Checkbox has changed the state
* @param checked A boolean which indicates whether the checkbox is now checked or not.
*/
typedef void (*CHECKBOX_CALLBACK)(void *checkbox, bool checked);
typedef void (*CHECKBOX_CALLBACK)(void *checkbox, bool checked); //!< Function pointer used...
/**
* Structure to configure the Checkbox
*/
typedef struct {
TOUCH_AREA_STRUCT base;
uint16_t fgcolor;
bool checked;
CHECKBOX_CALLBACK callback; //Callback
TOUCH_AREA_STRUCT base; //!< Basic geometry of the Checkbox. You only need to set the x1, y1, x2, y2 members of this struct.
uint16_t fgcolor; //!< The 16-bit color of the tickmark
bool checked; //!< A boolean which indicates whether or not the checkbox is currently checked.
CHECKBOX_CALLBACK callback; //!< Callback which is executed when the checkbox changes state
} CHECKBOX_STRUCT;
/**
* Adds a checkbox. Your Callback will be called from now on, if the checkbox changes state
* @param checkbox A Pointer to the preinitialized CHECKBOX_STRUCT
* @return true on success
*/
bool gui_checkbox_add(CHECKBOX_STRUCT* checkbox);
/**
* Removes the checkbox. You will no longer receive events for this checkbox. This function will not overdraw the region where the checkbox was located.
* @param checkbox A Pointer to the CHECKBOX_STRUCT
*/
void gui_checkbox_remove(CHECKBOX_STRUCT* checkbox);
/**
* Updates the checkbox. Call this function when you change the state of the checkbox through code.
* @param checkbox A Pointer to the CHECKBOX_STRUCT
*/
void gui_checkbox_update(CHECKBOX_STRUCT* checkbox);
/**
* Redraws the checkbox. Call this method if you have to redraw the entire screen or if you want to draw a checkbox on top of an image.
* @param checkbox A Pointer to the CHECKBOX_STRUCT
*/
void gui_checkbox_redraw(CHECKBOX_STRUCT* checkbox);
#define CHECKBOX_WIN_FG_COLOR RGB(32,161,34)
/*@}@}*/
/*@}*/
#endif /* CHECKBOX_H */

View File

@@ -101,8 +101,6 @@ void gui_numupdown_remove(NUMUPDOWN_STRUCT* numupdown)
void gui_numupdown_update(NUMUPDOWN_STRUCT* numupdown)
{
uint8_t tw1 = calc_text_width(numupdown->max);
uint8_t tw2 = calc_text_width(numupdown->min);
if(tw2 > tw1) tw1 = tw2;

View File

@@ -1,6 +1,8 @@
#ifndef NUMUPDOWN_H
#define NUMUPDOWN_H
#include "button.h"
/**
* @addtogroup gui
*/
@@ -10,32 +12,62 @@
* @defgroup numupdown NummericUpDown
* The NummericUpDown Gui Element
*/
/*@}*/
/**
* @addtogroup numupdown
*/
/*@{*/
/**
* Prototype for Event Listeners (called when the NummericUpDown value has changed)
* \note You should NOT execute long running things in this callback nor should you update the gui. But you can call gui_screen_navigate() for instance.
* @param numupdown The pointer to the NUMUPDOWN_STRUCT where to corresponding NummericUpDown has changed it's value
* @param value The new value of the NummericUpDown
*/
typedef void (*NUMUPDOWN_CALLBACK)(void *numupdown, int16_t value);
#include "button.h"
typedef void (*NUMUPDOWN_CALLBACK)(void *numupdown, int16_t value); //!< Function pointer used...
/**
* Structure to configure the NummericUpDown
*/
typedef struct {
uint16_t x;
uint16_t y;
uint16_t fgcolor;
int16_t value;
int16_t min;
int16_t max;
NUMUPDOWN_CALLBACK callback; //Callback
uint16_t x; //!< The x-Coordinate of the Top-Left Starting Point.
uint16_t y; //!< The y-Coordinate of the Top-Left Starting Point.
uint16_t fgcolor; //!< The 16-bit color of the value-text
int16_t value; //!< The current/default value
int16_t min; //!< The minimum possible value (inclusive)
int16_t max; //!< The maximum possible value (inclusive)
NUMUPDOWN_CALLBACK callback; //!< Callback which is executed when the value changes
//Internally used:
BUTTON_STRUCT buttonUp;
BUTTON_STRUCT buttonDown;
BUTTON_STRUCT buttonUp; //!< For internal use, don't change, don't initialize
BUTTON_STRUCT buttonDown; //!< For internal use, don't change, don't initialize
} NUMUPDOWN_STRUCT;
/**
* Adds a NummericUpDown. Your Callback will be called from now on, if the numupdown's value changes
* @param numupdown A Pointer to the preinitialized NUMUPDOWN_STRUCT
* @return true on success
*/
bool gui_numupdown_add(NUMUPDOWN_STRUCT* numupdown);
/**
* Removes the NummericUpDown. You will no longer receive events for this numupdown. This function will not overdraw the region where the numupdown was located.
* @param numupdown A Pointer to the NUMUPDOWN_STRUCT
*/
void gui_numupdown_remove(NUMUPDOWN_STRUCT* numupdown);
/**
* Updates the NummericUpDown. Call this function when you change the value/min/max of the numupdown through code.
* @param numupdown A Pointer to the NUMUPDOWN_STRUCT
*/
void gui_numupdown_update(NUMUPDOWN_STRUCT* numupdown);
/**
* Redraws the NummericUpDown. Call this method if you have to redraw the entire screen or if you want to draw a numupdown on top of an image.
* @param numupdown A Pointer to the NUMUPDOWN_STRUCT
*/
void gui_numupdown_redraw(NUMUPDOWN_STRUCT* numupdown);
/*@}@}*/
/*@}*/
#endif /* NUMUPDOWN_H */

View File

@@ -1,6 +1,9 @@
#ifndef SCREEN_H
#define SCREEN_H
#include <stdio.h>
#include <stdbool.h>
/**
* @addtogroup gui
*/
@@ -8,38 +11,64 @@
/**
* @defgroup screen Screen
* The Screen Submodule
* The Screen Submodule provides an api to navigate between different "screens" on the UI.
* The implemented screens of the application are documented in the \ref screens module.
*/
/*@}*/
/**
* @addtogroup screen
*/
/*@{*/
#include <stdio.h>
#include <stdbool.h>
typedef void (*SCREEN_CALLBACK)(void* screen); //!< Function pointer used...
/**
* Prototype for Event Listeners (called when the screen is entered, left or should be updated)
* @param screen The pointer to the SCREEN_STRUCT where the event occurred
*/
typedef void (*SCREEN_CALLBACK)(void* screen);
/**
* Structure to configure the Screen
*/
typedef struct SCREEN_S{
SCREEN_CALLBACK on_enter;
SCREEN_CALLBACK on_leave;
SCREEN_CALLBACK on_update;
struct SCREEN_S* next; //Used internally. do not modify
SCREEN_CALLBACK on_enter; //!< The Callback which is called when the screen is entered. Add/Register all UI-Elements here
SCREEN_CALLBACK on_leave; //!< The Callback which is called when the screen is left. Remove/Unregister all UI-Elements here
SCREEN_CALLBACK on_update; //!< The Callback which is called repeatedly when the screen should be updated. Update/Redraw all UI-Elements here
struct SCREEN_S* next; //!< Used internally. do not modify, do not initialize
} SCREEN_STRUCT;
//Navigate to the given string as soon as the app enters the main loop again. Method can be called from an interrupt
/**
* Navigate to the given screen as soon as the app enters the main loop again (and gui_screen_update() is called)
* It's safe to call this method from an interrupt
* @param screen A Pointer to the preinitialized SCREEN_STRUCT
* @return true on success
*/
bool gui_screen_navigate(SCREEN_STRUCT* screen);
//Navigate one screen back as soon as the app enters the main loop again. Method can be called from an interrupt
/**
* Navigate one screen back as soon as the app enters the main loop again.
* It's safe to call this method from an interrupt
* @return true on success
*/
bool gui_screen_back();
//Returns the current active screen
/**
* Returns the currently active screen
* @return A Pointer to the active SCREEN_STRUCT
*/
SCREEN_STRUCT* gui_screen_get_current();
//Updates/switches the screens. Call this from the app main loop, as fast as you can.
/**
* Updates the current screen. Switches the screen if gui_screen_navigate() or gui_screen_back() have been called since the last call to this method.
* This method should be called repeatedly from the main loop (e.g. app_process())
*/
void gui_screen_update();
/*@}@}*/
/*@}*/
#endif /* SCREEN_H */