how to update periodic timer?
Posted: Tue Aug 13, 2024 3:55 pm
Hi everyone, I'm trying to figure out how to make a rhythm machine from esp32, using the esp_timer_start_periodic function, but I don't know how to adjust the time with any command or method, can you give me some advice?
Code: Select all
const esp_timer_create_args_t periodic_timer_args_bpm = {
.callback = &periodic_timer_callback_bpm,
/* name is optional, but may help identify the timer when debugging */
.name = "periodic"};
ESP_ERROR_CHECK(esp_timer_create(&periodic_timer_args_bpm, &periodic_timer_bpm));
/* The timer has been created but is not running yet */
ESP_ERROR_CHECK(esp_timer_start_periodic(periodic_timer_bpm, 2500));
Code: Select all
static void periodic_timer_callback_bpm(void *arg)
{
bpm_rise_signal = !bpm_rise_signal;
gpio_set_level(SYNC_OUT_PIN, bpm_rise_signal);
}