Skip to content

Commit

Permalink
Moved descriptor constants into class module
Browse files Browse the repository at this point in the history
  • Loading branch information
sourcebox committed Dec 19, 2024
1 parent 30d7b48 commit 270f244
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 24 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- Renamed `UsbMidiEventPacket::from_midi` function to `UsbMidiEventPacket::from_message`.
- Renamed `MidiClass::send_message` function to `MidiClass::send_packet`.
- Moved usb descriptor constants into class module and made them private.

### Removed

Expand Down
1 change: 0 additions & 1 deletion src/data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
pub mod byte;
pub mod midi;
pub mod usb;
pub mod usb_midi;
19 changes: 0 additions & 19 deletions src/data/usb/constants.rs

This file was deleted.

3 changes: 0 additions & 3 deletions src/data/usb/mod.rs

This file was deleted.

15 changes: 14 additions & 1 deletion src/midi_device.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
//! Contains the class implementation.
use crate::data::usb::constants::*;
use crate::data::usb_midi::usb_midi_event_packet::{MidiPacketParsingError, UsbMidiEventPacket};
use usb_device::class_prelude::*;
use usb_device::Result;

// Constants for use in descriptors.
const USB_AUDIO_CLASS: u8 = 0x01;
const USB_AUDIOCONTROL_SUBCLASS: u8 = 0x01;
const USB_MIDISTREAMING_SUBCLASS: u8 = 0x03;
const MIDI_IN_JACK_SUBTYPE: u8 = 0x02;
const MIDI_OUT_JACK_SUBTYPE: u8 = 0x03;
const EMBEDDED: u8 = 0x01;
const EXTERNAL: u8 = 0x02;
const CS_INTERFACE: u8 = 0x24;
const CS_ENDPOINT: u8 = 0x25;
const HEADER_SUBTYPE: u8 = 0x01;
const MS_HEADER_SUBTYPE: u8 = 0x01;
const MS_GENERAL: u8 = 0x01;

const MIDI_IN_SIZE: u8 = 0x06;
const MIDI_OUT_SIZE: u8 = 0x09;

Expand Down

0 comments on commit 270f244

Please sign in to comment.