diff options
author | ConfuSomu | 2021-09-12 16:19:20 -0400 |
---|---|---|
committer | ConfuSomu | 2021-09-12 16:19:20 -0400 |
commit | 18c72e008e3ac49a509b1d636e63bdd2ca99fa4d (patch) | |
tree | bd151511b7c856dda6136b288bfe0aaf1a959a3c | |
parent | a687b2a05730d1ff7075695eae5437badc7bf8ad (diff) | |
download | pico-watch-18c72e008e3ac49a509b1d636e63bdd2ca99fa4d.tar pico-watch-18c72e008e3ac49a509b1d636e63bdd2ca99fa4d.tar.gz pico-watch-18c72e008e3ac49a509b1d636e63bdd2ca99fa4d.zip |
Add app_tests
This app will be used for testing new api features that will be
implemented shortly.
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | app/app_manager.cpp | 4 | ||||
-rw-r--r-- | apps/home_menu/main.hpp | 4 | ||||
-rw-r--r-- | apps/tests/main.cpp | 24 | ||||
-rw-r--r-- | apps/tests/main.hpp | 19 |
5 files changed, 49 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0efeb1f..16cbf6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,7 @@ add_executable(pico-watch apps/main_clock/main.hpp apps/settings/main.cpp apps/settings/main.hpp + apps/tests/main.cpp ) pico_set_program_name(pico-watch "pico-watch") diff --git a/app/app_manager.cpp b/app/app_manager.cpp index 07e68fa..f342814 100644 --- a/app/app_manager.cpp +++ b/app/app_manager.cpp @@ -8,7 +8,8 @@ #include "../apps/main_clock/main.hpp" #include "../apps/home_menu/main.hpp" #include "../apps/settings/main.hpp" -#define NUMBER_OF_APPS 3 +#include "../apps/tests/main.hpp" +#define NUMBER_OF_APPS 4 // From pico-watch.c: extern Api app_api; @@ -53,6 +54,7 @@ BaseApp* app_mgr::app_create(int app_id) { case 0: new_app = new app_home_menu(&app_api); break; case 1: new_app = new app_main_clock(&app_api); break; case 2: new_app = new app_settings(&app_api); break; + case 3: new_app = new app_tests(&app_api); break; default: __breakpoint(); return open_apps.front(); // Should be home_menu } diff --git a/apps/home_menu/main.hpp b/apps/home_menu/main.hpp index 242d2a3..c3a14e6 100644 --- a/apps/home_menu/main.hpp +++ b/apps/home_menu/main.hpp @@ -5,12 +5,12 @@ // Includes also buttons, API and ss_oled #include "../../app/base_app.hpp" -#define NUMBER_OF_APPS 3 +#define NUMBER_OF_APPS 4 #define SIZE_APP_NAME 12 class app_home_menu : public BaseApp { private: - const char *APPS_NAME[NUMBER_OF_APPS] = {"Home", "Clock", "Settings"}; + const char *APPS_NAME[NUMBER_OF_APPS] = {"Home", "Clock", "Settings", "Tests"}; int selected_app = 0; char display_app_name[SIZE_APP_NAME]; diff --git a/apps/tests/main.cpp b/apps/tests/main.cpp new file mode 100644 index 0000000..e11f1dc --- /dev/null +++ b/apps/tests/main.cpp @@ -0,0 +1,24 @@ +#include <stdio.h> +#include "pico/stdlib.h" + +#include "main.hpp" + +BaseApp::AppReturnValues app_tests::render(Api *app_api) { + app_api->gui_header_text("App for testing APIs."); + return AppReturnValues::OK; +} + +BaseApp::AppReturnValues app_tests::btn_pressed(Api *app_api, uint gpio, unsigned long delta) { + return AppReturnValues::OK; +} + +app_tests::app_tests(Api *app_api) { + app_api->performance_set(Api::perf_modes::LOW_POWER); +} + +BaseApp::AppReturnValues app_tests::bgrefresh(Api *app_api, bool in_foreground) { + return AppReturnValues::OK; +} + +app_tests::~app_tests() { +} diff --git a/apps/tests/main.hpp b/apps/tests/main.hpp new file mode 100644 index 0000000..471c172 --- /dev/null +++ b/apps/tests/main.hpp @@ -0,0 +1,19 @@ +#pragma once + +// Includes also buttons, API and ss_oled +#include "../../app/base_app.hpp" + +class app_tests : public BaseApp { + private: + AppAttributes app_attributes = {3, true}; + public: + const AppAttributes& app_get_attributes() { + return app_attributes; + } + + app_tests(Api *app_api); + AppReturnValues render(Api *app_api); + AppReturnValues btn_pressed(Api *app_api, uint gpio, unsigned long delta); + AppReturnValues bgrefresh(Api *app_api, bool in_foreground); + ~app_tests(); +}; |