Compare commits
No commits in common. "on-chip-pulldowns" and "main" have entirely different histories.
on-chip-pu
...
main
2 changed files with 10 additions and 31 deletions
|
|
@ -14,15 +14,10 @@ pub struct DebouncedGPIO<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DebouncedGPIO<'a> {
|
impl<'a> DebouncedGPIO<'a> {
|
||||||
pub fn new(
|
pub fn new(pin: AnyPin, system_tick_rate_hz: usize, debounce_time_ms: usize) -> Self {
|
||||||
pin: AnyPin,
|
|
||||||
pull: Pull,
|
|
||||||
system_tick_rate_hz: usize,
|
|
||||||
debounce_time_ms: usize,
|
|
||||||
) -> Self {
|
|
||||||
// coin debounce timer (100ms)
|
// coin debounce timer (100ms)
|
||||||
Self {
|
Self {
|
||||||
input: Input::new(pin, pull),
|
input: Input::new(pin, Pull::None),
|
||||||
value: false,
|
value: false,
|
||||||
ready: false,
|
ready: false,
|
||||||
active: false,
|
active: false,
|
||||||
|
|
|
||||||
|
|
@ -343,33 +343,17 @@ fn app_main(mut p: hal::Peripherals, app_settings: Settings) -> Settings {
|
||||||
unsafe { system::init_gpio_irq(main_btn_pin.pin(), main_btn_pin.port(), true, true) };
|
unsafe { system::init_gpio_irq(main_btn_pin.pin(), main_btn_pin.port(), true, true) };
|
||||||
|
|
||||||
// coin debouncer (100ms)
|
// coin debouncer (100ms)
|
||||||
let mut sense_coin_input = DebouncedGPIO::new(
|
let mut sense_coin_input =
|
||||||
sense_coin_pin.degrade(),
|
DebouncedGPIO::new(sense_coin_pin.degrade(), core_config.tick_rate_hz, 20);
|
||||||
Pull::None,
|
|
||||||
core_config.tick_rate_hz,
|
|
||||||
20,
|
|
||||||
);
|
|
||||||
// main button debouncer (100ms)
|
// main button debouncer (100ms)
|
||||||
let mut main_btn_input = DebouncedGPIO::new(
|
let mut main_btn_input =
|
||||||
main_btn_pin.degrade(),
|
DebouncedGPIO::new(main_btn_pin.degrade(), core_config.tick_rate_hz, 20);
|
||||||
Pull::None,
|
|
||||||
core_config.tick_rate_hz,
|
|
||||||
20,
|
|
||||||
);
|
|
||||||
// button debouncer (100ms)
|
// button debouncer (100ms)
|
||||||
let mut volume_btn_input = DebouncedGPIO::new(
|
let mut volume_btn_input =
|
||||||
volume_btn_pin.degrade(),
|
DebouncedGPIO::new(volume_btn_pin.degrade(), core_config.tick_rate_hz, 100);
|
||||||
Pull::Down,
|
|
||||||
core_config.tick_rate_hz,
|
|
||||||
100,
|
|
||||||
);
|
|
||||||
// button debouncer (100ms)
|
// button debouncer (100ms)
|
||||||
let mut light_ctrl_btn_input = DebouncedGPIO::new(
|
let mut light_ctrl_btn_input =
|
||||||
light_ctrl_btn_pin.degrade(),
|
DebouncedGPIO::new(light_ctrl_btn_pin.degrade(), core_config.tick_rate_hz, 100);
|
||||||
Pull::Down,
|
|
||||||
core_config.tick_rate_hz,
|
|
||||||
100,
|
|
||||||
);
|
|
||||||
|
|
||||||
let timer_config = TimerConfig {
|
let timer_config = TimerConfig {
|
||||||
sp_timer_ms: 1000,
|
sp_timer_ms: 1000,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue