pub struct PaletteIndex(/* private fields */);Available on crate feature
cgb only.Expand description
Color palette index (BCPS / OCPS).
| Bit | Field | Access | Meaning |
|---|---|---|---|
| 7 | auto_increment | R/W | Auto-increment the address after each data-port write. |
| 6 | — | Unused. | |
| 5-0 | address | R/W | Byte offset into palette memory reached through the data port. |
Implementations§
Source§impl PaletteIndex
impl PaletteIndex
Sourcepub const fn address(&self) -> u8
pub const fn address(&self) -> u8
Byte offset into palette memory reached through the data port.
Bits: 0..6
Sourcepub const fn with_address_checked(self, value: u8) -> Result<Self, ()>
pub const fn with_address_checked(self, value: u8) -> Result<Self, ()>
Byte offset into palette memory reached through the data port.
Bits: 0..6
Sourcepub const fn with_address(self, value: u8) -> Self
pub const fn with_address(self, value: u8) -> Self
Byte offset into palette memory reached through the data port.
Bits: 0..6
Sourcepub const fn set_address(&mut self, value: u8)
pub const fn set_address(&mut self, value: u8)
Byte offset into palette memory reached through the data port.
Bits: 0..6
Sourcepub const fn set_address_checked(&mut self, value: u8) -> Result<(), ()>
pub const fn set_address_checked(&mut self, value: u8) -> Result<(), ()>
Byte offset into palette memory reached through the data port.
Bits: 0..6
Sourcepub const fn auto_increment(&self) -> bool
pub const fn auto_increment(&self) -> bool
Auto-increment the address after each write to the data port.
Bits: 7..8
Sourcepub const fn with_auto_increment_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_auto_increment_checked(self, value: bool) -> Result<Self, ()>
Auto-increment the address after each write to the data port.
Bits: 7..8
Sourcepub const fn with_auto_increment(self, value: bool) -> Self
pub const fn with_auto_increment(self, value: bool) -> Self
Auto-increment the address after each write to the data port.
Bits: 7..8
Sourcepub const fn set_auto_increment(&mut self, value: bool)
pub const fn set_auto_increment(&mut self, value: bool)
Auto-increment the address after each write to the data port.
Bits: 7..8
Trait Implementations§
Source§impl Clone for PaletteIndex
impl Clone for PaletteIndex
Source§fn clone(&self) -> PaletteIndex
fn clone(&self) -> PaletteIndex
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PaletteIndex
Source§impl Debug for PaletteIndex
impl Debug for PaletteIndex
Source§impl Default for PaletteIndex
impl Default for PaletteIndex
impl Eq for PaletteIndex
Source§impl From<PaletteIndex> for u8
impl From<PaletteIndex> for u8
Source§fn from(v: PaletteIndex) -> Self
fn from(v: PaletteIndex) -> Self
Converts to this type from the input type.
Source§impl From<u8> for PaletteIndex
impl From<u8> for PaletteIndex
Source§impl PartialEq for PaletteIndex
impl PartialEq for PaletteIndex
impl StructuralPartialEq for PaletteIndex
Auto Trait Implementations§
impl BankSafe for PaletteIndex
impl Freeze for PaletteIndex
impl RefUnwindSafe for PaletteIndex
impl Send for PaletteIndex
impl Sync for PaletteIndex
impl Unpin for PaletteIndex
impl UnsafeUnpin for PaletteIndex
impl UnwindSafe for PaletteIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more