pub struct Joypad(/* private fields */);Expand description
Joypad register (JOYP). Active low: a cleared bit means selected, or the input
pressed.
| Bit | Field | Access | Meaning |
|---|---|---|---|
| 7-6 | — | Unused. | |
| 5 | buttons | R/W | Selects the action buttons (A/B/Select/Start). |
| 4 | dpad | R/W | Selects the d-pad. |
| 3 | p13 | RO | Input line P13: Down (d-pad) or Start (buttons). |
| 2 | p12 | RO | Input line P12: Up (d-pad) or Select (buttons). |
| 1 | p11 | RO | Input line P11: Left (d-pad) or B (buttons). |
| 0 | p10 | RO | Input line P10: Right (d-pad) or A (buttons). |
Implementations§
Source§impl Joypad
impl Joypad
Sourcepub const fn with_p10_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_p10_checked(self, value: bool) -> Result<Self, ()>
Input line P10: Right (d-pad) or A (buttons).
Bits: 0..1
Sourcepub const fn with_p10(self, value: bool) -> Self
pub const fn with_p10(self, value: bool) -> Self
Input line P10: Right (d-pad) or A (buttons).
Bits: 0..1
Sourcepub const fn set_p10(&mut self, value: bool)
pub const fn set_p10(&mut self, value: bool)
Input line P10: Right (d-pad) or A (buttons).
Bits: 0..1
Sourcepub const fn set_p10_checked(&mut self, value: bool) -> Result<(), ()>
pub const fn set_p10_checked(&mut self, value: bool) -> Result<(), ()>
Input line P10: Right (d-pad) or A (buttons).
Bits: 0..1
Sourcepub const fn with_p11_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_p11_checked(self, value: bool) -> Result<Self, ()>
Input line P11: Left (d-pad) or B (buttons).
Bits: 1..2
Sourcepub const fn with_p11(self, value: bool) -> Self
pub const fn with_p11(self, value: bool) -> Self
Input line P11: Left (d-pad) or B (buttons).
Bits: 1..2
Sourcepub const fn set_p11(&mut self, value: bool)
pub const fn set_p11(&mut self, value: bool)
Input line P11: Left (d-pad) or B (buttons).
Bits: 1..2
Sourcepub const fn set_p11_checked(&mut self, value: bool) -> Result<(), ()>
pub const fn set_p11_checked(&mut self, value: bool) -> Result<(), ()>
Input line P11: Left (d-pad) or B (buttons).
Bits: 1..2
Sourcepub const fn with_p12_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_p12_checked(self, value: bool) -> Result<Self, ()>
Input line P12: Up (d-pad) or Select (buttons).
Bits: 2..3
Sourcepub const fn with_p12(self, value: bool) -> Self
pub const fn with_p12(self, value: bool) -> Self
Input line P12: Up (d-pad) or Select (buttons).
Bits: 2..3
Sourcepub const fn set_p12(&mut self, value: bool)
pub const fn set_p12(&mut self, value: bool)
Input line P12: Up (d-pad) or Select (buttons).
Bits: 2..3
Sourcepub const fn set_p12_checked(&mut self, value: bool) -> Result<(), ()>
pub const fn set_p12_checked(&mut self, value: bool) -> Result<(), ()>
Input line P12: Up (d-pad) or Select (buttons).
Bits: 2..3
Sourcepub const fn with_p13_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_p13_checked(self, value: bool) -> Result<Self, ()>
Input line P13: Down (d-pad) or Start (buttons).
Bits: 3..4
Sourcepub const fn with_p13(self, value: bool) -> Self
pub const fn with_p13(self, value: bool) -> Self
Input line P13: Down (d-pad) or Start (buttons).
Bits: 3..4
Sourcepub const fn set_p13(&mut self, value: bool)
pub const fn set_p13(&mut self, value: bool)
Input line P13: Down (d-pad) or Start (buttons).
Bits: 3..4
Sourcepub const fn set_p13_checked(&mut self, value: bool) -> Result<(), ()>
pub const fn set_p13_checked(&mut self, value: bool) -> Result<(), ()>
Input line P13: Down (d-pad) or Start (buttons).
Bits: 3..4
Sourcepub const fn with_dpad_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_dpad_checked(self, value: bool) -> Result<Self, ()>
Selects the d-pad.
Bits: 4..5
Sourcepub const fn set_dpad_checked(&mut self, value: bool) -> Result<(), ()>
pub const fn set_dpad_checked(&mut self, value: bool) -> Result<(), ()>
Selects the d-pad.
Bits: 4..5
Selects the action buttons (A/B/Select/Start).
Bits: 5..6
Selects the action buttons (A/B/Select/Start).
Bits: 5..6
Selects the action buttons (A/B/Select/Start).
Bits: 5..6
Selects the action buttons (A/B/Select/Start).
Bits: 5..6
Selects the action buttons (A/B/Select/Start).
Bits: 5..6