pub struct Color(pub u16);Expand description
Valeur de couleur RGB565 pour l’écran ST7789V.
Stockée en interne comme un mot 16 bits big-endian :
RRRRR GGGGGG BBBBB
§Exemples
use embassy_st7789v::Color;
let rouge = Color::rgb(31, 0, 0);
let blanc = Color::rgb8(255, 255, 255);
let custom = Color::rgb8(0x1A, 0x8C, 0xFF);Tuple Fields§
§0: u16Implementations§
Source§impl Color
impl Color
Sourcepub const fn rgb(r: u8, g: u8, b: u8) -> Self
pub const fn rgb(r: u8, g: u8, b: u8) -> Self
Crée une couleur à partir des composantes RGB565 brutes.
r: canal rouge, 0–31g: canal vert, 0–63b: canal bleu, 0–31
Sourcepub const fn rgb8(r: u8, g: u8, b: u8) -> Self
pub const fn rgb8(r: u8, g: u8, b: u8) -> Self
Crée une couleur à partir des composantes RGB sur 8 bits (0–255).
Les composantes sont réduites à la précision RGB565 : rouge et bleu sur 5 bits, vert sur 6 bits.
Sourcepub const fn to_be_bytes(self) -> [u8; 2]
pub const fn to_be_bytes(self) -> [u8; 2]
Retourne la couleur sous forme de deux octets big-endian, prêts à envoyer via SPI.
Trait Implementations§
impl Copy for Color
impl Eq for Color
impl StructuralPartialEq for Color
Auto Trait Implementations§
impl Freeze for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnsafeUnpin for Color
impl UnwindSafe for Color
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more