Browse Source

Rename methods for accuracy

pull/65/head
Steve Cook 2 years ago
parent
commit
6f77099394
  1. 3
      ctru-rs/examples/camera-image.rs
  2. 19
      ctru-rs/src/services/cam.rs

3
ctru-rs/examples/camera-image.rs

@ -36,11 +36,9 @@ fn main() {
camera camera
.set_view_size(CamSize::CTR_TOP_LCD) .set_view_size(CamSize::CTR_TOP_LCD)
.expect("Failed to set camera size"); .expect("Failed to set camera size");
camera camera
.set_output_format(CamOutputFormat::RGB_565) .set_output_format(CamOutputFormat::RGB_565)
.expect("Failed to set camera output format"); .expect("Failed to set camera output format");
camera camera
.set_noise_filter(true) .set_noise_filter(true)
.expect("Failed to enable noise filter"); .expect("Failed to enable noise filter");
@ -50,7 +48,6 @@ fn main() {
camera camera
.set_auto_white_balance(true) .set_auto_white_balance(true)
.expect("Failed to enable auto white balance"); .expect("Failed to enable auto white balance");
camera camera
.set_trimming(false) .set_trimming(false)
.expect("Failed to disable trimming"); .expect("Failed to disable trimming");

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

@ -308,7 +308,7 @@ pub trait Camera {
} }
} }
fn is_trimming(&self) -> crate::Result<bool> { fn is_trimming_enabled(&self) -> crate::Result<bool> {
unsafe { unsafe {
let mut trimming = false; let mut trimming = false;
let r = ctru_sys::CAMU_IsTrimming(&mut trimming, self.port_as_raw()); let r = ctru_sys::CAMU_IsTrimming(&mut trimming, self.port_as_raw());
@ -447,14 +447,14 @@ pub trait Camera {
} }
} }
fn is_auto_exposure(&self) -> crate::Result<bool> { fn is_auto_exposure_enabled(&self) -> crate::Result<bool> {
unsafe { unsafe {
let mut is_auto_exposure = false; let mut enabled = false;
let r = ctru_sys::CAMU_IsAutoExposure(&mut is_auto_exposure, self.camera_as_raw()); let r = ctru_sys::CAMU_IsAutoExposure(&mut enabled, self.camera_as_raw());
if r < 0 { if r < 0 {
Err(r.into()) Err(r.into())
} else { } else {
Ok(is_auto_exposure) Ok(enabled)
} }
} }
} }
@ -470,15 +470,14 @@ pub trait Camera {
} }
} }
fn is_auto_white_balance(&self) -> crate::Result<bool> { fn is_auto_white_balance_enabled(&self) -> crate::Result<bool> {
unsafe { unsafe {
let mut is_auto_white_balance = false; let mut enabled = false;
let r = let r = ctru_sys::CAMU_IsAutoWhiteBalance(&mut enabled, self.camera_as_raw());
ctru_sys::CAMU_IsAutoWhiteBalance(&mut is_auto_white_balance, self.camera_as_raw());
if r < 0 { if r < 0 {
Err(r.into()) Err(r.into())
} else { } else {
Ok(is_auto_white_balance) Ok(enabled)
} }
} }
} }

Loading…
Cancel
Save