fusion-zauberstab/firmware/src/main.cpp

58 lines
1.0 KiB
C++
Raw Normal View History

#include "app.h"
#include "driver/adc.h"
#include "zauberstab.h"
#include <vector>
struct BeatDetectApp beat_detect_app
{
};
struct VuMeterApp vu_meter_app
{
};
struct FFTTestApp fft_test_app
{
};
struct FackelApp fackel_app
{
};
2022-06-20 20:27:03 +02:00
struct FftDetectApp fft_detect_app
{
};
std::vector<std::reference_wrapper<App>> apps = {
std::ref<App>(beat_detect_app),
std::ref<App>(vu_meter_app),
std::ref<App>(fft_test_app),
2022-06-20 20:27:03 +02:00
std::ref<App>(fackel_app),
std::ref<App>(fft_detect_app)};
2022-06-20 20:27:03 +02:00
unsigned int current_app = 4;
unsigned int next_app;
void setup()
{
next_app = current_app;
zauberstab_init();
Serial.begin(115200);
apps[current_app].get().init();
}
void loop()
{
/* EVERY_N_SECONDS(30)
{
next_app++;
next_app = next_app % apps.size();
} */
if (next_app != current_app)
{
apps[current_app].get().deinit();
apps[next_app].get().init();
current_app = next_app;
fadeToBlackBy(leds, NUM_LEDS, 0xFF);
}
apps[current_app].get().loop();
}