use crate::gpu::{Color, Vertex};
use crate::hw::gpu::{GP0Command, GP0};
use crate::hw::Register;
impl GP0 {
pub fn interrupt_request(&mut self) -> &mut Self {
self.assign(0x1F << 24).store();
self
}
pub fn nop(&mut self) -> &mut Self {
self.assign(0x00 << 24).store();
self
}
pub fn fill_rectangle(&mut self, color: Color, offset: Vertex, size: Vertex) -> &mut Self {
self.assign(0x02 << 24 | u32::from(color))
.store()
.assign(u32::from(offset))
.store()
.assign(u32::from(size))
.store();
self
}
pub fn send_command<C: GP0Command + ?Sized>(&mut self, cmd: &C) -> &mut Self {
for &word in cmd.data() {
self.assign(word).store();
}
self
}
}