mirror of
https://github.com/LegitCamper/picocalc-os-rs.git
synced 2025-12-27 07:45:28 +00:00
yield display to audio
This commit is contained in:
@@ -1,17 +1,15 @@
|
|||||||
use crate::framebuffer::{self, AtomicFrameBuffer, FB_PAUSED};
|
use crate::framebuffer::{self, AtomicFrameBuffer, FB_PAUSED};
|
||||||
use core::alloc::{GlobalAlloc, Layout};
|
use core::alloc::{GlobalAlloc, Layout};
|
||||||
use core::sync::atomic::Ordering;
|
use core::sync::atomic::Ordering;
|
||||||
|
use embassy_futures::yield_now;
|
||||||
use embassy_rp::{
|
use embassy_rp::{
|
||||||
Peri,
|
Peri,
|
||||||
gpio::{Level, Output},
|
gpio::{Level, Output},
|
||||||
peripherals::{PIN_13, PIN_14, PIN_15, SPI1},
|
peripherals::{PIN_13, PIN_14, PIN_15, SPI1},
|
||||||
spi::{Async, Spi},
|
spi::{Async, Spi},
|
||||||
};
|
};
|
||||||
use embassy_time::{Delay, Timer};
|
use embassy_time::Delay;
|
||||||
use embedded_graphics::{
|
use embedded_graphics::{draw_target::DrawTarget, pixelcolor::Rgb565, prelude::RgbColor};
|
||||||
pixelcolor::Rgb565,
|
|
||||||
prelude::{DrawTarget, RgbColor},
|
|
||||||
};
|
|
||||||
use embedded_hal_bus::spi::ExclusiveDevice;
|
use embedded_hal_bus::spi::ExclusiveDevice;
|
||||||
use st7365p_lcd::ST7365P;
|
use st7365p_lcd::ST7365P;
|
||||||
|
|
||||||
@@ -117,7 +115,7 @@ pub async fn display_handler(mut display: DISPLAY) {
|
|||||||
if elapsed < FRAME_TIME_MS {
|
if elapsed < FRAME_TIME_MS {
|
||||||
Timer::after_millis(FRAME_TIME_MS - elapsed).await;
|
Timer::after_millis(FRAME_TIME_MS - elapsed).await;
|
||||||
} else {
|
} else {
|
||||||
Timer::after_millis(1).await;
|
yield_now().await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user