diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.gitignore diff --git a/MenuItem.cpp b/MenuItem.cpp deleted file mode 100644 index 7a06a5d..0000000 --- a/MenuItem.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include "MenuItem.h" -#include "Arduino.h" - -MenuItem::MenuItem() { - -} - -MenuItem::MenuItem(const char* name) { - MenuItem::name = name; - MenuItem::parent = NULL; - MenuItem::next = NULL; -} - -MenuItem* MenuItem::goBack() { - return MenuItem::parent; -} - -MenuItem* MenuItem::goDown() { - return MenuItem::next; -} - -MenuItem* MenuItem::goRight() { - return NULL; -} - -String MenuItem::display() { - return MenuItem::name; -} - - -BranchMenuItem::BranchMenuItem(const char* name, const MenuItem* child) { - BranchMenuItem::name = name; - BranchMenuItem::child = child; -} - -MenuItem* BranchMenuItem::goRight() { - return BranchMenuItem::child; -} - -String BranchMenuItem::display() { - return String(BranchMenuItem::name) + " ->"; -} - -IntValueItem::IntValueItem(char const* name, int initial) { - IntValueItem::name = name; - IntValueItem::value = initial; -} - -MenuItem* IntValueItem::goRight() { // increment - IntValueItem::value++; -} - -String IntValueItem::display() { - return String(IntValueItem::name) + ": " + String(IntValueItem::value); -} - -BoolValueItem::BoolValueItem(char const* name, bool initial) { - BoolValueItem::name = name; - BoolValueItem::value = initial; -} - -MenuItem* BoolValueItem::goRight() { // toggle - BoolValueItem::value = !BoolValueItem::value; - return NULL; -} - -String BoolValueItem::display() { - return String(BoolValueItem::name) + ": " + (BoolValueItem::value ? "true" : "false"); -} \ No newline at end of file diff --git a/MenuItem.h b/MenuItem.h deleted file mode 100644 index 11dc8b1..0000000 --- a/MenuItem.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef MenuItem_h -#define MenuItem_h - -#include "Arduino.h" - -class MenuItem { - public: - MenuItem(); - MenuItem(const char* name); - const char* name; - MenuItem* parent; - MenuItem* next; - MenuItem* goBack(); - MenuItem* goDown(); - MenuItem* goRight(); - String display(); -// void addChild(MenuItem* c) { -// if (!child) child = c; -// c->parent = this; -// } -}; - -class BranchMenuItem: public MenuItem { - public: - using MenuItem::MenuItem; - BranchMenuItem(const char* name, const MenuItem* child); - MenuItem* child; - MenuItem* goRight(); - String display(); -}; - -class IntValueItem: public MenuItem { - public: - IntValueItem(const char* name, const int initialValue); - int value; - MenuItem* IntValueItem::goRight(); - String IntValueItem::display(); -}; - -class BoolValueItem: public MenuItem { - public: - BoolValueItem(const char* name, const bool initialValue); - bool value; - MenuItem* BoolValueItem::goRight(); - String BoolValueItem::display(); -}; - -#endif \ No newline at end of file