fix rebase f****up

This commit is contained in:
2026-08-02 15:45:04 +02:00
committed by rhetenor
parent a93bd8768c
commit 4fe1c6d610
+11 -14
View File
@@ -15,20 +15,13 @@ use base64::{Engine as _, engine::general_purpose};
use display_interface_spi::SPIInterface; use display_interface_spi::SPIInterface;
use embassy_executor::Spawner; use embassy_executor::Spawner;
use embassy_time::Timer; use embassy_time::Timer;
use display_interface_spi::SPIInterface;
use embedded_graphics::{Drawable, geometry::Size, primitives::Rectangle};
use embedded_graphics::Pixel;
use embedded_graphics::mono_font::MonoTextStyle; use embedded_graphics::mono_font::MonoTextStyle;
use embedded_graphics::mono_font::ascii::FONT_6X10; use embedded_graphics::mono_font::ascii::FONT_6X10;
use embedded_graphics::pixelcolor::Rgb565; use embedded_graphics::pixelcolor::Rgb565;
use embedded_graphics::prelude::Point; use embedded_graphics::prelude::Point;
use embedded_graphics::prelude::RgbColor; use embedded_graphics::prelude::RgbColor;
use embedded_graphics::text::Text; use embedded_graphics::text::Text;
use embedded_graphics::{ use embedded_graphics::{Drawable, geometry::Size, primitives::Rectangle};
Drawable,
prelude::*,
primitives::{PrimitiveStyle, Rectangle},
};
use embedded_graphics_core::draw_target::DrawTarget; use embedded_graphics_core::draw_target::DrawTarget;
use embedded_hal_bus::spi::ExclusiveDevice; use embedded_hal_bus::spi::ExclusiveDevice;
use esp_hal::clock::CpuClock; use esp_hal::clock::CpuClock;
@@ -451,11 +444,18 @@ where
let color = palette565[color_index as usize]; let color = palette565[color_index as usize];
let start_x = (x * scale) as i32;
let start_y = (y * scale) as i32;
let end_x = core::cmp::min(start_x + scale as i32, target_width as i32);
let end_y = core::cmp::min(start_y + scale as i32, target_width as i32);
let width = u32::try_from(end_x - start_x).unwrap(); let width = u32::try_from(end_x - start_x).unwrap();
let height = u32::try_from(end_y - start_y).unwrap(); let height = u32::try_from(end_y - start_y).unwrap();
let area = Rectangle::new(Point::new(start_x.try_into().unwrap(), start_y.try_into().unwrap()), Size::new(width, height)); let area = Rectangle::new(
Point::new(start_x.try_into().unwrap(), start_y.try_into().unwrap()),
Size::new(width, height),
);
let _ = ili9341.fill_solid(&area, color); let _ = ili9341.fill_solid(&area, color);
} }
@@ -621,15 +621,12 @@ async fn main(spawner: Spawner) {
esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT); esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT);
esp_rtos::start(timg0.timer0, sw_interrupt.software_interrupt0); esp_rtos::start(timg0.timer0, sw_interrupt.software_interrupt0);
let freq = Rate::from_khz(60_000); let freq = Rate::from_khz(60_000);
info!("Display freq: {freq}"); info!("Display freq: {freq}");
let spi_bus = Spi::new( let spi_bus = Spi::new(
peripherals.SPI2, peripherals.SPI2,
Config::default() Config::default().with_frequency(freq).with_mode(Mode::_0),
.with_frequency(freq)
.with_mode(Mode::_0),
) )
.unwrap() .unwrap()
.with_sck(peripherals.GPIO36) .with_sck(peripherals.GPIO36)