make amp_en OutputOpenDrain

This commit is contained in:
sigil-03 2025-11-14 16:14:09 -07:00
parent c71ace5063
commit 6ba94f1cbb

View file

@ -31,7 +31,7 @@ use insert_coin::{CoreConfig, DacService, InsertCoin, LedService, SimplePwmCore}
use ch32_hal as hal;
use hal::bind_interrupts;
use hal::delay::Delay;
use hal::gpio::{AnyPin, Input, Level, Output, Pin, Pull};
use hal::gpio::{AnyPin, Input, Level, Output, OutputOpenDrain, Pin, Pull};
use hal::time::Hertz;
use hal::timer::low_level::CountingMode;
use hal::timer::simple_pwm::{PwmPin, SimplePwm};
@ -64,11 +64,11 @@ impl Usb {
}
pub struct Amplifier {
amp_en: Output<'static>,
amp_en: OutputOpenDrain<'static>,
}
impl Amplifier {
pub fn new(amp_en: Output<'static>) -> Self {
pub fn new(amp_en: OutputOpenDrain<'static>) -> Self {
let mut amp = Self { amp_en };
amp.disable();
amp
@ -312,7 +312,7 @@ fn app_main(mut p: hal::Peripherals) -> ! {
let extra_io_1 = p.PD0;
let extra_io_2 = p.PD3;
let mut amp_en_output = Output::new(amp_en, Level::Low, Default::default());
let mut amp_en_output = OutputOpenDrain::new(amp_en, Level::Low, Default::default());
let amp = Amplifier::new(amp_en_output);
// set up interrupts