epd_datafuri/lib.rs
1//! Rust driver for Adafruit e-Paper displays (EPD), for use with [embedded-hal].
2//!
3//! ## Supported Displays
4//!
5//! | Display | Controller | Colors | Grayscale |
6//! |---------|-----------|--------|-----------|
7//! | Adafruit ThinkInk 2.9" EAAMFGN (2025 MagTag) | SSD1680 | BW | Gray2 (2-bit, 4-level) |
8//! | Adafruit ThinkInk 2.9" T5 (original MagTag) | IL0373 | BW | Gray2 (2-bit, 4-level) |
9//!
10//! ## Usage
11//!
12//! ### ThinkInk 2.9" — Monochrome (SSD1680)
13//!
14//! ```rust, ignore
15//! use epd_datafuri::displays::adafruit_thinkink_290_mfgn::{ThinkInk2in9Mono, Display2in9Mono};
16//! use epd_datafuri::prelude::*;
17//!
18//! let mut driver = ThinkInk2in9Mono::new(spi, busy, dc, rst)?;
19//! let mut display = Display2in9Mono::new();
20//!
21//! // Draw using embedded-graphics
22//! Text::new("Hello!", Point::new(10, 20), text_style).draw(&mut display)?;
23//!
24//! driver.begin(&mut delay)?;
25//! driver.update_and_display(display.buffer(), &mut delay)?;
26//! ```
27//!
28//! ### ThinkInk 2.9" — Grayscale (SSD1680)
29//!
30//! ```rust, ignore
31//! use epd_datafuri::displays::adafruit_thinkink_290_mfgn::{ThinkInk2in9Gray2, Display2in9Gray2};
32//! use epd_datafuri::prelude::*;
33//! use embedded_graphics::pixelcolor::Gray2;
34//!
35//! let mut driver = ThinkInk2in9Gray2::new(spi, busy, dc, rst)?;
36//! let mut display = Display2in9Gray2::new();
37//!
38//! // Draw using embedded-graphics with 4-level gray
39//! Text::new("Hello!", Point::new(10, 20), text_style).draw(&mut display)?;
40//!
41//! driver.begin(&mut delay)?;
42//! driver.update_gray2_and_display(display.high_buffer(), display.low_buffer(), &mut delay)?;
43//! ```
44//!
45//! ### MagTag 2.9" — Grayscale (IL0373)
46//!
47//! ```rust, ignore
48//! use epd_datafuri::displays::adafruit_thinkink_290_t5::{ThinkInk2in9Gray2, Display2in9Gray2};
49//! use epd_datafuri::prelude::*;
50//! use embedded_graphics::pixelcolor::Gray2;
51//!
52//! let mut driver = ThinkInk2in9Gray2::new(spi, busy, dc, rst)?;
53//! let mut display = Display2in9Gray2::new();
54//!
55//! driver.begin(&mut delay)?;
56//! driver.update_gray2_and_display(display.high_buffer(), display.low_buffer(), &mut delay)?;
57//! ```
58//!
59//! ## Grayscale
60//!
61//! 2-bit, 4-level grayscale (Gray2) is supported for both displays. Each display module
62//! exports its own `Display2in9Gray2` with the correct plane mapping for that controller:
63//!
64//! - [`displays::adafruit_thinkink_290_mfgn::Display2in9Gray2`] for the ThinkInk 2.9" (SSD1680)
65//! - [`displays::adafruit_thinkink_290_t5::Display2in9Gray2`] for the MagTag 2.9" (IL0373)
66//!
67//! ## Notes
68//!
69//! Partial updates are not supported.
70//!
71//! [embedded-hal]: https://crates.io/crates/embedded-hal
72#![no_std]
73#![deny(missing_docs)]
74#![allow(clippy::pedantic)]
75#![allow(clippy::cast_possible_truncation)]
76#![allow(clippy::cast_sign_loss)]
77#![allow(clippy::must_use_candidate)]
78#![allow(clippy::missing_errors_doc)]
79
80pub mod color;
81#[cfg(feature = "graphics")]
82pub mod displays;
83pub mod driver;
84#[cfg(feature = "graphics")]
85pub mod graphics;
86
87pub mod interface;
88
89/// Useful exports
90pub mod prelude {
91 pub use crate::color::Color;
92 pub use crate::driver::EpdDriver;
93
94 #[cfg(feature = "graphics")]
95 pub use crate::graphics::{Display, DisplayRotation};
96}