From 63e0c4f4efb047f4f15601f7b08640c4b589de93 Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Mon, 23 Oct 2023 20:12:34 +0200 Subject: Application selection at build time A list of "user applications" is built at compile time. It contains all the info needed to create the application at runtime (ptr to a create() function) and to display the app in the application menu. All applications declare a TypeTrait with these information. When a new app must be loaded, DisplayApp first check if this app is a System app (in which case it creates it like it did before). If it's not a System app, it looks for the app in the list of User applications and creates it if it found it. Those changes allow to more easily add new app and to select which app must be built into the firmware. Switch to C++20 (and fix a few issues in SpiMaster.cpp and Watchdog.cpp. --- src/displayapp/Apps.h | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'src/displayapp/Apps.h') diff --git a/src/displayapp/Apps.h b/src/displayapp/Apps.h index f253bc03..d96e6ea7 100644 --- a/src/displayapp/Apps.h +++ b/src/displayapp/Apps.h @@ -1,5 +1,5 @@ #pragma once - +#include namespace Pinetime { namespace Applications { enum class Apps { @@ -37,7 +37,32 @@ namespace Pinetime { SettingChimes, SettingShakeThreshold, SettingBluetooth, - Error + Error, + Weather + }; + template + struct AppTraits {}; + + template + struct TypeList { + static constexpr size_t Count = sizeof...(As); }; + + using UserAppTypes = TypeList; } } -- cgit v1.2.3-70-g09d2