Remove unsafe from examples

This commit is contained in:
Gwilym Inzani 2024-05-27 13:24:58 +01:00
parent e9ce8cd2ad
commit c4719a5ce0
3 changed files with 6 additions and 9 deletions

View file

@ -37,12 +37,10 @@ fn main(mut gba: agb::Gba) -> ! {
.expect("Should contain colour 0x732b"); .expect("Should contain colour 0x732b");
loop { loop {
let _background_color_transfer = unsafe { let _background_color_transfer = dma.hblank_transfer(
dma.hblank_transfer( &vram.background_palette_colour_dma(0, background_colour_index),
&vram.background_palette_colour_dma(0, background_colour_index), &colours,
&colours, );
)
};
vblank.wait_for_vblank(); vblank.wait_for_vblank();
} }

View file

@ -34,8 +34,7 @@ fn main(mut gba: agb::Gba) -> ! {
let mut frame = 0; let mut frame = 0;
loop { loop {
let _x_scroll_transfer = let _x_scroll_transfer = dma.hblank_transfer(&map.x_scroll_dma(), &offsets[frame..]);
unsafe { dma.hblank_transfer(&map.x_scroll_dma(), &offsets[frame..]) };
vblank.wait_for_vblank(); vblank.wait_for_vblank();
frame += 1; frame += 1;

View file

@ -90,7 +90,7 @@ fn main(mut gba: agb::Gba) -> ! {
window.commit(); window.commit();
let dma_controllable = window.win_in(WinIn::Win0).horizontal_position_dma(); let dma_controllable = window.win_in(WinIn::Win0).horizontal_position_dma();
let _transfer = unsafe { dmas.dma0.hblank_transfer(&dma_controllable, &circle_poses) }; let _transfer = dmas.dma0.hblank_transfer(&dma_controllable, &circle_poses);
vblank.wait_for_vblank(); vblank.wait_for_vblank();
} }