respeaker 0.2.0

USB control library for Seeed ReSpeaker Mic Array v2.0 and XVF3800 (LEDs + DSP tuning)
Documentation
/// Supported ReSpeaker hardware models.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Model {
    /// Mic Array v2.0 (XVF-3000), USB `2886:0018`.
    MicArrayV2,
    /// reSpeaker XVF3800 USB 4-Mic Array, USB `2886:001a`.
    Xvf3800,
}

impl Model {
    pub const fn product_id(self) -> u16 {
        match self {
            Self::MicArrayV2 => crate::PRODUCT_ID_V2,
            Self::Xvf3800 => crate::PRODUCT_ID_XVF3800,
        }
    }

    pub const fn label(self) -> &'static str {
        match self {
            Self::MicArrayV2 => "ReSpeaker Mic Array v2.0 (XVF-3000)",
            Self::Xvf3800 => "reSpeaker XVF3800",
        }
    }
}

impl std::fmt::Display for Model {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.label())
    }
}