-
-
Notifications
You must be signed in to change notification settings - Fork 39
feat: add lilygo t5 e-paper support #180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
103230b
feat: add lilygo-epd47 support
pyaillet 11eee3c
chore: update lilygo-epd47 to 1.0.0 release
pyaillet 78e726f
chore: cargo fmt
pyaillet a42265b
fix(ci): do not import pixelcolor::Gray4 for anything else than lilyg…
pyaillet ab32e26
fix(lilygo_epd47): cleanups from review
pyaillet 4b850fb
feat: test CI
pyaillet 06480c4
fix: fix ci for lilygo-epd47
pyaillet 4c7dad5
chore: remove test ci
pyaillet 3edfbe9
doc(lilygo-epd47): update the README with the lilygo-epd47 example
pyaillet 28abf11
doc(lilygo-epd47): add more details on the example
pyaillet dffecee
fix(doc): fix markdown lint
pyaillet a4325c5
docs: polish the docs
orhun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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,18 @@ | ||
| [target.xtensa-esp32s3-none-elf] | ||
| runner = "espflash flash --monitor --chip esp32s3" | ||
|
|
||
| [env] | ||
| ESP_LOG = "DEBUG" | ||
| ESP_HAL_CONFIG_PSRAM_MODE = "octal" | ||
|
|
||
| [build] | ||
| rustflags = [ | ||
| "-C", "link-arg=-nostartfiles", | ||
| ] | ||
| target = "xtensa-esp32s3-none-elf" | ||
|
|
||
| [unstable] | ||
| build-std = ["core", "alloc"] | ||
|
|
||
| [profile.release] | ||
| debug = true |
This file contains hidden or 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,27 @@ | ||
| [package] | ||
| name = "lilygo-epd47-demo" | ||
| version = "0.1.0" | ||
| edition = "2024" | ||
| rust-version = "1.90" | ||
| publish = false | ||
|
|
||
| [dependencies] | ||
| esp-bootloader-esp-idf = { version = "0.4.0", features = ["esp32s3"] } | ||
| esp-hal = { version = "1.0.0", features = ["esp32s3", "unstable", "psram"] } | ||
|
|
||
| critical-section = "1.2.0" | ||
| esp-alloc = "0.9.0" | ||
| lilygo-epd47 = "1.0.0" | ||
|
|
||
| ratatui = { workspace = true } | ||
| ratatui-core = { workspace = true } | ||
| mousefood = { path = "../../mousefood/", default-features = false, features = ["fonts", "lilygo-epd47"] } | ||
| embedded-graphics = "0.8.2" | ||
|
|
||
| esp-println = { version = "0.16.1", features = ["esp32s3", "log-04"] } | ||
| esp-backtrace = { version = "0.18.1", features = [ | ||
| "esp32s3", | ||
| "panic-handler", | ||
| "println", | ||
| ] } | ||
|
|
This file contains hidden or 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,23 @@ | ||
| # Lilygo T5 e-paper | ||
|
|
||
| This example showcases the use of mouse food on the Lilygo T5 e-paper, in a `no_std` context. | ||
|
|
||
| ## Pinmap | ||
|
|
||
| ![./assets/T5-E-Paper-pin-en.jpg] | ||
|
|
||
| ## Wiring | ||
|
|
||
| No wiring really necessary as all that's required is already on the PCB | ||
|
|
||
| ## Notes | ||
|
|
||
| There are some gotchas regarding the screen refresh. | ||
|
|
||
| The driver either draw black on white or white on black. | ||
| Thus, superposing the updated chars which is not ideal. | ||
|
|
||
| To solve this you need to: | ||
|
|
||
| - Update the `flush_callback` to add a screen clear in it. | ||
| - Add a `terminal.clear()` to force a full redraw from mousefood. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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,3 @@ | ||
| fn main() { | ||
| println!("cargo:rustc-link-arg=-Tlinkall.x"); | ||
| } |
This file contains hidden or 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,2 @@ | ||
| [toolchain] | ||
| channel = "esp" |
This file contains hidden or 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,78 @@ | ||
| #![no_std] | ||
| #![no_main] | ||
|
|
||
| extern crate alloc; | ||
| extern crate lilygo_epd47; | ||
|
|
||
| use alloc::boxed::Box; | ||
|
|
||
| use embedded_graphics::prelude::RgbColor; | ||
|
|
||
| #[allow(unused_imports)] | ||
| use esp_backtrace as _; | ||
| use esp_hal::{delay::Delay, main}; | ||
| use lilygo_epd47::{Display, DrawMode, pin_config}; | ||
|
|
||
| use mousefood::prelude::*; | ||
| use ratatui::style::Stylize; | ||
| use ratatui::widgets::{Block, Paragraph, Wrap}; | ||
| use ratatui::{Frame, Terminal}; | ||
|
|
||
| esp_bootloader_esp_idf::esp_app_desc!(); | ||
|
|
||
| #[main] | ||
| fn main() -> ! { | ||
| esp_println::logger::init_logger_from_env(); | ||
|
|
||
| let config = esp_hal::Config::default(); | ||
| let config = config.with_cpu_clock(esp_hal::clock::CpuClock::_240MHz); | ||
| let peripherals = esp_hal::init(config); | ||
|
|
||
| // Create PSRAM allocator | ||
| esp_alloc::psram_allocator!(peripherals.PSRAM, esp_hal::psram); | ||
|
|
||
| let mut display = Display::new( | ||
| pin_config!(peripherals), | ||
| peripherals.DMA_CH0, | ||
| peripherals.LCD_CAM, | ||
| peripherals.RMT, | ||
| ) | ||
| .expect("to initialize correctly"); | ||
|
|
||
| let delay = Delay::new(); | ||
| display.power_on(); | ||
| delay.delay_millis(10); | ||
| display.clear().expect("to clear display"); | ||
|
|
||
| let theme = ColorTheme { | ||
| background: Rgb888::WHITE, | ||
| foreground: Rgb888::BLACK, | ||
| ..ColorTheme::ansi() | ||
| }; | ||
|
|
||
| // setup mousefood | ||
| let backend = EmbeddedBackendConfig { | ||
| color_theme: theme, | ||
| font_regular: mousefood::fonts::mono_10x20_atlas(), | ||
| flush_callback: Box::new(move |display: &mut Display| { | ||
| display | ||
| .flush(DrawMode::BlackOnWhite) | ||
| .expect("to flush to the display") | ||
| }), | ||
| ..Default::default() | ||
| }; | ||
|
|
||
| let backend = EmbeddedBackend::new(&mut display, backend); | ||
| let mut terminal = Terminal::new(backend).unwrap(); | ||
| terminal.draw(draw).unwrap(); | ||
|
|
||
| #[allow(clippy::empty_loop)] | ||
| loop {} | ||
orhun marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| fn draw(frame: &mut Frame) { | ||
| let text = "Ratatui on embedded devices!"; | ||
| let paragraph = Paragraph::new(text.black()).wrap(Wrap { trim: true }); | ||
| let bordered_block = Block::bordered().title("Mousefood"); | ||
| frame.render_widget(paragraph.block(bordered_block), frame.area()); | ||
| } | ||
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.