Skip to content

Commit

Permalink
add setCableNumber()
Browse files Browse the repository at this point in the history
  • Loading branch information
YuuichiAkagawa committed Aug 12, 2023
1 parent d69c13b commit 3b4a254
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
16 changes: 16 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog
## 2023.08.12(1.0.1)
- Add new API ```void setCableNumber(uint8_t cn)```

## 2021.05.10(1.0.0)
- GA
- update document

## 2021.05.06(0.0.3)
- Add UHS2MIDI_CREATE_CUSTOM_INSTANCE macro

## 2021.05.02(0.0.2)
- Refactaring: improve performance and reduce SRAM usage

## 2021.04.30(0.0.1)
- initial release
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,22 @@ MIDI_NAMESPACE::MidiInterface<UHS2MIDI_NAMESPACE::uhs2MidiTransport> MIDI2((UHS2
```
will create a instance named `uhs2MIDI2` (and underlaying MIDI object `MIDI2`) and is by default connected to cable number 5.

### Change CableNumber
```cpp
#include <UHS2-MIDI.h>
...
USB Usb;
UHS2MIDI_CREATE_DEFAULT_INSTANCE(&Usb);
void setup()
{
MIDI.begin(4); // Launch MIDI and listen to channel 4
MIDI.getTransport()->setCableNumber(1); // Change CableNumber to 1 later
```
## Tested boards / modules
- Arduino UNO
- Arduino UNO R3
## Changelog
[Chagelog](/Changelog.md)
## Other Transport protocols:
The libraries below the same calling mechanism (API), making it easy to interchange the transport layer.
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=UHS2-MIDI
version=1.0.0
version=1.0.1
author=Yuuichi Akagawa
maintainer=Yuuichi AKagawa
sentence=USB Host Shield Library 2.0 MIDI I/O for Arduino
Expand Down
10 changes: 9 additions & 1 deletion src/UHS2-MIDI.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ SOFTWARE.
* Original version: https://github.com/lathoub/Arduino-USBMIDI/blob/master/src/USB-MIDI.h
*
* Modified for the USB Host Shield 2.0 + USBH_MIDI
* copyright (c) 2020-2021 Yuuichi Akagawa
* copyright (c) 2020-2023 Yuuichi Akagawa
*******************************************************************************
*/
#pragma once
Expand All @@ -35,6 +35,8 @@ SOFTWARE.
#include "UHS2-MIDI_defs.h"
#include "UHS2-MIDI_Namespace.h"

#define UHS2_MIDI_VERSION 10001

BEGIN_UHS2MIDI_NAMESPACE
class uhs2MidiTransport : public USBH_MIDI
{
Expand Down Expand Up @@ -162,6 +164,12 @@ class uhs2MidiTransport : public USBH_MIDI
}
return mRxLength;
};

void setCableNumber(uint8_t cn){
if( cn > 15 )
return;
cableNumber = cn;
};
};

END_UHS2MIDI_NAMESPACE
Expand Down

0 comments on commit 3b4a254

Please sign in to comment.