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 Raspberry Pi Pico SDK 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 Pico SDK that may omit some of these components.
#pragma once
#include <stdio.h>
#include "pico/stdlib.h"
#include "hardware/gpio.h"
#include "sygac-runtime.hpp"
#include "sygbr-cli.hpp"
namespace sygaldry { namespace sygbr {
template<typename InnerInstrument>
struct PicoSDKInstrument
{
struct Instrument {
struct Components {
InnerInstrument instrument;
};
Components components;
PicoCli<Components> cli;
};
static inline Instrument instrument{};
void main()
{
constexpr auto runtime = Runtime{instrument};
const uint LED_PIN = 25;
stdio_init_all();
sleep_ms(1000);
puts("initializing\n");
runtime.init();
gpio_init(LED_PIN);
gpio_set_dir(LED_PIN, GPIO_OUT);
puts("looping\n");
while (true)
{
runtime.tick();
gpio_put(LED_PIN, 0);
sleep_ms(250);
gpio_put(LED_PIN, 1);
sleep_ms(250);
}
}
};
} }
# @#'CMakeLists.txt'
set(lib sygbr-runtime)
add_library(${lib} INTERFACE)
target_include_directories(${lib} INTERFACE .)
target_link_libraries(${lib}
INTERFACE sygac-runtime
INTERFACE pico_stdlib
#INTERFACE sygsr-two_wire
#INTERFACE sygbr-flash
#INTERFACE sygbr-wifi
#INTERFACE sygbp-liblo
#INTERFACE sygbp-cli
)
#target_compile_definitions(${lib} INTERFACE
# PICO_STDIO_DEFAULT_CRLF=0
# )
# @/