//! SPI Commands for the Pervasive Displays E2266CS0Cx E-Ink Displays
use crate::traits;

/// E2266CS0Cx commands
///
/// More information can be found in the [specification](https://www.waveshare.com/w/upload/d/d8/2.7inch-e-paper-b-specification.pdf)
#[allow(dead_code)]
#[derive(Copy, Clone)]
#[repr(u8)]
pub(crate) enum Command {
    /// Set Resolution, LUT selection, BWR pixels, gate scan direction, source shift direction, booster switch, soft reset
    PanelSetting = 0x00,

    PowerOff = 0x02,
    PowerOn = 0x04,

    /// This command starts transmitting data and write them into SRAM.
    DataTransmission1 = 0x10,

    /// After this command is issued, driver will refresh display (data/VCOM) according to SRAM data and LUT.
    DisplayRefresh = 0x12,

    /// This command starts transmitting data and write them into SRAM.
    DataTransmission2 = 0x13,

    /// Set the ambient Temperatue
    ///
    InputTemperature = 0xe5,

    /// Activate the set Temperature
    ActiveTemperature = 0xe0,
}

impl traits::Command for Command {
    /// Returns the address of the command
    fn address(self) -> u8 {
        self as u8
    }
}
