diff --git a/src/lib.rs b/src/lib.rs index 5fd6f94..581007b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,9 @@ #![no_std] +mod usb_constants; mod midi_device; mod notes; pub use usb_device::{Result,UsbError}; +pub use crate::usb_constants::USB_CLASS_NONE; pub use crate::midi_device::*; pub use crate::notes::Note; \ No newline at end of file diff --git a/src/midi_device.rs b/src/midi_device.rs index 8d486fe..3534ae3 100644 --- a/src/midi_device.rs +++ b/src/midi_device.rs @@ -1,22 +1,9 @@ use usb_device::class_prelude::*; use usb_device::Result; use crate::notes::Note; +use crate::usb_constants::*; -pub const USB_CLASS_NONE : u8 = 0x00; -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 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_IN_SIZE: u8 = 0x06; const MIDI_OUT_SIZE: u8 = 0x09; pub struct MidiClass<'a,B: UsbBus> { diff --git a/src/usb_constants.rs b/src/usb_constants.rs new file mode 100644 index 0000000..8ec3203 --- /dev/null +++ b/src/usb_constants.rs @@ -0,0 +1,14 @@ + +pub const USB_CLASS_NONE : u8 = 0x00; +pub const USB_AUDIO_CLASS: u8 = 0x01; +pub const USB_AUDIOCONTROL_SUBCLASS: u8 = 0x01; +pub const USB_MIDISTREAMING_SUBCLASS: u8 =0x03; +//pub const MIDI_IN_JACK_SUBTYPE : u8 = 0x02; +pub const MIDI_OUT_JACK_SUBTYPE : u8 = 0x03; +pub const EMBEDDED : u8 = 0x01; +pub const CS_INTERFACE: u8 = 0x24; +pub const CS_ENDPOINT: u8 = 0x25; +pub const HEADER_SUBTYPE: u8 = 0x01; +pub const MS_HEADER_SUBTYPE: u8 = 0x01; +pub const MS_GENERAL: u8 = 0x01; +