platform: embedded: build++

This commit is contained in:
Victoria Fischer 2024-10-30 21:50:55 +01:00
parent 84b5abce09
commit 6fc4cb224f
2 changed files with 4 additions and 34 deletions

View File

@ -35,35 +35,3 @@ impl IntoRgb8 for palette::Hsv<Srgb, u8> {
} }
} }
} }
#[cfg(feature="embedded-graphics")]
mod embedded_graphics {
use embedded_graphics::pixelcolor::RgbColor;
use embedded_graphics::pixelcolor::PixelColor;
use embedded_graphics::pixelcolor::raw::RawU8;
impl RgbColor for RGB8 {
fn r(&self) -> u8 { self.red }
fn g(&self) -> u8 { self.green }
fn b(&self) -> u8 { self.blue }
const MAX_R: u8 = 255;
const MAX_G: u8 = 255;
const MAX_B: u8 = 255;
const BLACK: Self = Self::new(0, 0, 0);
const WHITE: Self = Self::new(255, 255, 255);
const RED: Self = Self::new(255, 0, 0);
const GREEN: Self = Self::new(0, 255, 0);
const BLUE: Self = Self::new(0, 0, 255);
const YELLOW: Self = Self::new(255, 0, 0);
const CYAN: Self = Self::new(0, 255, 0);
const MAGENTA: Self = Self::new(0, 0, 255);
}
impl PixelColor for RGB8 {
type Raw = RawU8;
}
}

View File

@ -3,9 +3,11 @@ use embedded_graphics::{
pixelcolor::Rgb888, pixelcolor::Rgb888,
primitives::Rectangle primitives::Rectangle
}; };
use embedded_graphics::pixelcolor::RgbColor; use rgb::RGB8;
use ws2812_esp32_rmt_driver::lib_embedded_graphics::{Ws2812DrawTarget, LedPixelShape}; use ws2812_esp32_rmt_driver::lib_embedded_graphics::{Ws2812DrawTarget, LedPixelShape};
use esp_idf_svc::hal::prelude::Peripherals;
use running_average::RealTimeRunningAverage; use running_average::RealTimeRunningAverage;
use std::io; use std::io;
@ -105,7 +107,7 @@ impl<T: LedPixelShape, S: Surface> Display<S> for EmbeddedDisplay<Ws2812DrawTarg
}) })
} }
self.total_mw += pixel.as_milliwatts(); self.total_mw += pixel.as_milliwatts();
return Pixel(pos, Rgb888::new(pixel.red, pixel.green, pixel.blue)); return Pixel(pos, Rgb888::new(pixel.r, pixel.g, pixel.b));
}) })
).unwrap(); ).unwrap();
} }