Made buttons work V2
This commit is contained in:
parent
d5933cd060
commit
e375586804
@ -4,8 +4,11 @@
|
|||||||
#include <pico/types.h>
|
#include <pico/types.h>
|
||||||
#include "hardware/gpio.h"
|
#include "hardware/gpio.h"
|
||||||
|
|
||||||
void handle_vco_change(uint gpio, uint32_t events) {
|
void handle_vco_change(void) {
|
||||||
if (gpio == VCO_BUTTON && (events & GPIO_IRQ_EDGE_RISE)) {
|
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;
|
if (state.vco_mode == VCO_SAW) state.vco_mode = VCO_SINE;
|
||||||
otherwise state.vco_mode++;
|
otherwise state.vco_mode++;
|
||||||
}
|
}
|
||||||
@ -18,4 +21,5 @@ void update_button(uint pin, bool *button_state) {
|
|||||||
void update_buttons() {
|
void update_buttons() {
|
||||||
update_button(QUANT_BUTTON, &state.quant_enabled);
|
update_button(QUANT_BUTTON, &state.quant_enabled);
|
||||||
update_button(AMEN_BUTTON, &state.amen_enabled);
|
update_button(AMEN_BUTTON, &state.amen_enabled);
|
||||||
|
handle_vco_change();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user