From f5ac29968ed2d2362c6d84468d2069c86153b784 Mon Sep 17 00:00:00 2001 From: lathoub Date: Tue, 23 Oct 2018 22:04:00 +0200 Subject: [PATCH] proof of concept --- .../Esp32_NoteOnOffEverySec.ino | 25 ++++++++++ keywords.txt | 49 +++++++++++++++++++ library.properties | 10 ++++ src/BleMidi.cpp | 1 + src/BleMidi.h | 27 ++++++++++ src/BleMidi.hpp | 16 ++++++ src/utility/BleMidi_Defs.h | 27 ++++++++++ src/utility/BleMidi_Namespace.h | 11 +++++ src/utility/BleMidi_Settings.h | 29 +++++++++++ 9 files changed, 195 insertions(+) create mode 100644 examples/Esp32_NoteOnOffEverySec/Esp32_NoteOnOffEverySec.ino create mode 100644 keywords.txt create mode 100644 library.properties create mode 100644 src/BleMidi.cpp create mode 100644 src/BleMidi.h create mode 100644 src/BleMidi.hpp create mode 100644 src/utility/BleMidi_Defs.h create mode 100644 src/utility/BleMidi_Namespace.h create mode 100644 src/utility/BleMidi_Settings.h diff --git a/examples/Esp32_NoteOnOffEverySec/Esp32_NoteOnOffEverySec.ino b/examples/Esp32_NoteOnOffEverySec/Esp32_NoteOnOffEverySec.ino new file mode 100644 index 0000000..7192f76 --- /dev/null +++ b/examples/Esp32_NoteOnOffEverySec/Esp32_NoteOnOffEverySec.ino @@ -0,0 +1,25 @@ +#include "BleMidi.h" + +BLEMIDI_CREATE_INSTANCE(BLEMIDI); + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +void setup() +{ + // Serial communications and wait for port to open: + Serial.begin(115200); + while (!Serial) { + ; // wait for serial port to connect. Needed for Leonardo only + } + + Serial.print(F("Getting IP address...")); +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +void loop() +{ + +} diff --git a/keywords.txt b/keywords.txt new file mode 100644 index 0000000..3aaab47 --- /dev/null +++ b/keywords.txt @@ -0,0 +1,49 @@ +####################################### +# Syntax Coloring Map for AppleMIDI +####################################### + +####################################### +# Datatypes (KEYWORD1) +####################################### +BLEMIDI KEYWORD1 +BLEMIDI.h KEYWORD1 + +####################################### +# Methods and Functions (KEYWORD2) +####################################### + +run KEYWORD2 +noteOn KEYWORD2 +noteOff KEYWORD2 +afterTouchPoly KEYWORD2 +controlChange KEYWORD2 +programChange KEYWORD2 +afterTouchChannel KEYWORD2 +pitchBend KEYWORD2 +systemExclusive KEYWORD2 +timeCodeQuarterFrame KEYWORD2 +songPosition KEYWORD2 +songSelect KEYWORD2 +tuneRequest KEYWORD2 +clock KEYWORD2 +start KEYWORD2 +Continue KEYWORD2 +stop KEYWORD2 +activeSensing KEYWORD2 +systemReset KEYWORD2 +timeCodeQuarterFrame KEYWORD2 +sysEx KEYWORD2 +afterTouch KEYWORD2 +polyPressure KEYWORD2 +tick KEYWORD2 + +####################################### +# Instances (KEYWORD3) +####################################### + +####################################### +# Constants (LITERAL1) +####################################### + +# Namespace, considering it as a literal +blemidi LITERAL1 diff --git a/library.properties b/library.properties new file mode 100644 index 0000000..914a661 --- /dev/null +++ b/library.properties @@ -0,0 +1,10 @@ +name=BLE-MIDI +version=0.0.1 +author=lathoub +maintainer=lathoub +sentence=MIDI over Bluetooth Low Energy (BLE-MIDI) 1.0 for Arduino +paragraph=MIDI over Bluetooth Low Energy +category=Communication +url=https://github.com/lathoub/Arduino-BLE-MIDI +architectures=* +includes=BLEMIDI.h diff --git a/src/BleMidi.cpp b/src/BleMidi.cpp new file mode 100644 index 0000000..0026d24 --- /dev/null +++ b/src/BleMidi.cpp @@ -0,0 +1 @@ +#include "BleMidi.h" diff --git a/src/BleMidi.h b/src/BleMidi.h new file mode 100644 index 0000000..aa8bfd9 --- /dev/null +++ b/src/BleMidi.h @@ -0,0 +1,27 @@ +/*! + * @file BleMidi.h + */ + +#pragma once + +#include "utility/BleMidi_Defs.h" + +BEGIN_BLEMIDI_NAMESPACE + +/*! \brief The main class for AppleMidiInterface handling.\n + See member descriptions to know how to use it, + or check out the examples supplied with the library. + */ +class BleMidiInterface +{ +public: + // Constructor and Destructor + inline BleMidiInterface(); + inline ~BleMidiInterface(); +}; + +END_BLEMIDI_NAMESPACE + +// ----------------------------------------------------------------------------- + +#include "BleMidi.hpp" diff --git a/src/BleMidi.hpp b/src/BleMidi.hpp new file mode 100644 index 0000000..9327dcb --- /dev/null +++ b/src/BleMidi.hpp @@ -0,0 +1,16 @@ +BEGIN_BLEMIDI_NAMESPACE + +/*! \brief Default constructor for MIDI_Class. */ +inline BleMidiInterface::BleMidiInterface() +{ +} + +/*! \brief Default destructor for MIDI_Class. + + This is not really useful for the Arduino, as it is never called... + */ +inline BleMidiInterface::~BleMidiInterface() +{ +} + +END_BLEMIDI_NAMESPACE diff --git a/src/utility/BleMidi_Defs.h b/src/utility/BleMidi_Defs.h new file mode 100644 index 0000000..5433b5c --- /dev/null +++ b/src/utility/BleMidi_Defs.h @@ -0,0 +1,27 @@ +#pragma once + +#include "BleMidi_Namespace.h" + +#if ARDUINO + #include +#else + #include + typedef uint8_t byte; +#endif + +BEGIN_BLEMIDI_NAMESPACE + +// ----------------------------------------------------------------------------- + +/*! \brief Create an instance of the library + */ +#define BLEMIDI_CREATE_INSTANCE(Name) \ + BLEMIDI_NAMESPACE::BleMidiInterface Name; + + +/*! \brief Create an instance of the library with EnternetUDP. +*/ +#define BLEMIDI_CREATE_DEFAULT_INSTANCE() \ + BLEMIDI_CREATE_INSTANCE(BleMIDI); + +END_BLEMIDI_NAMESPACE diff --git a/src/utility/BleMidi_Namespace.h b/src/utility/BleMidi_Namespace.h new file mode 100644 index 0000000..c632a32 --- /dev/null +++ b/src/utility/BleMidi_Namespace.h @@ -0,0 +1,11 @@ +#pragma once + +#define BLEMIDI_NAMESPACE bleMidi +#define BEGIN_BLEMIDI_NAMESPACE namespace BLEMIDI_NAMESPACE { +#define END_BLEMIDI_NAMESPACE } + +#define USING_NAMESPACE_BLEMIDI using namespace BLEMIDI_NAMESPACE; + +BEGIN_BLEMIDI_NAMESPACE + +END_BLEMIDI_NAMESPACE diff --git a/src/utility/BleMidi_Settings.h b/src/utility/BleMidi_Settings.h new file mode 100644 index 0000000..c9aed70 --- /dev/null +++ b/src/utility/BleMidi_Settings.h @@ -0,0 +1,29 @@ +#pragma once + +#include "utility/BleMidi_Namespace.h" + +//#define DEBUG +#define RELEASE + +#if defined(RELEASE) +#define RELEASE_BUILD +#undef DEBUG_BUILD +#endif + +#if defined(DEBUG) +#define DEBUG_BUILD +#undef RELEASE_BUILD +#endif + + +#if defined(RELEASE_BUILD) +#undef BLEMIDI_DEBUG +#undef BLEMIDI_DEBUG_VERBOSE +#endif + +#if defined(DEBUG_BUILD) +#define BLEMIDI_DEBUG 1 +#undef BLEMIDI_DEBUG_VERBOSE +#define BLEMIDI_DEBUG_PARSING +#endif +