@@ -27,7 +27,7 @@ void timerWrite(hw_timer_t timer_handle, uint64_t val){
27
27
gptimer_set_raw_count (timer_handle , val );
28
28
}
29
29
30
- void timerAlarmWrite (hw_timer_t timer , uint64_t alarm_value , bool autoreload , uint64_t reload_count ){
30
+ void timerAlarm (hw_timer_t timer , uint64_t alarm_value , bool autoreload , uint64_t reload_count ){
31
31
esp_err_t err = ESP_OK ;
32
32
gptimer_alarm_config_t alarm_cfg = {
33
33
.alarm_count = alarm_value ,
@@ -40,10 +40,10 @@ void timerAlarmWrite(hw_timer_t timer, uint64_t alarm_value, bool autoreload, ui
40
40
}
41
41
}
42
42
43
- uint32_t timerGetResolution (hw_timer_t timer_handle ){
44
- uint32_t resolution ;
45
- gptimer_get_resolution (timer_handle , & resolution );
46
- return resolution ;
43
+ uint32_t timerGetFrequency (hw_timer_t timer_handle ){
44
+ uint32_t frequency ;
45
+ gptimer_get_resolution (timer_handle , & frequency );
46
+ return frequency ;
47
47
}
48
48
49
49
void timerStart (hw_timer_t timer_handle ){
@@ -58,7 +58,7 @@ void timerRestart(hw_timer_t timer_handle){
58
58
gptimer_set_raw_count (timer_handle ,0 );
59
59
}
60
60
61
- hw_timer_t timerBegin (uint32_t resolution , bool countUp ){
61
+ hw_timer_t timerBegin (uint32_t frequency , bool countUp ){
62
62
63
63
esp_err_t err = ESP_OK ;
64
64
hw_timer_t timer_handle ;
@@ -70,7 +70,7 @@ hw_timer_t timerBegin(uint32_t resolution, bool countUp){
70
70
for (size_t i = 0 ; i < sizeof (gptimer_clks ) / sizeof (gptimer_clks [0 ]); i ++ ){
71
71
clk = gptimer_clks [i ];
72
72
clk_tree_src_get_freq_hz (clk , CLK_TREE_SRC_FREQ_PRECISION_CACHED , & counter_src_hz );
73
- divider = counter_src_hz / resolution ;
73
+ divider = counter_src_hz / frequency ;
74
74
if ((divider >= 2 ) && (divider <= 65536 )){
75
75
break ;
76
76
}
@@ -85,7 +85,7 @@ hw_timer_t timerBegin(uint32_t resolution, bool countUp){
85
85
gptimer_config_t config = {
86
86
.clk_src = clk ,
87
87
.direction = countUp ,
88
- .resolution_hz = resolution ,
88
+ .resolution_hz = frequency ,
89
89
.flags .intr_shared = true,
90
90
};
91
91
@@ -140,18 +140,18 @@ void timerDetachInterrupt(hw_timer_t timer){
140
140
141
141
uint64_t timerReadMicros (hw_timer_t timer ){
142
142
uint64_t timer_val = timerRead (timer );
143
- uint32_t resolution = timerGetResolution (timer );
144
- return timer_val * 1000000 / resolution ;
143
+ uint32_t frequency = timerGetResolution (timer );
144
+ return timer_val * 1000000 / frequency ;
145
145
}
146
146
147
147
uint64_t timerReadMilis (hw_timer_t timer ){
148
148
uint64_t timer_val = timerRead (timer );
149
- uint32_t resolution = timerGetResolution (timer );
150
- return timer_val * 1000 / resolution ;
149
+ uint32_t frequency = timerGetResolution (timer );
150
+ return timer_val * 1000 / frequency ;
151
151
}
152
152
153
153
double timerReadSeconds (hw_timer_t timer ){
154
154
uint64_t timer_val = timerRead (timer );
155
- uint32_t resolution = timerGetResolution (timer );
156
- return (double )timer_val / resolution ;
155
+ uint32_t frequency = timerGetResolution (timer );
156
+ return (double )timer_val / frequency ;
157
157
}
0 commit comments