Browse Source

Add TryFrom conversion for FramebufferFormat and CamOutputFormat

pull/65/head
Steve Cook 2 years ago
parent
commit
cae4f005e8
  1. 23
      ctru-rs/src/services/cam.rs

23
ctru-rs/src/services/cam.rs

@ -1,5 +1,6 @@
use bitflags::bitflags; use bitflags::bitflags;
use ctru_sys::Handle; use ctru_sys::Handle;
use crate::services::gspgpu::FramebufferFormat;
pub struct Cam(()); pub struct Cam(());
@ -166,6 +167,28 @@ bitflags! {
} }
} }
impl TryFrom<FramebufferFormat> for CamOutputFormat {
type Error = ();
fn try_from(value: FramebufferFormat) -> Result<Self, Self::Error> {
match value {
FramebufferFormat::Rgb565 => Ok(CamOutputFormat::RGB_565),
_ => Err(())
}
}
}
impl TryFrom<CamOutputFormat> for FramebufferFormat {
type Error = ();
fn try_from(value: CamOutputFormat) -> Result<Self, Self::Error> {
match value {
CamOutputFormat::RGB_565 => Ok(FramebufferFormat::Rgb565),
_ => Err(())
}
}
}
bitflags! { bitflags! {
#[derive(Default)] #[derive(Default)]
pub struct CamShutterSoundType: u32 { pub struct CamShutterSoundType: u32 {

Loading…
Cancel
Save