1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//! Configuration for headphone outputs
use crate::EnableDisable;
#[derive(Debug, Copy, Clone)]
pub struct HeadphoneOut {
pub(crate) data: u16,
}
impl HeadphoneOut {
pub fn new() -> Self {
HeadphoneOut {
data: 0b0_0000_0000,
}
}
/// Headphone output volume control
///
/// Min: -73dB
///
/// Max: +6dB
///
/// Step: 1dB
pub fn volume(&mut self, volume: u16) {
self.data |= 0b0_0000_0000
}
/// Zero cross detect
pub fn zero_cross_detect(&mut self) -> EnableDisable {
EnableDisable::new(7, &mut self.data)
}
/// Left to right channel headphone volume, mute, and zero cross data load
/// When enabled, left and right channels will have the same values
pub fn both(&mut self) -> EnableDisable {
EnableDisable::new(8, &mut self.data)
}
}