Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API mbed nRF51822
LEDService.h
00001 00002 /* 00003 * Copyright (c) 2016 Samuele Cornell 00004 * 00005 * Permission is hereby granted, free of charge, to any person obtaining a copy 00006 * of this software and associated documentation files (the "Software"), to deal 00007 * in the Software without restriction, including without limitation the rights 00008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00009 * copies of the Software, and to permit persons to whom the Software is 00010 * furnished to do so, subject to the following conditions: 00011 * 00012 * The above copyright notice and this permission notice shall be included in all 00013 * copies or substantial portions of the Software. 00014 * 00015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00018 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00021 * SOFTWARE. 00022 * 00023 */ 00024 00025 #define UART_RX_PIN USBRX// RX UART Pin 00026 00027 #define UART_TX_PIN USBTX// TX UART Pin 00028 00029 // i have used DFRobot MIDI Shield but there are other commercially available similar products, also it is possible to interface directly a MIDI cable via an optocoupler (several projects are already available online ) 00030 00031 #define LIGHT_SHOW 1 // 0 if visual feedback isn't needed (saves energy ) 00032 00033 #define TX_LED D6 // the state of this led will change whenever a message is to be sent over ble-midi 00034 00035 #define RX_LED D7 // the state of this led will change whenever a message received over ble-midi 00036 00037 00038 /******************************************************************************************************* 00039 PERFORMANCE TWEAKS 00040 *******************************************************************************************************/ 00041 00042 00043 #define BUFSERIAL_LENGHT 256 // define the software circular buffer lenght used for the UART. 00044 00045 00046 #define ONLY_MIDI_to_BLEMIDI 1 // if only unidirectional MIDI to BLE-MIDI is desired set this to 1 00047 00048 00049 #define ONLY_BLEMIDI_to_MIDI 1 // if only unidirectional BLE-MIDI to MIDI is desired set this to 1 00050 00051 // unidirectional operation allows to save energy. It also leads to better performance as if ONLY MIDI to BLE MIDI is required, for example it is possible to shorten the SENDBLE_INTERVAL 00052 // without reliability issues (to a certain extent). 00053 00054 #define SENDBLEMIDI_INTERVAL 0.01 // this defines how frequently MIDI Events from the UART are polled, parsed and then sent via BLE-MIDI. 00055 // a lower value means less latency but it also increase energy comsuption and if is set too low can cause reliability issues in MIDI to BLE-MIDI operation (especially for long SysEx messages). 00056 00057 00058 /*************************************************************************************************************** 00059 CONNECTION PARAMETERS 00060 ***************************************************************************************************************/ 00061 00062 namespace Config { 00063 00064 // 00065 const int minConnectionInterval = 6; // (1.25 ms units) 00066 const int maxConnectionInterval = 15; // (1.25 ms units) 00067 const int slaveLatency = 0; 00068 const int supervisionTimeout = 500; // (10 ms units) 00069 00070 00071 00072 }
Generated on Mon Aug 1 2022 10:22:45 by
1.7.2