Skip to content

Commit

Permalink
Fix: enforce Rgb565 color-mode as default
Browse files Browse the repository at this point in the history
  • Loading branch information
IniterWorker committed Sep 15, 2024
1 parent 19a8085 commit 7b7509a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
3 changes: 1 addition & 2 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,7 @@ pub enum Command {
/// * MX Column Address Order These 3 bits control MCU to memory write/read direction.
/// * MV Row / Column Exchange
/// * ML Vertical Refresh Order LCD vertical refresh direction control.
/// * BGR RGB-BGR Order
/// * Color selector switch control (0=RGB color filter panel, 1=BGR color filter panel)
/// * BGR RGB-BGR Order Color selector switch control (0=RGB color filter panel, 1=BGR color filter panel)
/// * MH Horizontal Refresh ORDER LCD horizontal refreshing direction control.
///
/// ## Description
Expand Down
14 changes: 2 additions & 12 deletions src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Reference all screen hardware definition

use display_interface::{DisplayError, WriteOnlyDataCommand};
use embedded_graphics::{framebuffer::buffer_size, pixelcolor::Bgr565};
use embedded_graphics::{framebuffer::buffer_size, pixelcolor::Rgb565};
use embedded_hal::delay::DelayNs;

use crate::{
Expand Down Expand Up @@ -66,7 +66,7 @@ impl DisplayDefinition for DisplayResolution240x240 {
type Buffer = Gc9a01Framebuffer<
{ Self::WIDTH as usize },
{ Self::HEIGHT as usize },
{ buffer_size::<Bgr565>(Self::WIDTH as usize, Self::HEIGHT as usize) },
{ buffer_size::<Rgb565>(Self::WIDTH as usize, Self::HEIGHT as usize) },
>;

fn configure(
Expand All @@ -79,16 +79,6 @@ impl DisplayDefinition for DisplayResolution240x240 {

Command::DispalyFunctionControl(GSMode::G1toG32, SSMode::S1toS360, 0, 0).send(iface)?;

Command::MemoryAccessControl(
Logical::Off,
Logical::Off,
Logical::Off,
Logical::On,
Logical::On,
Logical::Off,
)
.send(iface)?;

// maybe an issue
Command::PixelFormatSet(Dbi::Pixel16bits, Dpi::Pixel16bits).send(iface)?;

Expand Down
8 changes: 4 additions & 4 deletions src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ where
Logical::Off,
Logical::Off,
Logical::On,
Logical::On,
Logical::Off, // enforce RGB
Logical::Off,
)
.send(&mut self.interface)?,
Expand All @@ -159,7 +159,7 @@ where
Logical::Off,
Logical::Off,
Logical::On,
Logical::On,
Logical::Off, // enforce RGB
Logical::Off,
)
.send(&mut self.interface)?,
Expand All @@ -168,7 +168,7 @@ where
Logical::On,
Logical::Off,
Logical::On,
Logical::On,
Logical::Off, // enforce RGB
Logical::Off,
)
.send(&mut self.interface)?,
Expand All @@ -177,7 +177,7 @@ where
Logical::On,
Logical::Off,
Logical::On,
Logical::On,
Logical::Off, // enforce RGB
Logical::Off,
)
.send(&mut self.interface)?,
Expand Down
3 changes: 2 additions & 1 deletion src/mode/graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ use core::slice;

use display_interface::{DisplayError, WriteOnlyDataCommand};
use embedded_graphics::geometry::Dimensions;
use embedded_graphics::{pixelcolor::Rgb565, prelude::*, Pixel};
use embedded_graphics::pixelcolor::Rgb565;
use embedded_graphics::{prelude::*, Pixel};
use embedded_hal::delay::DelayNs;

use crate::{display::DisplayDefinition, rotation::DisplayRotation, Gc9a01, Gc9a01Framebuffer};
Expand Down

0 comments on commit 7b7509a

Please sign in to comment.