add tap tempo timer

main
rkcf 2023-01-28 11:04:28 -06:00
parent 02139416b1
commit 000afa2062
1 changed files with 11 additions and 0 deletions

View File

@ -27,6 +27,8 @@
#define GPIO_MUTATE_BTN (9) // Mutate Button In
#define GPIO_TAP_TEMPO_BTN (10) // Tap Tempo Button In
gptimer_handle_t tap_tempo_timer = NULL;
static QueueHandle_t control_event_queue = NULL;
/* Outputs */
@ -109,6 +111,15 @@ static void controls_init(void) {
gpio_set_intr_type(GPIO_TAP_TEMPO_BTN, GPIO_INTR_NEGEDGE);
// Hook in handler for tap tempo button
gpio_isr_handler_add(GPIO_TAP_TEMPO_BTN, gpio_isr_handler, (void *)GPIO_TAP_TEMPO_BTN);
// Setup tap tempo timer
gptimer_config_t tap_tempo_timer_config = {
.clk_src = GPTIMER_CLK_SRC_DEFAULT,
.direction = GPTIMER_COUNT_UP,
.resolution_hz = 1 * 1000 * 1000 // 1MHz; 1 tick = 1 µs
};
ESP_ERROR_CHECK(gptimer_new_timer(&tap_tempo_timer_config, &tap_tempo_timer));
ESP_ERROR_CHECK(gptimer_enable(tap_tempo_timer));
}
static void clk_cv_off_alarm_cb(gptimer_handle_t timer, const gptimer_alarm_event_data_t *edata, void *user_data) {