-
-
Notifications
You must be signed in to change notification settings - Fork 955
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
29 changed files
with
445 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#pragma once | ||
namespace Pinetime { | ||
namespace Applications { | ||
class DisplayApp; | ||
} | ||
namespace Components { | ||
class LittleVgl; | ||
} | ||
namespace Controllers { | ||
class Battery; | ||
class Ble; | ||
class DateTime; | ||
class NotificationManager; | ||
class HeartRateController; | ||
class Settings; | ||
class MotorController; | ||
class MotionController; | ||
class AlarmController; | ||
class BrightnessController; | ||
class WeatherService; | ||
class FS; | ||
class Timer; | ||
class MusicService; | ||
class NavigationService; | ||
} | ||
namespace System { | ||
class SystemTask; | ||
} | ||
namespace Applications { | ||
struct AppControllers { | ||
const Pinetime::Controllers::Battery& batteryController; | ||
const Pinetime::Controllers::Ble& bleController; | ||
Pinetime::Controllers::DateTime& dateTimeController; | ||
Pinetime::Controllers::NotificationManager& notificationManager; | ||
Pinetime::Controllers::HeartRateController& heartRateController; | ||
Pinetime::Controllers::Settings& settingsController; | ||
Pinetime::Controllers::MotorController& motorController; | ||
Pinetime::Controllers::MotionController& motionController; | ||
Pinetime::Controllers::AlarmController& alarmController; | ||
Pinetime::Controllers::BrightnessController& brightnessController; | ||
Pinetime::Controllers::WeatherService* weatherController; | ||
Pinetime::Controllers::FS& filesystem; | ||
Pinetime::Controllers::Timer& timer; | ||
Pinetime::System::SystemTask* systemTask; | ||
Pinetime::Applications::DisplayApp* displayApp; | ||
Pinetime::Components::LittleVgl& lvgl; | ||
Pinetime::Controllers::MusicService* musicService; | ||
Pinetime::Controllers::NavigationService* navigationService; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#pragma once | ||
#include "Apps.h" | ||
#include "Controllers.h" | ||
|
||
#include "displayapp/screens/Alarm.h" | ||
#include "displayapp/screens/Timer.h" | ||
#include "displayapp/screens/Twos.h" | ||
#include "displayapp/screens/Tile.h" | ||
#include "displayapp/screens/ApplicationList.h" | ||
#include "displayapp/screens/Clock.h" | ||
|
||
namespace Pinetime { | ||
namespace Applications { | ||
namespace Screens { | ||
class Screen; | ||
} | ||
|
||
struct AppDescription { | ||
Apps app; | ||
const char* icon; | ||
Screens::Screen* (*create)(AppControllers& controllers); | ||
}; | ||
|
||
template <Apps t> | ||
consteval AppDescription CreateAppDescription() { | ||
return {AppTraits<t>::app, AppTraits<t>::icon, &AppTraits<t>::Create}; | ||
} | ||
|
||
template <template<Apps...> typename T, Apps ...ts> | ||
consteval std::array<AppDescription, sizeof...(ts)> CreateAppDescriptions(T<ts...>) { | ||
return {CreateAppDescription<ts>()...}; | ||
} | ||
|
||
constexpr auto userApps = CreateAppDescriptions(UserAppTypes {}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.