Skip to content

Commit 008bbad

Browse files
committed
Adding project .gitignore
1 parent 3cd4594 commit 008bbad

File tree

4 files changed

+36
-6
lines changed

4 files changed

+36
-6
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
documentation/html
2+
CMakeLists.txt
3+
src/.idea

src/MIDIUSB.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void MIDI_::accept(void)
9595
}
9696
c = USB_Recv(MIDI_RX, &event, sizeof(event) );
9797

98-
//MIDI paacket has to be 4 bytes
98+
//MIDI packet has to be 4 bytes
9999
if(c < 4)
100100
return;
101101
buffer->midiEvent[buffer->head] = event;

src/MIDIUSB.h

+31-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
//================================================================================
22
//================================================================================
3-
// MIDI USB class
43

4+
/**
5+
MIDI USB class
6+
*/
57
#ifndef MIDIUSB_h
68
#define MIDIUSB_h
79

@@ -88,7 +90,7 @@ typedef struct
8890
#define MIDI_JACK_EXT 0X02
8991

9092
_Pragma("pack(1)")
91-
93+
/// Midi Audio Control Interface Descriptor
9294
typedef struct
9395
{
9496
uint8_t len; // 9
@@ -123,13 +125,15 @@ typedef struct
123125
uint8_t jackStrIndex;
124126
} MIDIJackOutDescriptor;
125127

128+
/// MIDI Jack EndPoint Descriptor, common to midi in and out jacks.
126129
typedef struct
127130
{
128131
EndpointDescriptor len; // 9
129132
uint8_t refresh; // 4
130133
uint8_t sync;
131134
} MIDI_EPDescriptor;
132135

136+
/// MIDI Jack EndPoint AudioControl Descriptor, common to midi in and out ac jacks.
133137
typedef struct
134138
{
135139
uint8_t len; // 5
@@ -139,6 +143,7 @@ typedef struct
139143
uint8_t jackID;
140144
} MIDI_EP_ACDescriptor;
141145

146+
/// MIDI Audio Stream Descriptor Interface
142147
typedef struct
143148
{
144149
uint8_t len; // 9
@@ -148,6 +153,7 @@ typedef struct
148153
uint16_t wTotalLength;
149154
} MIDI_ASInterfaceDescriptor;
150155

156+
/// Top Level MIDI Descriptor used to create a Midi Interface instace \see MIDI_::getInterface()
151157
typedef struct
152158
{
153159
// IAD
@@ -192,32 +198,53 @@ typedef struct
192198
#define D_CDCCS(_subtype,_d0,_d1) { 5, 0x24, _subtype, _d0, _d1 }
193199
#define D_CDCCS4(_subtype,_d0) { 4, 0x24, _subtype, _d0 }
194200

201+
#ifndef DOXYGEN_ARD
202+
// the following would confuse doxygen documentation tool, so skip in that case for autodoc build
195203
_Pragma("pack()")
196204

197205
#define WEAK __attribute__ ((weak))
198206

207+
#endif
208+
209+
/**
210+
Concrete MIDI implementation of a PluggableUSBModule
211+
By default, will define one midi in and one midi out enpoints.
212+
*/
199213
class MIDI_ : public PluggableUSBModule
200214
{
201215
// private:
202216
// RingBuffer *_midi_rx_buffer;
203217
private:
204-
void accept(void);
205-
EPTYPE_DESCRIPTOR_SIZE epType[2];
218+
void accept(void); ///< Accepts a midi packet, \see MIDI_::read()
219+
EPTYPE_DESCRIPTOR_SIZE epType[2]; ///< Container that defines the two bulk MIDI IN/OUT endpoints types
206220

207221
protected:
208222
// Implementation of the PUSBListNode
223+
224+
/// Creates a MIDIDescriptor midi interface and sollicit USBDevice to send control to it.
225+
/// \see USBDevice::SendControl()
209226
int getInterface(uint8_t* interfaceNum);
227+
/// Current implementation just returns 0
210228
int getDescriptor(USBSetup& setup);
229+
/// Optional interface usb setup callback, current implementation returns false
211230
bool setup(USBSetup& setup);
231+
/// MIDI Device short name, defaults to "MIDI" and returns a length of 4 chars
212232
uint8_t getShortName(char* name);
213233

214234
public:
235+
/// Creates a MIDI USB device with 2 endpoints
215236
MIDI_(void);
237+
/// Returns the number of bytes currently available from RX
216238
uint32_t available(void);
239+
/// Reads a new MIDI message from USB
217240
midiEventPacket_t read(void);
241+
/// Flushes TX midi channel
218242
void flush(void);
243+
/// Sends a MIDI message to USB
219244
void sendMIDI(midiEventPacket_t event);
245+
/// Sends a MIDI buffer of length size to USB
220246
size_t write(const uint8_t *buffer, size_t size);
247+
/// NIY
221248
operator bool();
222249
};
223250
extern MIDI_ MidiUSB;

src/pitchToNote.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
#define pitchB0 23
9595
#define pitchB0b 22
9696
#define pitchA0 21
97-
97+
/// Full 88 key range note pitch high to low midi byte value mapping array
9898
const int notePitch[] = {pitchC8,
9999
pitchB7, pitchB7b, pitchA7, pitchA7b, pitchG7, pitchG7b, pitchF7, pitchE7, pitchE7b, pitchD7, pitchD7b, pitchC7,
100100
pitchB6, pitchB6b, pitchA6, pitchA6b, pitchG6, pitchG6b, pitchF6, pitchE6, pitchE6b, pitchD6, pitchD6b, pitchC6,

0 commit comments

Comments
 (0)