16#include "ksApplication.h"
22#define KSF_IMPLEMENT_APP_ROTATOR(...) \
23 ksf::ksAppRotator<__VA_ARGS__> appRotator; \
24 void setup() { KSF_FRAMEWORK_INIT() } \
25 void loop() { appRotator.loop(1); }
32#define KSF_IMPLEMENT_APP_ROTATOR_INTERVAL(delayBetweenLoops, ...) \
33 ksf::ksAppRotator<__VA_ARGS__> appRotator; \
34 void setup() { KSF_FRAMEWORK_INIT() } \
35 void loop() { appRotator.loop(delayBetweenLoops); }
43 template <
class... AppTypes>
48 std::unique_ptr<ksApplication> currentApplication{
nullptr};
49 typedef std::unique_ptr<ksApplication> (*TSpawnerFunc)();
56 template <
class TApplicationType>
57 static std::unique_ptr<ksApplication> spawnApp()
59 return std::make_unique<TApplicationType>();
62 static constexpr std::array<TSpawnerFunc,
sizeof...(AppTypes)> appSpawners{spawnApp<AppTypes>...};
71 if (currentApplication && currentApplication->loop())
75 currentApplication = appSpawners[appIndex]();
78 if (!currentApplication->init())
79 currentApplication.reset(
nullptr);
82 if (++appIndex >= appSpawners.size())
90 void loop(
unsigned long milliseconds)
Application rotator component.
Definition ksAppRotator.h:45
void loopNoDelay()
Runs the application loop.
Definition ksAppRotator.h:68
void loop(unsigned long milliseconds)
Runs application loop with a delay between loops.
Definition ksAppRotator.h:90