Skip to content

Commit 750babc

Browse files
committed
Clippy fixes
1 parent 7a4bc1b commit 750babc

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/vga/mod.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ impl VideoEngine {
391391
// Convert from eight mono pixels in one byte to four RGB pairs
392392
unsafe {
393393
core::ptr::write_volatile(
394-
scan_line_buffer_ptr.offset(px_idx + 0),
394+
scan_line_buffer_ptr.offset(px_idx),
395395
self.lookup[(mono_pixels >> 6) & 3],
396396
);
397397
core::ptr::write_volatile(
@@ -404,7 +404,7 @@ impl VideoEngine {
404404
);
405405
core::ptr::write_volatile(
406406
scan_line_buffer_ptr.offset(px_idx + 3),
407-
self.lookup[(mono_pixels >> 0) & 3],
407+
self.lookup[mono_pixels & 3],
408408
);
409409
}
410410
px_idx += 4;
@@ -416,6 +416,12 @@ impl VideoEngine {
416416
}
417417
}
418418

419+
impl Default for VideoEngine {
420+
fn default() -> Self {
421+
VideoEngine::new()
422+
}
423+
}
424+
419425
/// Initialise all the static data and peripherals we need for our video display.
420426
///
421427
/// We need to keep `pio` and `dma` to run the video. We need `resets` to set
@@ -634,6 +640,10 @@ pub fn init(pio: super::pac::PIO0, dma: super::pac::DMA, resets: &mut super::pac
634640
///
635641
/// We use this as a prompt to either start a transfer or more Timing words,
636642
/// or a transfer or more pixel words.
643+
///
644+
/// # Safety
645+
///
646+
/// Only call this from the DMA IRQ handler.
637647
pub unsafe fn irq() {
638648
let dma: &mut super::pac::DMA = match DMA_PERIPH.as_mut() {
639649
Some(dma) => dma,

0 commit comments

Comments
 (0)