allow no-print
This commit is contained in:
parent
a50895ec96
commit
b52d911c12
2 changed files with 18 additions and 12 deletions
|
|
@ -459,7 +459,8 @@ impl App {
|
|||
|
||||
if self.services.synth0.need_service() {
|
||||
let out = match self.services.synth0.service() {
|
||||
Some(value) => value / self.settings.volume.as_volume_divisor(),
|
||||
Some(value) => value / 4,
|
||||
// Some(value) => value / self.settings.volume.as_volume_divisor(),
|
||||
None => 0,
|
||||
};
|
||||
self.interfaces
|
||||
|
|
@ -469,7 +470,7 @@ impl App {
|
|||
|
||||
if self.services.sample_player.need_service() {
|
||||
self.services.sample_player.service();
|
||||
let out = self.services.sample_player.get_amplitude();
|
||||
let out = self.services.sample_player.get_amplitude() / 3;
|
||||
self.interfaces
|
||||
.pwm_core
|
||||
.write_amplitude(ch32_hal::timer::Channel::Ch4, out as u8);
|
||||
|
|
@ -566,12 +567,13 @@ impl App {
|
|||
}
|
||||
|
||||
// TODO LIST
|
||||
// BROKEN:
|
||||
// 1. audio scaling causes crash
|
||||
// 2. popping on sample playback
|
||||
// 3. actual app sequence (start at idle?)
|
||||
//
|
||||
// AUDIO:
|
||||
// 2. dac switching
|
||||
// 3. amp_en control
|
||||
// 4. write sequences
|
||||
// 6. multiple sequences
|
||||
//
|
||||
// LED:
|
||||
//
|
||||
|
|
|
|||
|
|
@ -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