Puts usb constants in it's own file

Moves them into usb_constants.rs.
These can maybe be moved into the usdb-device crate?.
They could be more shareable
This commit is contained in:
beau trepp 2019-09-17 21:25:06 +08:00
parent fddd4254b1
commit 5f631bb56b
3 changed files with 18 additions and 15 deletions

View file

@ -1,7 +1,9 @@
#![no_std] #![no_std]
mod usb_constants;
mod midi_device; mod midi_device;
mod notes; mod notes;
pub use usb_device::{Result,UsbError}; pub use usb_device::{Result,UsbError};
pub use crate::usb_constants::USB_CLASS_NONE;
pub use crate::midi_device::*; pub use crate::midi_device::*;
pub use crate::notes::Note; pub use crate::notes::Note;

View file

@ -1,22 +1,9 @@
use usb_device::class_prelude::*; use usb_device::class_prelude::*;
use usb_device::Result; use usb_device::Result;
use crate::notes::Note; use crate::notes::Note;
use crate::usb_constants::*;
pub const USB_CLASS_NONE : u8 = 0x00; //const MIDI_IN_SIZE: u8 = 0x06;
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_OUT_SIZE: u8 = 0x09; const MIDI_OUT_SIZE: u8 = 0x09;
pub struct MidiClass<'a,B: UsbBus> { pub struct MidiClass<'a,B: UsbBus> {

14
src/usb_constants.rs Normal file
View file

@ -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;