Copyright 2023 Travis J. West, Input Devices and Music Interaction Laboratory (IDMIL), Centre for Interdisciplinary Research in Music Media and Technology (CIRMMT), McGill University, Montréal, Canada, and Univ. Lille, Inria, CNRS, Centrale Lille, UMR 9189 CRIStAL, F-59000 Lille, France
SPDX-License-Identifier: MIT
This binding provides a specialization of sygaldry::Runtime for the ESP32 platform that draws in all available bindings and basic resources that are expected to be used by all instruments. This can also be read as a template for a custom runtime for the ESP32 that may omit some of these components.
#pragma once
#include <stdio.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include "sygac-runtime.hpp"
#include "sygsa-two_wire.hpp"
#include "syghe-pins.hpp"
#include "sygbe-spiffs.hpp"
#include "sygbe-wifi.hpp"
#include "sygbp-liblo.hpp"
#include "sygbp-cstdio_cli.hpp"
namespace sygaldry { namespace sygbe {
template<typename InnerInstrument>
struct ESP32Instrument
{
struct Instrument {
struct Components {
sygsa::TwoWire<syghe::I2C_MAIN_SDA,syghe::I2C_MAIN_SCL,400000> i2c;
InnerInstrument instrument;
sygbe::WiFi wifi;
sygbp::LibloOsc<InnerInstrument> osc;
};
sygbe::SpiffsSessionStorage<Components> session_storage;
Components components;
#if defined SYGALDRY_ESP32S3
#endif
sygbp::CstdioCli<Components> cli;
};
static_assert(Assembly<Instrument>);
static inline Instrument instrument{};
void app_main()
{
constexpr auto runtime = Runtime{instrument};
vTaskDelay(pdMS_TO_TICKS(1000));
printf("initializing\n");
runtime.init();
vTaskDelay(pdMS_TO_TICKS(100));
printf("looping\n");
while (true)
{
runtime.tick();
vTaskDelay(pdMS_TO_TICKS(10));
}
}
};
} }
# @#'CMakeLists.txt'
set(lib sygbe-runtime)
add_library(${lib} INTERFACE)
target_include_directories(${lib} INTERFACE .)
target_link_libraries(${lib}
INTERFACE sygac-runtime
INTERFACE sygsa-two_wire
INTERFACE sygbe-spiffs
INTERFACE sygbe-wifi
INTERFACE sygbp-liblo
INTERFACE sygbp-cli
)
# @/