Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5.1.0 #304

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a6c3a48
thru filter overhaul
hyperbolist Aug 6, 2021
1fe67be
makes changes requested in #232 discussion
hyperbolist Aug 6, 2021
4469f2a
uses Transport::thruActivated for initial thru state
hyperbolist Aug 6, 2021
c2a838d
chore: Add example
franky47 Aug 31, 2021
f42c344
feat: Export type definitions when using macros
franky47 Sep 2, 2021
350f6d1
reworked active Sensing
May 16, 2020
b82f241
reworked ActiveSensing
May 17, 2020
bb58efe
Update midi_Settings.h
May 17, 2020
0db6859
Create Hairless.ino
May 17, 2020
59fafdb
ActiveSensingTimeout has its own callback handler
May 23, 2020
12f0586
return mReceiverActiveSensingActive in SensingTimeout Handler
lathoub May 23, 2020
21a4ad2
chore: Fix build (things got lost in merge)
franky47 Oct 8, 2022
f6d9511
chore: Add test for system common messages
franky47 Oct 8, 2022
99fe61c
chore: Add Nano variants to CI checks
franky47 Oct 8, 2022
a649f77
feat: Add MIDI analyzer from raw byte dump as CSV
franky47 Feb 15, 2023
b67db7b
chore: Bump dependencies (CMake & gTest)
franky47 Jul 18, 2023
1920a75
chore: Code-fence Nano 33BLE
franky47 Jul 18, 2023
8214157
test: Add ESP32 boards
franky47 Jul 18, 2023
561972c
chore: Require C++14 for gTest update
franky47 Jul 18, 2023
fe731bc
chore: Fix Basic_IO example for ESP32
franky47 Jul 18, 2023
a6b3317
chore: Fix example board detection
franky47 Jul 18, 2023
8afa6ef
chore: Verbose PIO CI
franky47 Jul 18, 2023
b8f2c9a
chore: Disable SoftSerial test on ESP32
franky47 Jul 18, 2023
c0fd2a7
chore: Fencing tests for BLE & ESP32
franky47 Jul 18, 2023
d1e1540
chore: Fix builtin LED defs
franky47 Jul 18, 2023
7e9222b
chore: Fix merger example on ESP32/BLE
franky47 Jul 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.yml]
indent_size = 2
trim_trailing_whitespace = false
55 changes: 31 additions & 24 deletions .github/workflows/platformio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
platformio:
Expand All @@ -25,38 +25,45 @@ jobs:
- SimpleSynth
- CustomBaudRate
board:
# Arduino
- uno
- due
- zero
- leonardo
- micro
- nanoatmega328
- nano_every
- nano33ble
- megaatmega2560
# Teensy
- teensy2
- teensy30
- teensy31
- teensylc
# ESP-32
- featheresp32
- pico32
steps:
- uses: actions/checkout@v2
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v2
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v2
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
pip install "click!=8.0.2" # See platformio/platformio-core#4078
- name: Run PlatformIO
run: pio ci --lib="." --board="${{matrix.board}}"
env:
PLATFORMIO_CI_SRC: examples/${{ matrix.example }}
- uses: actions/checkout@v2
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v2
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v2
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
pip install "click!=8.0.2" # See platformio/platformio-core#4078
- name: Run PlatformIO
run: pio ci --lib="." --board="${{matrix.board}}" --verbose
env:
PLATFORMIO_CI_SRC: examples/${{ matrix.example }}
66 changes: 64 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,68 @@
"string_view": "cpp",
"vector": "cpp",
"istream": "cpp",
"system_error": "cpp"
"system_error": "cpp",
"ios": "cpp",
"__bit_reference": "cpp",
"__bits": "cpp",
"__config": "cpp",
"__debug": "cpp",
"__errc": "cpp",
"__hash_table": "cpp",
"__mutex_base": "cpp",
"__node_handle": "cpp",
"__nullptr": "cpp",
"__split_buffer": "cpp",
"__std_stream": "cpp",
"__string": "cpp",
"__threading_support": "cpp",
"__tree": "cpp",
"__tuple": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"cinttypes": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"complex": "cpp",
"concepts": "cpp",
"cstdarg": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"exception": "cpp",
"coroutine": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"limits": "cpp",
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"mutex": "cpp",
"new": "cpp",
"optional": "cpp",
"ratio": "cpp",
"sstream": "cpp",
"stack": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"variant": "cpp",
"algorithm": "cpp"
}
}
}
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
cmake_minimum_required(VERSION 2.8.7)
cmake_minimum_required(VERSION 3.26.4)
project(arduino_midi_library CXX)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

add_subdirectory(builder)

setup_builder()
Expand Down
7 changes: 6 additions & 1 deletion examples/AltPinSerial/AltPinSerial.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Here, when receiving any message on channel 4, the Arduino
// will blink a led and play back a note for 1 second.

#if defined(ARDUINO_SAM_DUE) || defined(SAMD_SERIES) || defined(_VARIANT_ARDUINO_ZERO_)
#if defined(ARDUINO_SAM_DUE) || defined(SAMD_SERIES) || defined(_VARIANT_ARDUINO_ZERO_) || defined(ARDUINO_ARDUINO_NANO33BLE) || defined(ESP32)
/* example not relevant for this hardware (SoftwareSerial not supported) */
MIDI_CREATE_DEFAULT_INSTANCE();
#else
Expand All @@ -18,6 +18,11 @@
MIDI_NAMESPACE::MidiInterface<Transport> MIDI((Transport&)serialMIDI);
#endif

// Some boards don't have this set (ESP32)
#ifndef LED_BUILTIN
#define LED_BUILTIN 0
#endif

