Sygaldry
|
Copyright 2023 Travis J. West, https://traviswest.ca, 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: LGPL-2.1-or-later
This document describes a collection of crude but effective hacks used to trick certain third party libraries into compiling despite the absence of a full blown Arduino environment on which they were originally intended to depend. Currently this is only used to enable use of the Trill-Arduino
library, and as such there are large portions of the full Arduino API missing.
The Arduino ecosystem consists of boards made by a variety of manufacturers, using a variety of microcontroller hardware, and API-compatible libraries for said boards. Despite that the APIs are meant to be hardware independent, and could in principle be developed as such (e.g. using the same header files), most of "the Arduino Library" so to speak is duplicated for each independent microcontroller platform.
This Arduino hack subsystem provides such hardware independent headers. Platform-dependent implementations of these supported Arduino APIs are then found in the related platform-specific subdirectories. For platforms based on Arduino and using a compatible compiler, the upstream Arduino implementation should be preferred, although it remains as future work to integrate the Sygaldry component library with the Arduino IDE build system.
The Arduino hack is intended for platforms (such as ESP32, and Raspberry Pi Pico) where first party Arduino API support is not available, or lacks a recent enough compiler to be used with Sygaldry, to establish the bare minimum Arduino compatible API required to make use of pre-existing driver libraries for various sensors, such as Bela's Trill sensors.
This Arduino header is included by Trill-Arduino
when the ARDUINO
preprocessor symbol is undefined. A cursory and incomplete investigation suggests that Arduino.h
and WProgram.h
provide identical APIs, with the latter being a legacy include path.
A full Arduino.h
implementation would include a number of macros and functions that are not currently supported by this hack. micros
and delay
are currently the only APIs that are expected to work.
The TwoWire
API provides access to the I2C bus.
The SPIClass
API provides access to the SPI bus. This API is not yet implemented for any platform and should not be used.
This document provides platform-independent header files exposed as a CMake interface library. Each platform that uses the hack should provides its own implementation of these APIs that makes use of these headers.