platform: esp32: drop buggy and slow i2s implementation

This commit is contained in:
Victoria Fischer 2024-12-14 14:41:26 +01:00
parent 3a850105a8
commit a237bb7dc8

View File

@ -39,61 +39,6 @@ use crate::task::FixedSizeScheduler;
use crate::task::Task;
use crate::time::Periodically;
pub mod i2s {
use esp_idf_svc::hal::i2s::*;
use rgb::ComponentBytes;
use rgb::Rgb;
use crate::mappings::*;
use crate::buffers::Pixbuf;
use crate::render::Output;
use crate::render::Sample;
pub struct I2SOutput<'d> {
driver: I2sDriver<'d, I2sTx>,
pixbuf: [Rgb<u8>; 310],
pixmap: StrideMapping,
}
impl<'d> I2SOutput<'d> {
fn new(driver: I2sDriver<'d, I2sTx>) -> Self {
I2SOutput {
driver,
pixbuf: Pixbuf::new(),
pixmap: StrideMapping::new_jar()
}
}
}
impl<'d> Output for I2SOutput<'d> {
fn on_event(&mut self, event: &crate::events::Event) {
}
fn blank(&mut self) {
self.pixbuf.blank();
}
fn commit(&mut self) {
let bytes = self.pixbuf.as_bytes();
let mut written = self.driver.preload_data(bytes).unwrap();
self.driver.tx_enable().unwrap();
while written < bytes.len() {
let next = &bytes[written..];
written += self.driver.write(next, 0).unwrap();
}
self.driver.tx_disable().unwrap();
}
}
impl<'d> Sample for I2SOutput<'d> {
type Pixel = Rgb<u8>;
fn sample(&mut self, rect: &crate::geometry::Rectangle<crate::geometry::Virtual>) -> impl crate::render::PixelView<Pixel = Self::Pixel> {
StrideSampler::new(&mut self.pixbuf, self.pixmap.select(rect))
}
}
}
pub struct Esp32Board {
sys_loop: EspSystemEventLoop,
modem: Option<Modem>,