27#ifndef _TUSB_MIDI_DEVICE_H_
28#define _TUSB_MIDI_DEVICE_H_
30#include "class/audio/audio.h"
37#if !defined(CFG_TUD_MIDI_EP_BUFSIZE) && defined(CFG_TUD_MIDI_EPSIZE)
38 #warning CFG_TUD_MIDI_EPSIZE is renamed to CFG_TUD_MIDI_EP_BUFSIZE, please update to use the new name
39 #define CFG_TUD_MIDI_EP_BUFSIZE CFG_TUD_MIDI_EPSIZE
42#ifndef CFG_TUD_MIDI_EP_BUFSIZE
43 #define CFG_TUD_MIDI_EP_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
61bool tud_midi_n_mounted (uint8_t itf);
64uint32_t tud_midi_n_available (uint8_t itf, uint8_t cable_num);
67uint32_t tud_midi_n_stream_read (uint8_t itf, uint8_t cable_num,
void* buffer, uint32_t bufsize);
70uint32_t tud_midi_n_stream_write (uint8_t itf, uint8_t cable_num, uint8_t
const* buffer, uint32_t bufsize);
73bool tud_midi_n_packet_read (uint8_t itf, uint8_t packet[4]);
76bool tud_midi_n_packet_write (uint8_t itf, uint8_t
const packet[4]);
81static inline bool tud_midi_mounted (
void);
82static inline uint32_t tud_midi_available (
void);
84static inline uint32_t tud_midi_stream_read (
void* buffer, uint32_t bufsize);
85static inline uint32_t tud_midi_stream_write (uint8_t cable_num, uint8_t
const* buffer, uint32_t bufsize);
87static inline bool tud_midi_packet_read (uint8_t packet[4]);
88static inline bool tud_midi_packet_write (uint8_t
const packet[4]);
93TU_ATTR_DEPRECATED(
"tud_midi_read() is renamed to tud_midi_stream_read()")
94static inline uint32_t tud_midi_read (
void* buffer, uint32_t bufsize)
96 return tud_midi_stream_read(buffer, bufsize);
99TU_ATTR_DEPRECATED(
"tud_midi_write() is renamed to tud_midi_stream_write()")
100static inline uint32_t tud_midi_write(uint8_t cable_num, uint8_t const* buffer, uint32_t bufsize)
102 return tud_midi_stream_write(cable_num, buffer, bufsize);
106TU_ATTR_DEPRECATED(
"tud_midi_send() is renamed to tud_midi_packet_write()")
107static inline
bool tud_midi_send(uint8_t packet[4])
109 return tud_midi_packet_write(packet);
112TU_ATTR_DEPRECATED(
"tud_midi_receive() is renamed to tud_midi_packet_read()")
113static inline
bool tud_midi_receive(uint8_t packet[4])
115 return tud_midi_packet_read(packet);
121TU_ATTR_WEAK
void tud_midi_rx_cb(uint8_t itf);
127static inline bool tud_midi_mounted (
void)
129 return tud_midi_n_mounted(0);
132static inline uint32_t tud_midi_available (
void)
134 return tud_midi_n_available(0, 0);
137static inline uint32_t tud_midi_stream_read (
void* buffer, uint32_t bufsize)
139 return tud_midi_n_stream_read(0, 0, buffer, bufsize);
142static inline uint32_t tud_midi_stream_write (uint8_t cable_num, uint8_t
const* buffer, uint32_t bufsize)
144 return tud_midi_n_stream_write(0, cable_num, buffer, bufsize);
147static inline bool tud_midi_packet_read (uint8_t packet[4])
149 return tud_midi_n_packet_read(0, packet);
152static inline bool tud_midi_packet_write (uint8_t
const packet[4])
154 return tud_midi_n_packet_write(0, packet);
160void midid_init (
void);
161void midid_reset (uint8_t rhport);
164bool midid_xfer_cb (uint8_t rhport, uint8_t edpt_addr, xfer_result_t result, uint32_t xferred_bytes);
AUDIO Channel Cluster Descriptor (4.1)
Definition audio.h:647