add amp_en control
This commit is contained in:
parent
1c2823eb1b
commit
8ea4b4401e
2 changed files with 33 additions and 2 deletions
|
|
@ -309,6 +309,7 @@ pub struct Sequences {
|
|||
pub struct Interfaces {
|
||||
pub pwm_core: SimplePwmCore<'static, ch32_hal::peripherals::TIM1>,
|
||||
pub adc_core: crate::AdcCore,
|
||||
pub amp: crate::Amplifier,
|
||||
}
|
||||
|
||||
pub struct App {
|
||||
|
|
@ -502,10 +503,14 @@ impl App {
|
|||
} else {
|
||||
self.services.sequencer.disable();
|
||||
self.services.synth0.disable();
|
||||
self.interfaces.amp.disable();
|
||||
}
|
||||
}
|
||||
|
||||
if self.services.synth0.need_service() {
|
||||
if !self.interfaces.amp.enabled() {
|
||||
self.interfaces.amp.enable();
|
||||
}
|
||||
let out = match self.services.synth0.service() {
|
||||
Some(value) => value / 6 / self.settings.volume.as_volume_divisor(),
|
||||
None => 0,
|
||||
|
|
@ -540,6 +545,7 @@ impl App {
|
|||
self.interfaces
|
||||
.pwm_core
|
||||
.disable(ch32_hal::timer::Channel::Ch4);
|
||||
self.interfaces.amp.disable();
|
||||
}
|
||||
pub fn volume_button(&mut self) {
|
||||
self.settings.volume.next();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue