2018-02-24 13:37:17 +00:00
|
|
|
#![no_std]
|
|
|
|
|
2021-11-18 20:32:37 +00:00
|
|
|
//! ILI9341 Display Driver
|
|
|
|
//!
|
|
|
|
//! ### Usage
|
|
|
|
//!
|
|
|
|
//! To control the display you need to set up:
|
|
|
|
//!
|
|
|
|
//! * Interface for communicating with display ([display-interface-spi crate] for SPI)
|
|
|
|
//! * Configuration (reset pin, delay, orientation and size) for display
|
|
|
|
//!
|
|
|
|
//! ```ignore
|
|
|
|
//! let iface = SPIInterface::new(spi, dc, cs);
|
|
|
|
//!
|
|
|
|
//! let mut display = Ili9341::new(
|
|
|
|
//! iface,
|
|
|
|
//! reset_gpio,
|
|
|
|
//! &mut delay,
|
|
|
|
//! Orientation::Landscape,
|
|
|
|
//! ili9341::DisplaySize240x320,
|
|
|
|
//! )
|
|
|
|
//! .unwrap();
|
|
|
|
//!
|
|
|
|
//! display.clear(Rgb565::RED).unwrap()
|
|
|
|
//! ```
|
|
|
|
//!
|
|
|
|
//! [display-interface-spi crate]: https://crates.io/crates/display-interface-spi
|
2022-04-16 20:29:50 +00:00
|
|
|
use embedded_hal::delay::blocking::DelayUs;
|
|
|
|
use embedded_hal::digital::blocking::OutputPin;
|
2018-02-24 13:37:17 +00:00
|
|
|
|
2020-06-01 12:30:03 +00:00
|
|
|
use core::iter::once;
|
|
|
|
use display_interface::DataFormat::{U16BEIter, U8Iter};
|
|
|
|
use display_interface::WriteOnlyDataCommand;
|
2020-01-28 16:56:12 +00:00
|
|
|
|
2021-05-10 23:07:30 +00:00
|
|
|
#[cfg(feature = "graphics")]
|
2021-05-10 23:21:06 +00:00
|
|
|
mod graphics_core;
|
|
|
|
|
2021-03-12 19:29:32 +00:00
|
|
|
pub use embedded_hal::spi::MODE_0 as SPI_MODE;
|
2020-02-06 23:10:53 +00:00
|
|
|
|
2021-05-10 22:08:17 +00:00
|
|
|
pub use display_interface::DisplayError;
|
|
|
|
|
2021-05-10 22:15:59 +00:00
|
|
|
type Result<T = (), E = DisplayError> = core::result::Result<T, E>;
|
|
|
|
|
2020-10-26 12:28:04 +00:00
|
|
|
/// Trait that defines display size information
|
|
|
|
pub trait DisplaySize {
|
|
|
|
/// Width in pixels
|
|
|
|
const WIDTH: usize;
|
|
|
|
/// Height in pixels
|
|
|
|
const HEIGHT: usize;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Generic display size of 240x320 pixels
|
|
|
|
pub struct DisplaySize240x320;
|
|
|
|
|
|
|
|
impl DisplaySize for DisplaySize240x320 {
|
|
|
|
const WIDTH: usize = 240;
|
|
|
|
const HEIGHT: usize = 320;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Generic display size of 320x480 pixels
|
|
|
|
pub struct DisplaySize320x480;
|
|
|
|
|
|
|
|
impl DisplaySize for DisplaySize320x480 {
|
|
|
|
const WIDTH: usize = 320;
|
|
|
|
const HEIGHT: usize = 480;
|
|
|
|
}
|
2018-02-24 13:37:17 +00:00
|
|
|
|
2021-07-14 18:32:23 +00:00
|
|
|
/// For quite a few boards (ESP32-S2-Kaluga-1, M5Stack, M5Core2 and others),
|
|
|
|
/// the ILI9341 initialization command arguments are slightly different
|
|
|
|
///
|
|
|
|
/// This trait provides the flexibility for users to define their own
|
|
|
|
/// initialization command arguments suitable for the particular board they are using
|
|
|
|
pub trait Mode {
|
|
|
|
fn mode(&self) -> u8;
|
|
|
|
|
|
|
|
fn is_landscape(&self) -> bool;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// The default implementation of the Mode trait from above
|
|
|
|
/// Should work for most (but not all) boards
|
2018-03-04 14:43:28 +00:00
|
|
|
pub enum Orientation {
|
|
|
|
Portrait,
|
|
|
|
PortraitFlipped,
|
|
|
|
Landscape,
|
|
|
|
LandscapeFlipped,
|
|
|
|
}
|
|
|
|
|
2021-07-14 18:32:23 +00:00
|
|
|
impl Mode for Orientation {
|
|
|
|
fn mode(&self) -> u8 {
|
|
|
|
match self {
|
|
|
|
Self::Portrait => 0x40 | 0x08,
|
|
|
|
Self::Landscape => 0x20 | 0x08,
|
|
|
|
Self::PortraitFlipped => 0x80 | 0x08,
|
|
|
|
Self::LandscapeFlipped => 0x40 | 0x80 | 0x20 | 0x08,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn is_landscape(&self) -> bool {
|
|
|
|
match self {
|
|
|
|
Self::Landscape | Self::LandscapeFlipped => true,
|
|
|
|
Self::Portrait | Self::PortraitFlipped => false,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-21 11:43:06 +00:00
|
|
|
/// Specify state of specific mode of operation
|
|
|
|
pub enum ModeState {
|
|
|
|
On,
|
|
|
|
Off,
|
|
|
|
}
|
|
|
|
|
2018-03-04 17:44:19 +00:00
|
|
|
/// There are two method for drawing to the screen:
|
2021-05-10 23:01:42 +00:00
|
|
|
/// [Ili9341::draw_raw_iter] and [Ili9341::draw_raw_slice]
|
2018-03-04 17:44:19 +00:00
|
|
|
///
|
2018-03-04 17:29:04 +00:00
|
|
|
/// In both cases the expected pixel format is rgb565.
|
2018-03-04 17:44:19 +00:00
|
|
|
///
|
2018-03-04 17:29:04 +00:00
|
|
|
/// The hardware makes it efficient to draw rectangles on the screen.
|
2018-03-04 17:44:19 +00:00
|
|
|
///
|
2018-03-04 17:29:04 +00:00
|
|
|
/// What happens is the following:
|
2018-03-04 17:44:19 +00:00
|
|
|
///
|
2018-03-04 17:29:04 +00:00
|
|
|
/// - A drawing window is prepared (with the 2 opposite corner coordinates)
|
|
|
|
/// - The starting point for drawint is the top left corner of this window
|
|
|
|
/// - Every pair of bytes received is intepreted as a pixel value in rgb565
|
|
|
|
/// - As soon as a pixel is received, an internal counter is incremented,
|
|
|
|
/// and the next word will fill the next pixel (the adjacent on the right, or
|
|
|
|
/// the first of the next row if the row ended)
|
2020-01-28 17:02:35 +00:00
|
|
|
pub struct Ili9341<IFACE, RESET> {
|
|
|
|
interface: IFACE,
|
2018-02-24 13:37:17 +00:00
|
|
|
reset: RESET,
|
|
|
|
width: usize,
|
|
|
|
height: usize,
|
2021-07-14 18:32:23 +00:00
|
|
|
landscape: bool,
|
2018-02-24 13:37:17 +00:00
|
|
|
}
|
|
|
|
|
2021-05-10 22:08:17 +00:00
|
|
|
impl<IFACE, RESET> Ili9341<IFACE, RESET>
|
2020-03-01 14:29:25 +00:00
|
|
|
where
|
2020-06-01 12:30:03 +00:00
|
|
|
IFACE: WriteOnlyDataCommand,
|
2021-05-10 22:08:17 +00:00
|
|
|
RESET: OutputPin,
|
2020-01-28 17:02:35 +00:00
|
|
|
{
|
2021-07-14 18:32:23 +00:00
|
|
|
pub fn new<DELAY, SIZE, MODE>(
|
2020-01-28 17:02:35 +00:00
|
|
|
interface: IFACE,
|
|
|
|
reset: RESET,
|
|
|
|
delay: &mut DELAY,
|
2021-07-14 18:32:23 +00:00
|
|
|
mode: MODE,
|
2020-10-26 12:28:04 +00:00
|
|
|
_display_size: SIZE,
|
2021-05-10 22:15:59 +00:00
|
|
|
) -> Result<Self>
|
2020-10-26 12:28:04 +00:00
|
|
|
where
|
2022-04-16 20:29:50 +00:00
|
|
|
DELAY: DelayUs,
|
2020-10-26 12:28:04 +00:00
|
|
|
SIZE: DisplaySize,
|
2021-07-14 18:32:23 +00:00
|
|
|
MODE: Mode,
|
2020-10-26 12:28:04 +00:00
|
|
|
{
|
2018-02-24 13:37:17 +00:00
|
|
|
let mut ili9341 = Ili9341 {
|
2020-01-28 16:56:12 +00:00
|
|
|
interface,
|
2018-02-24 13:37:17 +00:00
|
|
|
reset,
|
2020-10-26 12:28:04 +00:00
|
|
|
width: SIZE::WIDTH,
|
|
|
|
height: SIZE::HEIGHT,
|
2021-07-14 18:32:23 +00:00
|
|
|
landscape: false,
|
2018-02-24 13:37:17 +00:00
|
|
|
};
|
|
|
|
|
2020-08-28 19:32:16 +00:00
|
|
|
// Do hardware reset by holding reset low for at least 10us
|
2021-05-10 22:08:17 +00:00
|
|
|
ili9341.reset.set_low().map_err(|_| DisplayError::RSError)?;
|
2022-04-16 20:29:50 +00:00
|
|
|
let _ = delay.delay_ms(1);
|
2020-08-28 19:32:16 +00:00
|
|
|
// Set high for normal operation
|
2021-05-10 22:08:17 +00:00
|
|
|
ili9341
|
|
|
|
.reset
|
|
|
|
.set_high()
|
|
|
|
.map_err(|_| DisplayError::RSError)?;
|
2020-08-28 19:32:16 +00:00
|
|
|
|
|
|
|
// Wait 5ms after reset before sending commands
|
|
|
|
// and 120ms before sending Sleep Out
|
2022-04-16 20:29:50 +00:00
|
|
|
let _ = delay.delay_ms(5);
|
2020-08-28 19:32:16 +00:00
|
|
|
|
|
|
|
// Do software reset
|
2018-02-24 13:37:17 +00:00
|
|
|
ili9341.command(Command::SoftwareReset, &[])?;
|
2020-08-28 19:32:16 +00:00
|
|
|
|
|
|
|
// Wait 5ms after reset before sending commands
|
|
|
|
// and 120ms before sending Sleep Out
|
2022-04-16 20:29:50 +00:00
|
|
|
let _ = delay.delay_ms(120);
|
2018-02-24 13:37:17 +00:00
|
|
|
|
2020-10-26 12:28:04 +00:00
|
|
|
ili9341.set_orientation(mode)?;
|
2020-08-28 20:28:31 +00:00
|
|
|
|
2020-08-28 20:26:46 +00:00
|
|
|
// Set pixel format to 16 bits per pixel
|
2018-02-24 13:37:17 +00:00
|
|
|
ili9341.command(Command::PixelFormatSet, &[0x55])?;
|
2020-08-28 19:32:16 +00:00
|
|
|
|
2022-04-21 11:43:06 +00:00
|
|
|
ili9341.sleep_mode(ModeState::Off)?;
|
2020-08-28 19:32:16 +00:00
|
|
|
|
|
|
|
// Wait 5ms after Sleep Out before sending commands
|
2022-04-16 20:29:50 +00:00
|
|
|
let _ = delay.delay_ms(5);
|
2020-08-28 19:32:16 +00:00
|
|
|
|
2022-04-21 11:43:06 +00:00
|
|
|
ili9341.display_mode(ModeState::On)?;
|
2018-02-24 13:37:17 +00:00
|
|
|
|
|
|
|
Ok(ili9341)
|
|
|
|
}
|
2021-05-10 22:25:05 +00:00
|
|
|
}
|
2018-02-24 13:37:17 +00:00
|
|
|
|
2021-05-10 22:25:05 +00:00
|
|
|
impl<IFACE, RESET> Ili9341<IFACE, RESET>
|
|
|
|
where
|
|
|
|
IFACE: WriteOnlyDataCommand,
|
|
|
|
{
|
2021-05-10 22:15:59 +00:00
|
|
|
fn command(&mut self, cmd: Command, args: &[u8]) -> Result {
|
2021-05-10 22:08:17 +00:00
|
|
|
self.interface.send_commands(U8Iter(&mut once(cmd as u8)))?;
|
|
|
|
self.interface.send_data(U8Iter(&mut args.iter().cloned()))
|
2018-02-24 13:37:17 +00:00
|
|
|
}
|
2020-01-28 17:03:35 +00:00
|
|
|
|
2021-05-10 22:15:59 +00:00
|
|
|
fn write_iter<I: IntoIterator<Item = u16>>(&mut self, data: I) -> Result {
|
2020-06-01 12:30:03 +00:00
|
|
|
self.command(Command::MemoryWrite, &[])?;
|
2021-05-10 22:08:17 +00:00
|
|
|
self.interface.send_data(U16BEIter(&mut data.into_iter()))
|
2018-02-24 13:37:17 +00:00
|
|
|
}
|
2020-01-28 17:03:35 +00:00
|
|
|
|
2021-05-10 22:15:59 +00:00
|
|
|
fn set_window(&mut self, x0: u16, y0: u16, x1: u16, y1: u16) -> Result {
|
2018-02-24 13:37:17 +00:00
|
|
|
self.command(
|
|
|
|
Command::ColumnAddressSet,
|
|
|
|
&[
|
|
|
|
(x0 >> 8) as u8,
|
|
|
|
(x0 & 0xff) as u8,
|
|
|
|
(x1 >> 8) as u8,
|
|
|
|
(x1 & 0xff) as u8,
|
|
|
|
],
|
|
|
|
)?;
|
|
|
|
self.command(
|
|
|
|
Command::PageAddressSet,
|
|
|
|
&[
|
|
|
|
(y0 >> 8) as u8,
|
|
|
|
(y0 & 0xff) as u8,
|
|
|
|
(y1 >> 8) as u8,
|
|
|
|
(y1 & 0xff) as u8,
|
|
|
|
],
|
2021-05-10 22:08:17 +00:00
|
|
|
)
|
2018-02-24 13:37:17 +00:00
|
|
|
}
|
2020-01-28 17:03:35 +00:00
|
|
|
|
2020-10-17 07:36:58 +00:00
|
|
|
/// Configures the screen for hardware-accelerated vertical scrolling.
|
|
|
|
pub fn configure_vertical_scroll(
|
|
|
|
&mut self,
|
|
|
|
fixed_top_lines: u16,
|
|
|
|
fixed_bottom_lines: u16,
|
2021-05-10 22:15:59 +00:00
|
|
|
) -> Result<Scroller> {
|
2021-07-14 18:32:23 +00:00
|
|
|
let height = if self.landscape {
|
|
|
|
self.width
|
|
|
|
} else {
|
|
|
|
self.height
|
2020-10-26 12:28:04 +00:00
|
|
|
} as u16;
|
|
|
|
let scroll_lines = height as u16 - fixed_top_lines - fixed_bottom_lines;
|
2020-10-17 07:36:58 +00:00
|
|
|
|
|
|
|
self.command(
|
|
|
|
Command::VerticalScrollDefine,
|
|
|
|
&[
|
|
|
|
(fixed_top_lines >> 8) as u8,
|
|
|
|
(fixed_top_lines & 0xff) as u8,
|
|
|
|
(scroll_lines >> 8) as u8,
|
|
|
|
(scroll_lines & 0xff) as u8,
|
|
|
|
(fixed_bottom_lines >> 8) as u8,
|
|
|
|
(fixed_bottom_lines & 0xff) as u8,
|
|
|
|
],
|
|
|
|
)?;
|
|
|
|
|
2020-10-26 12:28:04 +00:00
|
|
|
Ok(Scroller::new(fixed_top_lines, fixed_bottom_lines, height))
|
2020-10-17 07:36:58 +00:00
|
|
|
}
|
|
|
|
|
2021-05-10 22:15:59 +00:00
|
|
|
pub fn scroll_vertically(&mut self, scroller: &mut Scroller, num_lines: u16) -> Result {
|
2020-10-17 07:36:58 +00:00
|
|
|
scroller.top_offset += num_lines;
|
2020-10-26 12:28:04 +00:00
|
|
|
if scroller.top_offset > (scroller.height - scroller.fixed_bottom_lines) {
|
2020-10-17 07:36:58 +00:00
|
|
|
scroller.top_offset = scroller.fixed_top_lines
|
2021-01-21 12:18:36 +00:00
|
|
|
+ (scroller.top_offset + scroller.fixed_bottom_lines - scroller.height)
|
2020-10-17 07:36:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
self.command(
|
|
|
|
Command::VerticalScrollAddr,
|
|
|
|
&[
|
|
|
|
(scroller.top_offset >> 8) as u8,
|
|
|
|
(scroller.top_offset & 0xff) as u8,
|
|
|
|
],
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2018-03-04 17:29:04 +00:00
|
|
|
/// Draw a rectangle on the screen, represented by top-left corner (x0, y0)
|
2018-03-04 17:44:19 +00:00
|
|
|
/// and bottom-right corner (x1, y1).
|
|
|
|
///
|
|
|
|
/// The border is included.
|
|
|
|
///
|
2018-03-04 17:29:04 +00:00
|
|
|
/// This method accepts an iterator of rgb565 pixel values.
|
2018-03-04 17:44:19 +00:00
|
|
|
///
|
2018-03-04 17:29:04 +00:00
|
|
|
/// The iterator is useful to avoid wasting memory by holding a buffer for
|
|
|
|
/// the whole screen when it is not necessary.
|
2021-05-10 23:01:42 +00:00
|
|
|
pub fn draw_raw_iter<I: IntoIterator<Item = u16>>(
|
2018-06-19 21:30:04 +00:00
|
|
|
&mut self,
|
|
|
|
x0: u16,
|
|
|
|
y0: u16,
|
|
|
|
x1: u16,
|
|
|
|
y1: u16,
|
|
|
|
data: I,
|
2021-05-10 22:15:59 +00:00
|
|
|
) -> Result {
|
2018-02-24 13:37:17 +00:00
|
|
|
self.set_window(x0, y0, x1, y1)?;
|
|
|
|
self.write_iter(data)
|
|
|
|
}
|
2020-01-28 17:03:35 +00:00
|
|
|
|
2018-03-04 17:29:04 +00:00
|
|
|
/// Draw a rectangle on the screen, represented by top-left corner (x0, y0)
|
2018-03-04 17:44:19 +00:00
|
|
|
/// and bottom-right corner (x1, y1).
|
|
|
|
///
|
|
|
|
/// The border is included.
|
|
|
|
///
|
2020-01-28 17:35:30 +00:00
|
|
|
/// This method accepts a raw buffer of words that will be copied to the screen
|
2018-03-04 17:44:19 +00:00
|
|
|
/// video memory.
|
|
|
|
///
|
2020-01-28 17:35:30 +00:00
|
|
|
/// The expected format is rgb565.
|
2021-05-10 23:01:42 +00:00
|
|
|
pub fn draw_raw_slice(&mut self, x0: u16, y0: u16, x1: u16, y1: u16, data: &[u16]) -> Result {
|
|
|
|
self.draw_raw_iter(x0, y0, x1, y1, data.iter().copied())
|
2018-02-24 13:37:17 +00:00
|
|
|
}
|
2020-01-28 17:03:35 +00:00
|
|
|
|
2018-03-04 17:29:04 +00:00
|
|
|
/// Change the orientation of the screen
|
2021-07-14 18:32:23 +00:00
|
|
|
pub fn set_orientation<MODE>(&mut self, mode: MODE) -> Result
|
|
|
|
where
|
|
|
|
MODE: Mode,
|
|
|
|
{
|
|
|
|
self.command(Command::MemoryAccessControl, &[mode.mode()])?;
|
|
|
|
|
|
|
|
if self.landscape ^ mode.is_landscape() {
|
2020-10-26 12:28:04 +00:00
|
|
|
core::mem::swap(&mut self.height, &mut self.width);
|
2018-02-24 13:37:17 +00:00
|
|
|
}
|
2021-07-14 18:32:23 +00:00
|
|
|
self.landscape = mode.is_landscape();
|
2020-10-26 12:28:04 +00:00
|
|
|
Ok(())
|
2018-02-24 13:37:17 +00:00
|
|
|
}
|
2022-04-18 16:46:30 +00:00
|
|
|
|
|
|
|
/// Fill entire screen with specfied color u16 value
|
|
|
|
pub fn clear_screen(&mut self, color: u16) -> Result {
|
|
|
|
let color = core::iter::repeat(color).take(self.width * self.height);
|
|
|
|
self.draw_raw_iter(0, 0, self.width as u16, self.height as u16, color)
|
|
|
|
}
|
2022-04-21 11:43:06 +00:00
|
|
|
|
|
|
|
/// Control the screen sleep mode:
|
|
|
|
pub fn sleep_mode(&mut self, mode: ModeState) -> Result {
|
|
|
|
match mode {
|
|
|
|
ModeState::On => self.command(Command::SleepModeOn, &[]),
|
|
|
|
ModeState::Off => self.command(Command::SleepModeOff, &[]),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Control the screen display mode:
|
|
|
|
pub fn display_mode(&mut self, mode: ModeState) -> Result {
|
|
|
|
match mode {
|
|
|
|
ModeState::On => self.command(Command::DisplayOn, &[]),
|
|
|
|
ModeState::Off => self.command(Command::DisplayOff, &[]),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Invert the pixel color ion screen:
|
|
|
|
pub fn invert_mode(&mut self, mode: ModeState) -> Result {
|
|
|
|
match mode {
|
|
|
|
ModeState::On => self.command(Command::InvertOn, &[]),
|
|
|
|
ModeState::Off => self.command(Command::InvertOff, &[]),
|
|
|
|
}
|
|
|
|
}
|
2021-05-10 22:25:05 +00:00
|
|
|
}
|
2020-01-28 17:03:35 +00:00
|
|
|
|
2021-05-10 22:25:05 +00:00
|
|
|
impl<IFACE, RESET> Ili9341<IFACE, RESET> {
|
2018-03-04 17:29:04 +00:00
|
|
|
/// Get the current screen width. It can change based on the current orientation
|
2018-02-24 13:37:17 +00:00
|
|
|
pub fn width(&self) -> usize {
|
|
|
|
self.width
|
|
|
|
}
|
2020-01-28 17:03:35 +00:00
|
|
|
|
2018-03-04 17:29:04 +00:00
|
|
|
/// Get the current screen heighth. It can change based on the current orientation
|
2018-02-24 13:37:17 +00:00
|
|
|
pub fn height(&self) -> usize {
|
|
|
|
self.height
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-17 07:36:58 +00:00
|
|
|
/// Scroller must be provided in order to scroll the screen. It can only be obtained
|
|
|
|
/// by configuring the screen for scrolling.
|
|
|
|
pub struct Scroller {
|
|
|
|
top_offset: u16,
|
|
|
|
fixed_bottom_lines: u16,
|
|
|
|
fixed_top_lines: u16,
|
2020-10-26 12:28:04 +00:00
|
|
|
height: u16,
|
2020-10-17 07:36:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Scroller {
|
2020-10-26 12:28:04 +00:00
|
|
|
fn new(fixed_top_lines: u16, fixed_bottom_lines: u16, height: u16) -> Scroller {
|
2020-10-17 07:36:58 +00:00
|
|
|
Scroller {
|
|
|
|
top_offset: fixed_top_lines,
|
|
|
|
fixed_top_lines,
|
|
|
|
fixed_bottom_lines,
|
2020-10-26 12:28:04 +00:00
|
|
|
height,
|
2020-10-17 07:36:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-24 13:37:17 +00:00
|
|
|
#[derive(Clone, Copy)]
|
|
|
|
enum Command {
|
|
|
|
SoftwareReset = 0x01,
|
|
|
|
MemoryAccessControl = 0x36,
|
|
|
|
PixelFormatSet = 0x3a,
|
2022-04-21 11:43:06 +00:00
|
|
|
SleepModeOn = 0x10,
|
|
|
|
SleepModeOff = 0x11,
|
|
|
|
InvertOff = 0x20,
|
|
|
|
InvertOn = 0x21,
|
|
|
|
DisplayOff = 0x28,
|
2018-02-24 13:37:17 +00:00
|
|
|
DisplayOn = 0x29,
|
|
|
|
ColumnAddressSet = 0x2a,
|
|
|
|
PageAddressSet = 0x2b,
|
|
|
|
MemoryWrite = 0x2c,
|
2020-10-17 07:36:58 +00:00
|
|
|
VerticalScrollDefine = 0x33,
|
|
|
|
VerticalScrollAddr = 0x37,
|
2018-02-24 13:37:17 +00:00
|
|
|
}
|