1menu "High resolution timer (esp_timer)"
2
3    config ESP_TIMER_PROFILING
4        bool "Enable esp_timer profiling features"
5        default n
6        help
7            If enabled, esp_timer_dump will dump information such as number of times the timer was started,
8            number of times the timer has triggered, and the total time it took for the callback to run.
9            This option has some effect on timer performance and the amount of memory used for timer
10            storage, and should only be used for debugging/testing purposes.
11
12    config ESP_TIME_FUNCS_USE_RTC_TIMER  # [refactor-todo] remove when timekeeping and persistence are separate
13        bool
14
15    config ESP_TIME_FUNCS_USE_ESP_TIMER  # [refactor-todo] remove when timekeeping and persistence are separate
16        bool
17
18    config ESP_TIME_FUNCS_USE_NONE  # [refactor-todo] remove when timekeeping and persistence are separate
19        bool
20
21    config ESP_TIMER_TASK_STACK_SIZE
22        int "High-resolution timer task stack size"
23        default 3584
24        range 2048 65536
25        help
26            Configure the stack size of "timer_task" task. This task is used
27            to dispatch callbacks of timers created using ets_timer and esp_timer
28            APIs. If you are seing stack overflow errors in timer task, increase
29            this value.
30
31            Note that this is not the same as FreeRTOS timer task. To configure
32            FreeRTOS timer task size, see "FreeRTOS timer task stack size" option
33            in "FreeRTOS".
34
35    config ESP_TIMER_INTERRUPT_LEVEL
36        int "Interrupt level"
37        default 1
38        range 1 3 if IDF_TARGET_ESP32
39        range 1 1 if !IDF_TARGET_ESP32
40        help
41            It sets the interrupt level for esp_timer ISR in range 1..3.
42            A higher level (3) helps to decrease the ISR esp_timer latency.
43
44    config ESP_TIMER_SHOW_EXPERIMENTAL
45        bool "show esp_timer's experimental features"
46        help
47            This shows some hidden features of esp_timer.
48            Note that they may break other features, use them with care.
49
50    config ESP_TIMER_TASK_AFFINITY
51        hex
52        default 0x0 if ESP_TIMER_TASK_AFFINITY_CPU0
53        default 0x1 if ESP_TIMER_TASK_AFFINITY_CPU1
54        default FREERTOS_NO_AFFINITY if ESP_TIMER_TASK_AFFINITY_NO_AFFINITY
55
56    choice ESP_TIMER_TASK_AFFINITY
57        prompt "esp_timer task core affinity"
58        default ESP_TIMER_TASK_AFFINITY_CPU0
59        help
60            The default settings: timer TASK on CPU0 and timer ISR on CPU0.
61            Other settings may help in certain cases, but note that they may break
62            other features, use them with care.
63            - "CPU0": (default) esp_timer task is processed by CPU0.
64            - "CPU1": esp_timer task is processed by CPU1.
65            - "No affinity": esp_timer task can be processed by any CPU.
66
67        config ESP_TIMER_TASK_AFFINITY_CPU0
68            bool "CPU0"
69        config ESP_TIMER_TASK_AFFINITY_CPU1
70            bool "CPU1"
71            depends on !FREERTOS_UNICORE && ESP_TIMER_SHOW_EXPERIMENTAL
72        config ESP_TIMER_TASK_AFFINITY_NO_AFFINITY
73            bool "No affinity"
74            depends on !FREERTOS_UNICORE && ESP_TIMER_SHOW_EXPERIMENTAL
75    endchoice
76
77    config ESP_TIMER_ISR_AFFINITY
78        hex
79        default 0x1 if ESP_TIMER_ISR_AFFINITY_CPU0
80        default 0x2 if ESP_TIMER_ISR_AFFINITY_CPU1
81        default FREERTOS_NO_AFFINITY if ESP_TIMER_ISR_AFFINITY_NO_AFFINITY
82
83    choice ESP_TIMER_ISR_AFFINITY
84        prompt "timer interrupt core affinity"
85        default ESP_TIMER_ISR_AFFINITY_CPU0
86        help
87            The default settings: timer TASK on CPU0 and timer ISR on CPU0.
88            Other settings may help in certain cases, but note that they may break
89            other features, use them with care.
90            - "CPU0": (default) timer interrupt is processed by CPU0.
91            - "CPU1": timer interrupt is processed by CPU1.
92            - "No affinity": timer interrupt can be processed by any CPU. It helps
93            to reduce latency but there is a disadvantage it leads to the timer ISR
94            running on every core. It increases the CPU time usage for timer ISRs
95            by N on an N-core system.
96
97        config ESP_TIMER_ISR_AFFINITY_CPU0
98            bool "CPU0"
99        config ESP_TIMER_ISR_AFFINITY_CPU1
100            bool "CPU1"
101            depends on !FREERTOS_UNICORE && ESP_TIMER_SHOW_EXPERIMENTAL
102        config ESP_TIMER_ISR_AFFINITY_NO_AFFINITY
103            bool "No affinity"
104            depends on !FREERTOS_UNICORE && ESP_TIMER_SHOW_EXPERIMENTAL
105    endchoice
106
107    config ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD
108        bool "Support ISR dispatch method"
109        default n
110        help
111            Allows using ESP_TIMER_ISR dispatch method (ESP_TIMER_TASK dispatch method is also avalible).
112            - ESP_TIMER_TASK - Timer callbacks are dispatched from a high-priority esp_timer task.
113            - ESP_TIMER_ISR - Timer callbacks are dispatched directly from the timer interrupt handler.
114            The ISR dispatch can be used, in some cases, when a callback is very simple
115            or need a lower-latency.
116
117    config ESP_TIMER_IMPL_TG0_LAC
118        bool
119        default y
120        depends on IDF_TARGET_ESP32
121
122    config ESP_TIMER_IMPL_SYSTIMER
123        bool
124        default y
125        depends on !IDF_TARGET_ESP32
126
127endmenu # esp_timer
128