void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
Expand Down
5 changes: 5 additions & 0 deletions examples/Basic_IO/Basic_IO.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
// Here, when receiving any message on channel 4, the Arduino
// will blink a led and play back a note for 1 second.

// Some boards don't have this set (ESP32)
#ifndef LED_BUILTIN
#define LED_BUILTIN 0
#endif

MIDI_CREATE_DEFAULT_INSTANCE();

void setup()
Expand Down
2 changes: 1 addition & 1 deletion examples/Bench/Bench.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// All other Arduinos: Connect pins 2 and 3.
// The program will then wait for 100 loops and print the results.

#if defined(ARDUINO_SAM_DUE) || defined(USBCON)
#if defined(ARDUINO_SAM_DUE) || defined(USBCON) || defined(ARDUINO_ARDUINO_NANO33BLE) || defined(ESP32)
// Print through USB and bench with Hardware serial
MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, midiBench);
#else
Expand Down
5 changes: 5 additions & 0 deletions examples/CustomBaudRate/CustomBaudRate.ino
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ struct CustomBaudRateSettings : public MIDI_NAMESPACE::DefaultSerialSettings {
MIDI_NAMESPACE::MidiInterface<MIDI_NAMESPACE::SerialMIDI<HardwareSerial, CustomBaudRateSettings>> MIDI((MIDI_NAMESPACE::SerialMIDI<HardwareSerial, CustomBaudRateSettings>&)serialMIDI);
#endif

// Some boards don't have this set (ESP32)
#ifndef LED_BUILTIN
#define LED_BUILTIN 0
#endif

void setup() {
pinMode(LED_BUILTIN, OUTPUT);
MIDI.begin(MIDI_CHANNEL_OMNI);
Expand Down
4 changes: 2 additions & 2 deletions examples/DualMerger/DualMerger.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// A out = A in + B in
// B out = B in + A in

#if defined(ARDUINO_SAM_DUE)
#if defined(ARDUINO_SAM_DUE) || defined(ARDUINO_ARDUINO_NANO33BLE) || defined(ESP32)
MIDI_CREATE_INSTANCE(HardwareSerial, Serial, midiA);
MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, midiB);
#elif defined(ARDUINO_SAMD_ZERO)
Expand All @@ -15,7 +15,7 @@
#elif defined(USBCON) || defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MKL26Z64__)
#include <SoftwareSerial.h>
SoftwareSerial softSerial(2,3);
MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, midiA);
MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, midiA);
MIDI_CREATE_INSTANCE(SoftwareSerial, softSerial, midiB);
#else
#include <SoftwareSerial.h>
Expand Down
5 changes: 5 additions & 0 deletions examples/ErrorCallback/ErrorCallback.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

MIDI_CREATE_DEFAULT_INSTANCE();

// Some boards don't have this set (ESP32)
#ifndef LED_BUILTIN
#define LED_BUILTIN 0
#endif

void handleError(int8_t err)
{
digitalWrite(LED_BUILTIN, (err == 0)? LOW : HIGH);
Expand Down
30 changes: 30 additions & 0 deletions examples/Hairless/Hairless.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include <MIDI.h>
USING_NAMESPACE_MIDI

struct MySerialSettings : public MIDI_NAMESPACE::DefaultSerialSettings
{
static const long BaudRate = 115200;
};

unsigned long t1 = millis();

MIDI_NAMESPACE::SerialMIDI<HardwareSerial, MySerialSettings> serialMIDI(Serial1);
MIDI_NAMESPACE::MidiInterface<MIDI_NAMESPACE::SerialMIDI<HardwareSerial, MySerialSettings>> MIDI((MIDI_NAMESPACE::SerialMIDI<HardwareSerial, MySerialSettings>&)serialMIDI);

void setup()
{
MIDI.begin(1);
}

void loop()
{
MIDI.read();

// send a note every second
if ((millis() - t1) > 1000)
{
t1 = millis();

MIDI.sendNoteOn(random(1, 127), 55, 1);
}
}
56 changes: 56 additions & 0 deletions examples/ReceiverActiveSensing/ReceiverActiveSensing.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#include <MIDI.h>
USING_NAMESPACE_MIDI

// Some boards don't have this set (ESP32)
#ifndef LED_BUILTIN
#define LED_BUILTIN 0
#endif

struct MyMIDISettings : public MIDI_NAMESPACE::DefaultSettings
{
// When setting UseReceiverActiveSensing to true, MIDI.read() *must* be called
// as often as possible (1000 / SenderActiveSensingPeriodicity per second).
//
// setting UseReceiverActiveSensing to true, adds 174 bytes of code.
//
// (Taken from a Roland MIDI Implementation Owner's manual)
// Once an Active Sensing message is received, the unit will begin monitoring
// the interval between all subsequent messages. If there is an interval of 420 ms
// or longer between messages while monitoring is active, the same processing
// as when All Sound Off, All Notes Off,and Reset All Controllers messages are
// received will be carried out. The unit will then stopmonitoring the message interval.

static const bool UseReceiverActiveSensing = true;

static const uint16_t ReceiverActiveSensingTimeout = 420;
};

MIDI_CREATE_CUSTOM_INSTANCE(HardwareSerial, Serial1, MIDI, MyMIDISettings);

void activeSensingTimeoutExceptionHandler(bool active)
{
if (!active)
{
MIDI.sendControlChange(AllSoundOff, 0, 1);
MIDI.sendControlChange(AllNotesOff, 0, 1);
MIDI.sendControlChange(ResetAllControllers, 0, 1);

digitalWrite(LED_BUILTIN, HIGH);
}
else
digitalWrite(LED_BUILTIN, LOW);
}

void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);

MIDI.setHandleActiveSensingTimeout(activeSensingTimeoutExceptionHandler);
MIDI.begin(1);
}

void loop()
{
MIDI.read();
}
Loading