firmware/src/vfddriver.c
// vfd_mux_init configures a hardware timer and registers an isr for
// digit multiplexing in the background. use period=0.002 for 
// approximately 60 Hz overall refresh rate.
vfd_mux_init configures a hardware timer and registers an isr for
digit multiplexing in the background. use period=0.002 for
approximately 60 Hz overall refresh rate.
vfd_mux_init configures a hardware timer and registers an isr for digit multiplexing in the background . use period = 0 . 002 for approximately 60 Hz overall refresh rate .
void vfd_init_mux(double period, TaskHandle_t *task) {
  timer_config_t timercfg = {
    .divider = VFD_MUX_DIVIDER,
    .counter_en = false,
    .counter_dir = TIMER_COUNT_UP,
    .auto_reload = TIMER_AUTORELOAD_EN,
    .alarm_en = true,
    .intr_type = TIMER_INTR_LEVEL,
  };
  ESP_ERROR_CHECK(timer_init(VFD_TIMER, &timercfg));
  ESP_ERROR_CHECK(timer_set_counter_value(VFD_TIMER, 0));
  ESP_ERROR_CHECK(timer_set_alarm_value(VFD_TIMER, period * VFD_MUX_SECOND));
  ESP_LOGI(TAG, "digitmux timer prepared");
  ESP_ERROR_CHECK(timer_enable_intr(VFD_TIMER));
  ESP_ERROR_CHECK(timer_isr_register(VFD_TIMER, vfd_digitmux_isr, NULL, 0, NULL));
  ESP_ERROR_CHECK(timer_start(VFD_TIMER));
  bzero(vfd.buf, sizeof(vfd.buf));
  xTaskCreate(vfd_digitmux_task, "digitmux", 2048, NULL, configMAX_PRIORITIES - 1, task);
  ESP_LOGI(TAG, "digitmux isr registered & task created");
}
void vfd_init_mux ( double period , TaskHandle_t * task ) { timer_config_t timercfg = { . divider = VFD_MUX_DIVIDER , . counter_en = false , . counter_dir = TIMER_COUNT_UP , . auto_reload = TIMER_AUTORELOAD_EN , . alarm_en = true , . intr_type = TIMER_INTR_LEVEL , } ; ESP_ERROR_CHECK ( timer_init ( VFD_TIMER , & timercfg ) ) ; ESP_ERROR_CHECK ( timer_set_counter_value ( VFD_TIMER , 0 ) ) ; ESP_ERROR_CHECK ( timer_set_alarm_value ( VFD_TIMER , period * VFD_MUX_SECOND ) ) ; ESP_LOGI ( TAG , " " ) ; ESP_ERROR_CHECK ( timer_enable_intr ( VFD_TIMER ) ) ; ESP_ERROR_CHECK ( timer_isr_register ( VFD_TIMER , vfd_digitmux_isr , NULL , 0 , NULL ) ) ; ESP_ERROR_CHECK ( timer_start ( VFD_TIMER ) ) ; bzero ( vfd . buf , sizeof ( vfd . buf ) ) ; xTaskCreate ( vfd_digitmux_task , " " , 2048 , NULL , configMAX_PRIORITIES - 1 , task ) ; ESP_LOGI ( TAG , " " ) ; }
vfd_mux_init configures a hardware timer and registers an isr for
digit multiplexing in the background.
vfd_mux_init configures a hardware timer and registers an isr for digit multiplexing in the background .
// initialise multiplexing timer // reset counter and set alarm value for given period // register isr and start timer // explicitly zero the display buffer // create mux task and return its handle // default event loop is pinned on core 0, so if you see flickering maybe pin to core 1 .. // xTaskCreatePinnedToCore(vfd_digitmux_task, "digitmux", 2048, NULL, configMAX_PRIORITIES - 1, task, 1);