allow no-print
This commit is contained in:
parent
a50895ec96
commit
b52d911c12
2 changed files with 18 additions and 12 deletions
|
|
@ -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, Pin, Pull};
|
||||
use hal::gpio::{AnyPin, Input, Level, Output, Pin, Pull};
|
||||
use hal::time::Hertz;
|
||||
use hal::timer::low_level::CountingMode;
|
||||
use hal::timer::simple_pwm::{PwmPin, SimplePwm};
|
||||
|
|
@ -190,8 +190,9 @@ fn app_main(mut p: hal::Peripherals) -> ! {
|
|||
CountingMode::default(),
|
||||
);
|
||||
|
||||
pwm.set_polarity(led0_ch, OutputPolarity::ActiveLow);
|
||||
pwm.set_polarity(led0_ch, OutputPolarity::ActiveHigh);
|
||||
pwm.set_polarity(led1_ch, OutputPolarity::ActiveLow);
|
||||
pwm.set_polarity(led2_ch, OutputPolarity::ActiveLow);
|
||||
|
||||
let tick_rate_hz = 50000;
|
||||
|
||||
|
|
@ -224,8 +225,11 @@ 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());
|
||||
amp_en_output.set_low();
|
||||
|
||||
// set up interrupts
|
||||
unsafe { system::init_gpio_irq(sense_coin_pin.pin(), sense_coin_pin.port(), false, true) };
|
||||
unsafe { system::init_gpio_irq(sense_coin_pin.pin(), sense_coin_pin.port(), true, false) };
|
||||
unsafe { system::init_gpio_irq(main_btn_pin.pin(), main_btn_pin.port(), true, true) };
|
||||
|
||||
// coin debouncer (100ms)
|
||||
|
|
@ -247,8 +251,8 @@ fn app_main(mut p: hal::Peripherals) -> ! {
|
|||
batt_adc_timer_ms: 10000,
|
||||
usb_adc_timer_ms: 10000,
|
||||
led0_timer_ms: 100,
|
||||
led1_timer_ms: 300,
|
||||
led2_timer_ms: 1100,
|
||||
led1_timer_ms: 100,
|
||||
led2_timer_ms: 100,
|
||||
};
|
||||
|
||||
let app_config = Config {
|
||||
|
|
@ -460,9 +464,9 @@ fn main() -> ! {
|
|||
let mut p = hal::init(config);
|
||||
|
||||
// delay to let the debugger attach
|
||||
println!("pre");
|
||||
// println!("pre");
|
||||
riscv::asm::delay(20_000_000);
|
||||
println!("post");
|
||||
// println!("post");
|
||||
// debug_main(p);
|
||||
|
||||
app_main(p);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue