cleanup unused code and make ifram mappings extremely clear

This commit is contained in:
bunnie 2025-10-01 14:57:10 +08:00
parent f8c92c4c23
commit 1d9c8e8121
2 changed files with 1 additions and 49 deletions

View file

@ -39,7 +39,7 @@ impl Uart {
}); });
} else { } else {
let buf: [u8; 1] = [c]; let buf: [u8; 1] = [c];
let uart_buf_addr = crate::platform::UART_IFRAM_ADDR; let uart_buf_addr = bao1x_hal::board::UART_DMA_TX_BUF_PHYS;
let mut udma_uart = unsafe { let mut udma_uart = unsafe {
// safety: this is safe to call, because we set up clock and events prior to calling new. // safety: this is safe to call, because we set up clock and events prior to calling new.
udma::Uart::get_handle( udma::Uart::get_handle(

View file

@ -93,51 +93,3 @@ pub fn msg<'a>(fb: &mut dyn FrameBuffer, text: &'a str, ll_pos: Point, fg: Color
} }
ll_pos.x += x_update; ll_pos.x += x_update;
} }
pub fn line(fb: &mut dyn FrameBuffer, l: Line, clip: Option<Rectangle>, xor: bool) {
let color: ColorNative;
if l.style.stroke_color.is_some() {
color = l.style.stroke_color.unwrap().into();
} else {
return;
}
let mut x0 = l.start.x;
let mut y0 = l.start.y;
let x1 = l.end.x;
let y1 = l.end.y;
let dx = (x1 - x0).abs();
let sx = if x0 < x1 { 1 } else { -1 };
let dy = -((y1 - y0).abs());
let sy = if y0 < y1 { 1 } else { -1 };
let mut err = dx + dy; // error value e_xy
loop {
if x0 >= 0 && y0 >= 0 && x0 < (fb.dimensions().x as _) && y0 < (fb.dimensions().y as _) {
if clip.is_none() || (clip.unwrap().intersects_point(Point::new(x0, y0))) {
if !xor {
fb.put_pixel(Point::new(x0 as _, y0 as _), color);
} else {
if let Some(existing) = fb.get_pixel(Point::new(x0 as _, y0 as _)) {
if existing == Mono::Black.into() {
fb.put_pixel(Point::new(x0 as _, y0 as _), Mono::White.into());
} else {
fb.put_pixel(Point::new(x0 as _, y0 as _), Mono::Black.into());
}
}
}
}
}
if x0 == x1 && y0 == y1 {
break;
}
let e2 = 2 * err;
if e2 >= dy {
err += dy;
x0 += sx;
}
if e2 <= dx {
err += dx;
y0 += sy;
}
}
}