craydate 0.1.7

A safe Rust API for the Playdate hand held gaming system.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/// The state of the headphone jack.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum HeadphoneState {
  HeadphoneNotConnected,
  HeadphoneConnected { has_microphone: bool },
}
impl HeadphoneState {
  pub(crate) fn new(headphones: bool, mic: bool) -> Self {
    if !headphones {
      HeadphoneState::HeadphoneNotConnected
    } else {
      HeadphoneState::HeadphoneConnected {
        has_microphone: mic,
      }
    }
  }
}