Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Commit

Permalink
fix: uncomment conversion implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
Gavin-Niederman committed Nov 18, 2023
1 parent ee27548 commit f4a8f23
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
1 change: 1 addition & 0 deletions pros/src/lvgl/colors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use core::ops::{Deref, DerefMut};
use pros_sys::lv_color_t;

/// A color that can be used on the LCD.
/// The color space is dependent on the LCD driver.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct LcdColor(pub lv_color_t);

Expand Down
42 changes: 21 additions & 21 deletions pros/src/sensors/vision.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use alloc::vec::Vec;
use pros_sys::{PROS_ERR, VISION_OBJECT_ERR_SIG};
use snafu::Snafu;

use crate::error::{bail_errno, bail_on, map_errno, PortError};
use crate::{error::{bail_errno, bail_on, map_errno, PortError}, lvgl::colors::LcdColor};

/// Represents a vision sensor plugged into the vex.
pub struct VisionSensor {
Expand Down Expand Up @@ -168,26 +168,26 @@ impl From<u32> for Rgb {
}
}

// impl From<Rgb> for LcdColor {
// fn from(other: Rgb) -> Self {
// Self(lv_color_t {
// red: other.r,
// green: other.g,
// blue: other.b,
// alpha: 0xFF,
// })
// }
// }

// impl From<LcdColor> for Rgb {
// fn from(other: LcdColor) -> Self {
// Self {
// r: other.red,
// g: other.green,
// b: other.blue,
// }
// }
// }
impl From<Rgb> for LcdColor {
fn from(other: Rgb) -> Self {
Self(pros_sys::lv_color_t {
red: other.r,
green: other.g,
blue: other.b,
alpha: 0xFF,
})
}
}

impl From<LcdColor> for Rgb {
fn from(other: LcdColor) -> Self {
Self {
r: other.red,
g: other.green,
b: other.blue,
}
}
}

#[repr(u32)]
pub enum VisionZeroPoint {
Expand Down

0 comments on commit f4a8f23

Please sign in to comment.