#include #include #include "spore/Spore.h" #include "spore/util/Logging.h" #include "../pixelstream/PixelStreamController.h" #include "MultiMatrixService.h" namespace { constexpr uint8_t MATRIX_PIN = D2; constexpr uint16_t MATRIX_PIXEL_COUNT = 256; constexpr uint8_t MATRIX_BRIGHTNESS = 40; constexpr uint16_t MATRIX_WIDTH = 16; constexpr bool MATRIX_SERPENTINE = false; constexpr neoPixelType MATRIX_PIXEL_TYPE = NEO_GRB + NEO_KHZ800; constexpr uint8_t MP3PLAYER_PIN_RX = D3; constexpr uint8_t MP3PLAYER_PIN_TX = D4; constexpr uint8_t POTENTIOMETER_PIN = A0; } Spore spore({ {"app", "multimatrix"}, {"role", "media"}, {"matrix", String(MATRIX_PIXEL_COUNT)} }); std::unique_ptr pixelController; std::shared_ptr audioService; void setup() { spore.setup(); PixelStreamConfig config{ MATRIX_PIN, MATRIX_PIXEL_COUNT, MATRIX_BRIGHTNESS, MATRIX_WIDTH, MATRIX_SERPENTINE, MATRIX_PIXEL_TYPE }; pixelController = std::make_unique(spore.getContext(), config); pixelController->begin(); audioService = std::make_shared(spore.getContext(), spore.getTaskManager(), MP3PLAYER_PIN_RX, MP3PLAYER_PIN_TX, POTENTIOMETER_PIN); spore.addService(audioService); spore.begin(); LOG_INFO("MultiMatrix", "Setup complete"); } void loop() { spore.loop(); }