Hi,
like to have output on the display of a esp32-2432s028r 2,8" Touch TFT 240x320
somebody here can tell me how
example code I found did not get compiled
thanks
esp32-2432s028r - how to get Display to work ?
Re: esp32-2432s028r - how to get Display to work ?
Helo, which code are you trying to compile and what error message are you seeing?
Re: esp32-2432s028r - how to get Display to work ?
@bidrohini
thanks for your help!
using: Debian 12 on x86_64
here is what I tryed
$ sudo apt install python3-virtualenv
$ rustup toolchain install nightly --component rust-src
$ cargo install cargo-generate
$ cargo install ldproxy
$ cargo install espflash
$ cargo install cargo-espflash
$ cargo generate --git https://github.com/esp-rs/esp-idf-template cargo
$ cd espdisplay
$ cargo add ili9341
$ cargo add embedded-graphics
$ espup install
$ . ~/export-esp.sh
$ caro clean
$ rm -rf .embuild
$ cargo build
src/main.rs
source from: https://crates.io/crates/embedded-graphics
https://docs.rs/ili9341/latest/ili9341/
------
Error:
thanks for your help!
using: Debian 12 on x86_64
here is what I tryed
$ sudo apt install python3-virtualenv
$ rustup toolchain install nightly --component rust-src
$ cargo install cargo-generate
$ cargo install ldproxy
$ cargo install espflash
$ cargo install cargo-espflash
$ cargo generate --git https://github.com/esp-rs/esp-idf-template cargo
$ cd espdisplay
$ cargo add ili9341
$ cargo add embedded-graphics
$ espup install
$ . ~/export-esp.sh
$ caro clean
$ rm -rf .embuild
$ cargo build
src/main.rs
Code: Select all
use ili9341;
use embedded_graphics::{
mono_font::{ascii::FONT_6X10, MonoTextStyle},
pixelcolor::BinaryColor,
prelude::*,
primitives::{
Circle, PrimitiveStyle, PrimitiveStyleBuilder, Rectangle, StrokeAlignment, Triangle,
},
text::{Alignment, Text},
};
fn main() -> Result<(), std::convert::Infallible> {
// Create a new mock display
let mut display: ili9341::DisplaySize240x320;
// Create styles used by the drawing operations.
let thin_stroke = PrimitiveStyle::with_stroke(BinaryColor::On, 1);
let thick_stroke = PrimitiveStyle::with_stroke(BinaryColor::On, 3);
let border_stroke = PrimitiveStyleBuilder::new()
.stroke_color(BinaryColor::On)
.stroke_width(3)
.stroke_alignment(StrokeAlignment::Inside)
.build();
let fill = PrimitiveStyle::with_fill(BinaryColor::On);
let character_style = MonoTextStyle::new(&FONT_6X10, BinaryColor::On);
let yoffset = 10;
// Draw a 3px wide outline around the display.
display
.bounding_box()
.into_styled(border_stroke)
.draw(&mut display)?;
// Draw a triangle.
Triangle::new(
Point::new(16, 16 + yoffset),
Point::new(16 + 16, 16 + yoffset),
Point::new(16 + 8, yoffset),
)
.into_styled(thin_stroke)
.draw(&mut display)?;
// Draw a filled square
Rectangle::new(Point::new(52, yoffset), Size::new(16, 16))
.into_styled(fill)
.draw(&mut display)?;
// Draw a circle with a 3px wide stroke.
Circle::new(Point::new(88, yoffset), 17)
.into_styled(thick_stroke)
.draw(&mut display)?;
// Draw centered text.
let text = "embedded-graphics";
Text::with_alignment(
text,
display.bounding_box().center() + Point::new(0, 15),
character_style,
Alignment::Center,
)
.draw(&mut display)?;
Ok(())
}
https://docs.rs/ili9341/latest/ili9341/
------
Error:
Code: Select all
Compiling embedded-svc v0.25.3
error[E0599]: the method `bounding_box` exists for struct `DisplaySize240x320`, but its trait bounds were not satisfied
--> src/main.rs:33:10
|
32 | / display
33 | | .bounding_box()
| | -^^^^^^^^^^^^ method cannot be called on `DisplaySize240x320` due to unsatisfied trait bounds
| |_________|
|
|
::: /home/developer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ili9341-0.5.0/src/lib.rs:28:1
|
28 | pub struct DisplaySize240x320;
| -----------------------------
| |
| doesn't satisfy `DisplaySize240x320: OriginDimensions`
| doesn't satisfy `_: Dimensions`
|
= note: the following trait bounds were not satisfied:
`DisplaySize240x320: OriginDimensions`
which is required by `DisplaySize240x320: embedded_graphics::geometry::Dimensions`
error[E0277]: the trait bound `DisplaySize240x320: DrawTarget` is not satisfied
--> src/main.rs:44:11
|
44 | .draw(&mut display)?;
| ---- ^^^^^^^^^^^^ the trait `DrawTarget` is not implemented for `DisplaySize240x320`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `DrawTarget`:
mono_font::draw_target::MonoFontDrawTarget<'_, T, mono_font::draw_target::Foreground<<T as DrawTarget>::Color>>
mono_font::draw_target::MonoFontDrawTarget<'_, T, mono_font::draw_target::Background<<T as DrawTarget>::Color>>
mono_font::draw_target::MonoFontDrawTarget<'_, T, mono_font::draw_target::Both<<T as DrawTarget>::Color>>
Clipped<'_, T>
ColorConverted<'_, T, C>
Cropped<'_, T>
embedded_graphics::draw_target::Translated<'_, T>
Framebuffer<C, RawU1, BO, WIDTH, HEIGHT, N>
and 10 others
note: required by a bound in `embedded_graphics::Drawable::draw`
--> /home/developer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embedded-graphics-core-0.4.0/src/drawable.rs:106:12
|
104 | fn draw<D>(&self, target: &mut D) -> Result<Self::Output, D::Error>
| ---- required by a bound in this associated function
105 | where
106 | D: DrawTarget<Color = Self::Color>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Drawable::draw`
error[E0277]: the trait bound `DisplaySize240x320: DrawTarget` is not satisfied
--> src/main.rs:49:15
|
49 | .draw(&mut display)?;
| ---- ^^^^^^^^^^^^ the trait `DrawTarget` is not implemented for `DisplaySize240x320`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `DrawTarget`:
mono_font::draw_target::MonoFontDrawTarget<'_, T, mono_font::draw_target::Foreground<<T as DrawTarget>::Color>>
mono_font::draw_target::MonoFontDrawTarget<'_, T, mono_font::draw_target::Background<<T as DrawTarget>::Color>>
mono_font::draw_target::MonoFontDrawTarget<'_, T, mono_font::draw_target::Both<<T as DrawTarget>::Color>>
Clipped<'_, T>
ColorConverted<'_, T, C>
Cropped<'_, T>
embedded_graphics::draw_target::Translated<'_, T>
Framebuffer<C, RawU1, BO, WIDTH, HEIGHT, N>
and 10 others
note: required by a bound in `embedded_graphics::Drawable::draw`
--> /home/developer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embedded-graphics-core-0.4.0/src/drawable.rs:106:12
|
104 | fn draw<D>(&self, target: &mut D) -> Result<Self::Output, D::Error>
| ---- required by a bound in this associated function
105 | where
106 | D: DrawTarget<Color = Self::Color>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Drawable::draw`
error[E0277]: the trait bound `DisplaySize240x320: DrawTarget` is not satisfied
--> src/main.rs:54:15
|
54 | .draw(&mut display)?;
| ---- ^^^^^^^^^^^^ the trait `DrawTarget` is not implemented for `DisplaySize240x320`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `DrawTarget`:
mono_font::draw_target::MonoFontDrawTarget<'_, T, mono_font::draw_target::Foreground<<T as DrawTarget>::Color>>
mono_font::draw_target::MonoFontDrawTarget<'_, T, mono_font::draw_target::Background<<T as DrawTarget>::Color>>
mono_font::draw_target::MonoFontDrawTarget<'_, T, mono_font::draw_target::Both<<T as DrawTarget>::Color>>
Clipped<'_, T>
ColorConverted<'_, T, C>
Cropped<'_, T>
embedded_graphics::draw_target::Translated<'_, T>
Framebuffer<C, RawU1, BO, WIDTH, HEIGHT, N>
and 10 others
note: required by a bound in `embedded_graphics::Drawable::draw`
--> /home/developer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embedded-graphics-core-0.4.0/src/drawable.rs:106:12
|
104 | fn draw<D>(&self, target: &mut D) -> Result<Self::Output, D::Error>
| ---- required by a bound in this associated function
105 | where
106 | D: DrawTarget<Color = Self::Color>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Drawable::draw`
error[E0599]: the method `bounding_box` exists for struct `DisplaySize240x320`, but its trait bounds were not satisfied
--> src/main.rs:60:17
|
60 | display.bounding_box().center() + Point::new(0, 15),
| ^^^^^^^^^^^^ method cannot be called on `DisplaySize240x320` due to unsatisfied trait bounds
|
::: /home/developer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ili9341-0.5.0/src/lib.rs:28:1
|
28 | pub struct DisplaySize240x320;
| -----------------------------
| |
| doesn't satisfy `DisplaySize240x320: OriginDimensions`
| doesn't satisfy `_: Dimensions`
|
= note: the following trait bounds were not satisfied:
`DisplaySize240x320: OriginDimensions`
which is required by `DisplaySize240x320: embedded_graphics::geometry::Dimensions`
error[E0277]: the trait bound `DisplaySize240x320: DrawTarget` is not satisfied
--> src/main.rs:64:11
|
64 | .draw(&mut display)?;
| ---- ^^^^^^^^^^^^ the trait `DrawTarget` is not implemented for `DisplaySize240x320`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `DrawTarget`:
mono_font::draw_target::MonoFontDrawTarget<'_, T, mono_font::draw_target::Foreground<<T as DrawTarget>::Color>>
mono_font::draw_target::MonoFontDrawTarget<'_, T, mono_font::draw_target::Background<<T as DrawTarget>::Color>>
mono_font::draw_target::MonoFontDrawTarget<'_, T, mono_font::draw_target::Both<<T as DrawTarget>::Color>>
Clipped<'_, T>
ColorConverted<'_, T, C>
Cropped<'_, T>
embedded_graphics::draw_target::Translated<'_, T>
Framebuffer<C, RawU1, BO, WIDTH, HEIGHT, N>
and 10 others
note: required by a bound in `embedded_graphics::Drawable::draw`
--> /home/developer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embedded-graphics-core-0.4.0/src/drawable.rs:106:12
|
104 | fn draw<D>(&self, target: &mut D) -> Result<Self::Output, D::Error>
| ---- required by a bound in this associated function
105 | where
106 | D: DrawTarget<Color = Self::Color>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Drawable::draw`
Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `espdisplay` (bin "espdisplay") due to 6 previous errors
Who is online
Users browsing this forum: No registered users and 6 guests