sint-gauntlet/buttons.c
2026-04-24 16:17:59 +02:00

28 lines
619 B
C

#include "const.h"
#include "state.h"
#include "vco.h"
#include <pico/types.h>
#include "hardware/gpio.h"
void handle_vco_change(uint gpio, uint32_t events) {
if (gpio == VCO_BUTTON && (events & GPIO_IRQ_EDGE_RISE)) {
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);
}