Skip to content

Commit

Permalink
examples: hub75_i8080: fix for DMA changes
Browse files Browse the repository at this point in the history
  • Loading branch information
liebman committed Jul 6, 2024
1 parent d72a4c4 commit 34b78b8
Showing 1 changed file with 13 additions and 25 deletions.
38 changes: 13 additions & 25 deletions examples/src/bin/hub75_i8080.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,21 +280,15 @@ async fn display_task() {
const STEP: u8 = (256 / MATRIX_COLS) as u8;
for x in 0..MATRIX_COLS {
let brightness = (x as u8) * STEP;
fb.set_pixel(Point::new(x as i32, 0), Color::new(brightness, 0, 0));
fb.set_pixel(Point::new(x as i32, 1), Color::new(brightness, 0, 0));
fb.set_pixel(Point::new(x as i32, 2), Color::new(brightness, 0, 0));
fb.set_pixel(Point::new(x as i32, 3), Color::new(brightness, 0, 0));
fb.set_pixel(Point::new(x as i32, 4), Color::new(brightness, 0, 0));
fb.set_pixel(Point::new(x as i32, 5), Color::new(0, brightness, 0));
fb.set_pixel(Point::new(x as i32, 6), Color::new(0, brightness, 0));
fb.set_pixel(Point::new(x as i32, 7), Color::new(0, brightness, 0));
fb.set_pixel(Point::new(x as i32, 8), Color::new(0, brightness, 0));
fb.set_pixel(Point::new(x as i32, 9), Color::new(0, brightness, 0));
fb.set_pixel(Point::new(x as i32, 10), Color::new(0, 0, brightness));
fb.set_pixel(Point::new(x as i32, 11), Color::new(0, 0, brightness));
fb.set_pixel(Point::new(x as i32, 12), Color::new(0, 0, brightness));
fb.set_pixel(Point::new(x as i32, 13), Color::new(0, 0, brightness));
fb.set_pixel(Point::new(x as i32, 14), Color::new(0, 0, brightness));
for y in 0..8 {
fb.set_pixel(Point::new(x as i32, y), Color::new(brightness, 0, 0));
}
for y in 8..16 {
fb.set_pixel(Point::new(x as i32, y), Color::new(0, brightness, 0));
}
for y in 16..24 {
fb.set_pixel(Point::new(x as i32, y), Color::new(0, 0, brightness));
}
}

let fps_style = MonoTextStyleBuilder::new()
Expand Down Expand Up @@ -375,16 +369,9 @@ struct DisplayPeripherals {
#[task]
async fn hub75_task(paripherals: DisplayPeripherals, clocks: Clocks<'static>) {
let channel: esp_hal::dma::ChannelCreator<0> = paripherals.dma_channel;
let mut tx_descriptors =
[esp_hal::dma::DmaDescriptor::EMPTY; (DMA_BUFFER_SIZE * 2 + 4091) / 4092];
let mut rx_descriptors = [esp_hal::dma::DmaDescriptor::EMPTY; 0];

let channel = channel.configure(
false,
&mut tx_descriptors,
&mut rx_descriptors,
DmaPriority::Priority0,
);
let (tx_descriptors, _) = esp_hal::dma_descriptors!(DMA_BUFFER_SIZE * 2, 0);

let channel = channel.configure(false, DmaPriority::Priority0);
let pins = TxSixteenBits::new(
paripherals.addr0,
paripherals.addr1,
Expand All @@ -409,6 +396,7 @@ async fn hub75_task(paripherals: DisplayPeripherals, clocks: Clocks<'static>) {
let mut i8080 = I8080::new(
lcd_cam.lcd,
channel.tx,
tx_descriptors,
pins,
40.MHz(),
i8080::Config::default(),
Expand Down

0 comments on commit 34b78b8

Please sign in to comment.