Control Surface main
MIDI Control Surface library for Arduino
Typedefs | Functions
midi.h File Reference

Detailed Description

Public MIDI over Bluetooth Low Energy API.

Definition in file midi.h.

#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
+ Include dependency graph for midi.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef void(* midi_mtu_callback_t) (uint16_t)
 Type for the MTU negotiation callback. More...
 
typedef void(* midi_write_callback_t) (const uint8_t *, size_t)
 Type for the BLE MIDI write callback. More...
 

Functions

void midi_set_mtu_callback (midi_mtu_callback_t cb)
 Set the callback that is to be called when the MTU negotiation with the BLE client is finished. More...
 
uint16_t midi_get_mtu (void)
 Get the current MTU (maximum transmission unit) of the link with the BLE client. More...
 
void midi_set_write_callback (midi_write_callback_t cb)
 Set the callback that is to be called when the client writes (sends) a MIDI packet. More...
 
bool midi_notify (const uint8_t *data, size_t len)
 Send a MIDI BLE notification to the client. More...
 
void set_midi_ble_name (const char *name)
 Set the name of the BLE device. Must be set before calling midi_init(). More...
 
bool midi_init ()
 Initialize the Bluetooth stack and register the MIDI BLE application with the Bluedroid driver. More...
 
bool midi_deinit ()
 Cleanup the MIDI BLE application and de-initialize the Bluetooth stack. More...
 

Typedef Documentation

◆ midi_mtu_callback_t

typedef void(* midi_mtu_callback_t) (uint16_t)

Type for the MTU negotiation callback.

Warning
Used in C code, use C calling convention (use extern "C" to declare this function in C++ code).

Definition at line 20 of file midi.h.

◆ midi_write_callback_t

typedef void(* midi_write_callback_t) (const uint8_t *, size_t)

Type for the BLE MIDI write callback.

Warning
Used in C code, use C calling convention (use extern "C" to declare this function in C++ code).

Definition at line 31 of file midi.h.

Function Documentation

◆ midi_set_mtu_callback()

void midi_set_mtu_callback ( midi_mtu_callback_t  cb)

Set the callback that is to be called when the MTU negotiation with the BLE client is finished.

◆ midi_get_mtu()

uint16_t midi_get_mtu ( void  )

Get the current MTU (maximum transmission unit) of the link with the BLE client.

◆ midi_set_write_callback()

void midi_set_write_callback ( midi_write_callback_t  cb)

Set the callback that is to be called when the client writes (sends) a MIDI packet.

◆ midi_notify()

bool midi_notify ( const uint8_t *  data,
size_t  len 
)

Send a MIDI BLE notification to the client.

◆ set_midi_ble_name()

void set_midi_ble_name ( const char *  name)

Set the name of the BLE device. Must be set before calling midi_init().

◆ midi_init()

bool midi_init ( )

Initialize the Bluetooth stack and register the MIDI BLE application with the Bluedroid driver.

◆ midi_deinit()

bool midi_deinit ( )

Cleanup the MIDI BLE application and de-initialize the Bluetooth stack.