Renaming of WaveshareInterface and Connectioninterface
WaveshareInterface -> WaveshareDisplay traits::interface::ConnectionInterface -> interface::DisplayInterfaceembedded-hal-1.0
parent
0363e8527f
commit
89489da657
|
|
@ -33,15 +33,15 @@ use type_a::{command::Command, LUT_FULL_UPDATE, LUT_PARTIAL_UPDATE};
|
|||
|
||||
use color::Color;
|
||||
|
||||
use traits::{WaveshareInterface};
|
||||
use traits::{WaveshareDisplay};
|
||||
|
||||
use traits::connection_interface::ConnectionInterface;
|
||||
use interface::DisplayInterface;
|
||||
|
||||
/// EPD1in54 driver
|
||||
///
|
||||
pub struct EPD1in54<SPI, CS, BUSY, DC, RST> {
|
||||
/// SPI
|
||||
interface: ConnectionInterface<SPI, CS, BUSY, DC, RST>,
|
||||
interface: DisplayInterface<SPI, CS, BUSY, DC, RST>,
|
||||
/// EPD (width, height)
|
||||
//epd: EPD,
|
||||
/// Color
|
||||
|
|
@ -95,7 +95,7 @@ where
|
|||
|
||||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST, E> WaveshareInterface<SPI, CS, BUSY, DC, RST>
|
||||
impl<SPI, CS, BUSY, DC, RST, E> WaveshareDisplay<SPI, CS, BUSY, DC, RST>
|
||||
for EPD1in54<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8, Error = E>,
|
||||
|
|
@ -115,7 +115,7 @@ where
|
|||
fn new<DELAY: DelayMs<u8>>(
|
||||
spi: &mut SPI, cs: CS, busy: BUSY, dc: DC, rst: RST, delay: &mut DELAY,
|
||||
) -> Result<Self, SPI::Error> {
|
||||
let interface = ConnectionInterface::new(cs, busy, dc, rst);
|
||||
let interface = DisplayInterface::new(cs, busy, dc, rst);
|
||||
|
||||
let mut epd = EPD1in54 {
|
||||
interface,
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@ use color::Color;
|
|||
|
||||
use traits::*;
|
||||
|
||||
use traits::connection_interface::ConnectionInterface;
|
||||
use interface::DisplayInterface;
|
||||
|
||||
/// EPD2in9 driver
|
||||
///
|
||||
pub struct EPD2in9<SPI, CS, BUSY, DC, RST> {
|
||||
/// SPI
|
||||
interface: ConnectionInterface<SPI, CS, BUSY, DC, RST>,
|
||||
interface: DisplayInterface<SPI, CS, BUSY, DC, RST>,
|
||||
/// EPD (width, height)
|
||||
//epd: EPD,
|
||||
/// Color
|
||||
|
|
@ -90,7 +90,7 @@ where
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST>
|
||||
WaveshareInterface<SPI, CS, BUSY, DC, RST>
|
||||
WaveshareDisplay<SPI, CS, BUSY, DC, RST>
|
||||
for EPD2in9<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
|
|
@ -110,7 +110,7 @@ where
|
|||
fn new<DELAY: DelayMs<u8>>(
|
||||
spi: &mut SPI, cs: CS, busy: BUSY, dc: DC, rst: RST, delay: &mut DELAY,
|
||||
) -> Result<Self, SPI::Error> {
|
||||
let interface = ConnectionInterface::new(cs, busy, dc, rst);
|
||||
let interface = DisplayInterface::new(cs, busy, dc, rst);
|
||||
|
||||
let mut epd = EPD2in9 {
|
||||
interface,
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ use hal::{
|
|||
digital::*,
|
||||
};
|
||||
|
||||
use traits::{connection_interface::ConnectionInterface, WaveshareInterface, InternalWiAdditions};
|
||||
use traits::{WaveshareDisplay, InternalWiAdditions};
|
||||
use interface::DisplayInterface;
|
||||
|
||||
//The Lookup Tables for the Display
|
||||
mod constants;
|
||||
|
|
@ -66,7 +67,7 @@ use self::command::Command;
|
|||
///
|
||||
pub struct EPD4in2<SPI, CS, BUSY, DC, RST> {
|
||||
/// Connection Interface
|
||||
interface: ConnectionInterface<SPI, CS, BUSY, DC, RST>,
|
||||
interface: DisplayInterface<SPI, CS, BUSY, DC, RST>,
|
||||
/// Background Color
|
||||
color: Color,
|
||||
}
|
||||
|
|
@ -114,7 +115,7 @@ where
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST>
|
||||
WaveshareInterface<SPI, CS, BUSY, DC, RST>
|
||||
WaveshareDisplay<SPI, CS, BUSY, DC, RST>
|
||||
for EPD4in2<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
|
|
@ -139,7 +140,7 @@ where
|
|||
/// epd4in2.sleep();
|
||||
/// ```
|
||||
fn new<DELAY: DelayMs<u8>>(spi: &mut SPI, cs: CS, busy: BUSY, dc: DC, rst: RST, delay: &mut DELAY) -> Result<Self, SPI::Error> {
|
||||
let interface = ConnectionInterface::new(cs, busy, dc, rst);
|
||||
let interface = DisplayInterface::new(cs, busy, dc, rst);
|
||||
let color = DEFAULT_BACKGROUND_COLOR;
|
||||
|
||||
let mut epd = EPD4in2 {
|
||||
|
|
|
|||
|
|
@ -2,14 +2,12 @@ use hal::{
|
|||
blocking::{delay::*, spi::Write},
|
||||
digital::*,
|
||||
};
|
||||
|
||||
use core::marker::PhantomData;
|
||||
|
||||
use traits::Command;
|
||||
|
||||
/// The Connection Interface of all (?) Waveshare EPD-Devices
|
||||
///
|
||||
pub(crate) struct ConnectionInterface<SPI, CS, BUSY, DC, RST> {
|
||||
pub(crate) struct DisplayInterface<SPI, CS, BUSY, DC, RST> {
|
||||
/// SPI
|
||||
_spi: PhantomData<SPI>,
|
||||
/// CS for SPI
|
||||
|
|
@ -23,7 +21,7 @@ pub(crate) struct ConnectionInterface<SPI, CS, BUSY, DC, RST> {
|
|||
}
|
||||
|
||||
impl<SPI, CS, BUSY, DC, RST>
|
||||
ConnectionInterface<SPI, CS, BUSY, DC, RST>
|
||||
DisplayInterface<SPI, CS, BUSY, DC, RST>
|
||||
where
|
||||
SPI: Write<u8>,
|
||||
CS: OutputPin,
|
||||
|
|
@ -32,7 +30,7 @@ where
|
|||
RST: OutputPin,
|
||||
{
|
||||
pub fn new(cs: CS, busy: BUSY, dc: DC, rst: RST) -> Self {
|
||||
ConnectionInterface {
|
||||
DisplayInterface {
|
||||
_spi: PhantomData::default(),
|
||||
cs,
|
||||
busy,
|
||||
|
|
@ -43,7 +41,7 @@ where
|
|||
|
||||
/// Basic function for sending [Commands](Command).
|
||||
///
|
||||
/// Enables direct interaction with the device with the help of [data()](ConnectionInterface::data())
|
||||
/// Enables direct interaction with the device with the help of [data()](DisplayInterface::data())
|
||||
///
|
||||
/// //TODO: make public?
|
||||
pub(crate) fn cmd<T: Command>(&mut self, spi: &mut SPI, command: T) -> Result<(), SPI::Error> {
|
||||
|
|
@ -70,6 +68,7 @@ where
|
|||
/// Basic function for sending [Commands](Command) and the data belonging to it.
|
||||
///
|
||||
/// //TODO: make public?
|
||||
/// TODO: directly use ::write? cs wouldn't needed to be changed twice than
|
||||
pub(crate) fn cmd_with_data<T: Command>(&mut self, spi: &mut SPI, command: T, data: &[u8]) -> Result<(), SPI::Error> {
|
||||
self.cmd(spi, command)?;
|
||||
self.data(spi, data)
|
||||
|
|
@ -51,10 +51,13 @@ use hal::spi::{Mode, Phase, Polarity};
|
|||
pub mod drawing;
|
||||
|
||||
mod traits;
|
||||
pub use traits::{WaveshareInterface};
|
||||
pub use traits::{WaveshareDisplay};
|
||||
|
||||
pub mod color;
|
||||
|
||||
/// Interface for the physical connection between display and the controlling device
|
||||
mod interface;
|
||||
|
||||
#[cfg(feature = "epd4in2")]
|
||||
mod epd4in2;
|
||||
#[cfg(feature = "epd4in2")]
|
||||
|
|
|
|||
Loading…
Reference in New Issue