-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
854 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//! SPI Commands for the Waveshare 12.48"(B) V2 Ink Display | ||
use crate::traits; | ||
|
||
/// Epd12in48 commands | ||
/// | ||
#[allow(unused, non_camel_case_types)] | ||
#[derive(Clone, Copy)] | ||
pub enum Command { | ||
PanelSetting = 0x00, | ||
PowerOff = 0x02, | ||
PowerOn = 0x04, | ||
BoosterSoftStart = 0x06, | ||
DeepSleep = 0x07, | ||
DataStartTransmission1 = 0x10, | ||
DisplayRefresh = 0x12, | ||
DataStartTransmission2 = 0x13, | ||
DualSPI = 0x15, | ||
LUTC = 0x20, | ||
LUTWW = 0x21, | ||
LUTKW_LUTR = 0x22, | ||
LUTWK_LUTW = 0x23, | ||
LUTKK_LUTK = 0x24, | ||
LUTBD = 0x25, | ||
KWLUTOption = 0x2B, | ||
VcomAndDataIntervalSetting = 0x50, | ||
TconSetting = 0x60, | ||
TconResolution = 0x61, | ||
GetStatus = 0x71, | ||
PartialWindow = 0x90, | ||
PartialIn = 0x91, | ||
PartialOut = 0x92, | ||
CascadeSetting = 0xE0, | ||
PowerSaving = 0xE3, | ||
ForceTemperature = 0xE5, | ||
} | ||
|
||
impl traits::Command for Command { | ||
/// Returns the address of the command | ||
fn address(self) -> u8 { | ||
self as u8 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#[derive(Copy, Clone, Debug)] | ||
/// EPD Configuration | ||
pub struct Config { | ||
/// Specifies how data1 bits are mapped to colors: | ||
/// - `false`: 0 => black, 1 => white | ||
/// - `true`: 0 => white, 1 => black | ||
pub inverted_kw: bool, | ||
/// Specifies how data2 bits are mapped to colors: | ||
/// - `false`: 0 => red not active, 1 => red active | ||
/// - `true`: 0 => red active, 1 => red not active | ||
/// | ||
/// Note that whenever the red channel is active, the black/white channel is ignored. | ||
pub inverted_r: bool, | ||
/// Lookup table to use for the screen border | ||
pub border_lut: BorderLUT, | ||
/// Whether to use the lookup tables loaded via `set_lut...` methods, or the built-in ones. | ||
pub external_lut: bool, | ||
} | ||
|
||
impl Default for Config { | ||
fn default() -> Self { | ||
Self { | ||
inverted_kw: false, | ||
inverted_r: false, | ||
border_lut: BorderLUT::LUTBD, | ||
external_lut: false, | ||
} | ||
} | ||
} | ||
|
||
/// Screen border lookup table variants | ||
#[derive(Copy, Clone, Debug)] | ||
pub enum BorderLUT { | ||
/// Use LUTBD | ||
LUTBD, | ||
/// Use LUTK | ||
LUTK, | ||
/// Use LUTW | ||
LUTW, | ||
/// Use LUTR | ||
LUTR, | ||
} |
Oops, something went wrong.