Improve documentation

digi-v2-tests
Chris 4 years ago
parent 598a6924ea
commit f039b1f6a4

@ -29,8 +29,7 @@ use eink_waveshare_rs::{
epd1in54::EPD1in54,
SPI_MODE,
//drawing_old::{Graphics},
color::Color,
WaveshareDisplay,
prelude::*,
};

@ -1,13 +1,17 @@
//! B/W Color for EPDs
/// Only for the B/W Displays atm
/// Only for the Black/White-Displays
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum Color {
/// Black color
Black,
/// White color
White,
}
//TODO: Rename get_bit_value to bit() and get_byte_value to byte() ?
impl Color {
/// Get the color encoding of the color for one bit
pub fn get_bit_value(&self) -> u8 {
@ -25,7 +29,7 @@ impl Color {
}
}
/// Parses
/// Parses from u8 to Color
fn from_u8(val: u8) -> Self {
match val {
0 => Color::Black,

@ -1,3 +1,5 @@
//! Graphics Support for EPDs
use color::Color;
use embedded_graphics::prelude::*;

@ -48,7 +48,6 @@ extern crate embedded_graphics;
pub mod graphics;
mod traits;
pub use traits::{WaveshareDisplay};
pub mod color;
@ -67,10 +66,18 @@ pub mod epd2in9;
#[cfg(any(feature = "epd1in54", feature = "epd2in9"))]
pub(crate) mod type_a;
/// SPI mode -
/// For more infos see [Requirements: SPI](index.html#spi)
pub mod prelude {
pub use traits::{WaveshareDisplay};
pub use color::Color;
pub use SPI_MODE;
}
extern crate embedded_hal as hal;
use hal::spi::{Mode, Phase, Polarity};
/// SPI mode -
/// For more infos see [Requirements: SPI](index.html#spi)
pub const SPI_MODE: Mode = Mode {
phase: Phase::CaptureOnFirstTransition,
polarity: Polarity::IdleLow,

@ -3,20 +3,15 @@ use hal::{
blocking::{delay::*, spi::Write},
digital::*,
};
use color::Color;
/// All commands need to have this trait which gives the address of the command
/// which needs to be send via SPI with activated CommandsPin (Data/Command Pin in CommandMode)
pub(crate) trait Command {
fn address(self) -> u8;
}
// Trait for using various Waveforms from different LUTs
// E.g. for partial updates
trait LUTSupport<ERR> {
@ -25,7 +20,6 @@ trait LUTSupport<ERR> {
fn set_lut_manual(&mut self, data: &[u8]) -> Result<(), ERR>;
}
pub(crate) trait InternalWiAdditions<SPI, CS, BUSY, DC, RST>
where
SPI: Write<u8>,
@ -48,6 +42,9 @@ where
}
/// All the functions to interact with the EPDs
///
/// This trait includes all public functions to use the EPDS
pub trait WaveshareDisplay<SPI, CS, BUSY, DC, RST>
where
SPI: Write<u8>,
@ -73,6 +70,7 @@ where
/// and initialising which already contains the reset
fn sleep(&mut self, spi: &mut SPI) -> Result<(), SPI::Error>;
/// Wakes the device up from sleep
fn wake_up<DELAY: DelayMs<u8>>(&mut self, spi: &mut SPI, delay: &mut DELAY) -> Result<(), SPI::Error>;

Loading…
Cancel
Save