Finish documention until someone change something

This commit is contained in:
2022-02-15 20:12:50 +01:00
parent 3a2e51713b
commit c8e3344b27
50 changed files with 991 additions and 223 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* @file menu.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Implementation of the class Menu
* @version 0.1
* @date 2022-01-12
*
+20 -10
View File
@@ -1,7 +1,7 @@
/**
* @file menu.h
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains the Menu class
* @version 0.1
* @date 2022-01-12
*
@@ -17,20 +17,30 @@
#include "menuControl.h"
class MenuAction;
/**
* @brief A class to build menu structers
*/
class Menu : public MenuControl {
public:
Menu();
/**
* @brief Add a menu action to the menu
*
* @param entry
*/
void addEntry(MenuAction* entry);
void printMenu();
void update();
void down();
void up();
void right();
void left();
void yes();
void no();
void printMenu() override;
void update() override;
void down() override;
void up() override;
void right() override;
void left() override;
void yes() override;
void no() override;
private:
bool inSubmenu = false;
@@ -40,4 +50,4 @@ class Menu : public MenuControl {
};
#endif // MENU_H
#endif // MENU_H
+3 -17
View File
@@ -1,7 +1,7 @@
/**
* @file menuEntry.cpp
* @file menuAction.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Implentation of the class MenuAction
* @version 0.1
* @date 2022-01-12
*
@@ -16,20 +16,6 @@ MenuAction::MenuAction(const char* name, void (*function) (), void (*callback) (
this->callback = callback;
}
MenuAction::MenuAction(const char* name, void (*function) ()) {
this->name = name;
this->function = function;
this->callback = nullptr;
}
// MenuAction::MenuAction(const char* name, void (DriveManager:: *classFunction) ()) {
// this->name = name;
// this->classFunction = classFunction;
// this->classFunc = true;
// this->function = nullptr;
// this->callback = nullptr;
// }
MenuAction::MenuAction(const char* name, MenuControl* menu) {
this->name = name;
this->menu = menu;
@@ -60,4 +46,4 @@ MenuControl* MenuAction::getMenu() {
return this->menu;
else
return nullptr;
}
}
+53 -5
View File
@@ -1,7 +1,7 @@
/**
* @file menuEntry.h
* @file menuAction.h
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains the MenuAction class
* @version 0.1
* @date 2022-01-12
*
@@ -14,15 +14,63 @@
#include "menu.h"
class MenuControl;
/**
* @brief This class forms the transition between menus.
*
* In the Menu these are the entries.
* This class can be call an submenu or a function.
*/
class MenuAction {
public:
MenuAction(const char* name, void (*function) (), void (*callback) ());
MenuAction(const char* name, void (*function) ());
/**
* @brief Construct a new Menu Action object
*
* @param name shown in the Menu
* @param function to call when activate the entry
* @param callback to call when leave the entry
*/
MenuAction(const char* name, void (*function) (), void (*callback) () = nullptr);
/**
* @brief Construct a new Menu Action object
*
* This constructer is used for submenus.
*
* @param name shown in the Menu
* @param menu to call when activate the entry
*/
MenuAction(const char* name, MenuControl* menu);
/**
* @brief activates the entry
*/
void runAction();
/**
* @brief Get the Name string
*
* @return const char*
*/
const char* getName();
/**
* @brief Get the Is Menu object
*
* @return true runAction calls a submenu
* @return false runAction call a function
*/
bool getIsMenu();
/**
* @brief Get the Menu object
*
* Before call this function it may be useful
* to check if is it a submenu with getIsMenu.
*
* @return MenuControl*
*/
MenuControl* getMenu();
private:
@@ -35,4 +83,4 @@ class MenuAction {
MenuControl* menu;
};
#endif // MENU_ENTRY_H
#endif // MENU_ENTRY_H
+37 -3
View File
@@ -1,7 +1,7 @@
/**
* @file menuControl.h
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains a abstract class for Menu
* @version 0.1
* @date 2022-01-19
*
@@ -15,25 +15,59 @@
#include <iostream>
#include <LiquidCrystal_I2C.h>
/**
* @brief Baseclass to build Menus
*
* This class must be inherited by other classes which want to be
* act as a menu, because the menu structure uses polymorphism.
*
*/
class MenuControl {
public:
// Ínputs from the Gamepad
/** @name UserInputs
* @brief This functions should be called be user actions.
*
* This functions have to be implement in every other menu
* class.
*/
///@{
virtual void down();
virtual void up();
virtual void right();
virtual void left();
virtual void yes();
virtual void no();
///@}
/**
* @brief can be called to update shown data
*/
virtual void update();
virtual void printMenu();
/**
* @brief Set the Parent Menu
*
* If the parentMenu is set it will be called automaticaly
* when the user left the child menu.
*
* @param menu
*/
void setParentMenu(MenuControl* menu) { this->parentMenu = menu; }
/**
* @brief Set the Lcd object
*
* If this is set the menu will be print on the display too.
*
* @param lcd
*/
void setLcd(LiquidCrystal_I2C* lcd) { this->lcd = lcd; }
protected:
MenuControl* parentMenu = nullptr;
LiquidCrystal_I2C* lcd = nullptr;
};
#endif // MENU_CONTROLL_H
#endif // MENU_CONTROLL_H