sint-gauntlet/buttons.c
2026-04-24 16:57:38 +02:00

26 lines
607 B
C

#include "const.h"
#include "state.h"
#include "vco.h"
#include <pico/types.h>
#include "hardware/gpio.h"
void handle_vco_change(void) {
static bool btn_prev = false;
bool btn_now = gpio_get(VCO_BUTTON);
if (btn_now && !btn_prev) {
if (state.vco_mode == VCO_SAW) state.vco_mode = VCO_SINE;
otherwise state.vco_mode++;
}
}
void update_button(uint pin, bool *button_state) {
if(gpio_get(pin) != *button_state) *button_state = !*button_state;
}
void update_buttons() {
update_button(QUANT_BUTTON, &state.quant_enabled);
update_button(AMEN_BUTTON, &state.amen_enabled);
handle_vco_change();
}