File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
components/esp8266/driver Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 16
16
#include <stdint.h>
17
17
#include <string.h>
18
18
#include "freertos/FreeRTOS.h"
19
+ #include "freertos/task.h"
19
20
#include "freertos/semphr.h"
20
21
#include "esp_attr.h"
21
22
#include "esp_err.h"
@@ -51,7 +52,9 @@ esp_err_t adc_read(uint16_t *data)
51
52
xSemaphoreTake (adc_handle -> adc_mux , portMAX_DELAY );
52
53
53
54
if (adc_handle -> config .mode == ADC_READ_TOUT_MODE ) {
55
+ vTaskSuspendAll ();
54
56
ret = test_tout (0 );
57
+ xTaskResumeAll ();
55
58
56
59
if (ret != 0xFFFF ) {
57
60
// The working voltage of ADC is designed according to 1.1v. Later, the actual working voltage of ADC is increased to 1.2v, so this scale is added.
@@ -63,7 +66,9 @@ esp_err_t adc_read(uint16_t *data)
63
66
}
64
67
}
65
68
} else if (adc_handle -> config .mode == ADC_READ_VDD_MODE ) {
69
+ vTaskSuspendAll ();
66
70
ret = phy_get_vdd33 ();
71
+ xTaskResumeAll ();
67
72
68
73
if (ret != 0xFFFF ) {
69
74
// The working voltage of ADC is designed according to 1.1v. Later, the actual working voltage of ADC is increased to 1.2v, so this scale is added.
@@ -86,7 +91,9 @@ esp_err_t adc_read_fast(uint16_t *data, uint16_t len)
86
91
uint16_t ret ;
87
92
88
93
xSemaphoreTake (adc_handle -> adc_mux , portMAX_DELAY );
94
+ vTaskSuspendAll ();
89
95
phy_adc_read_fast (data , len , adc_handle -> config .clk_div );
96
+ xTaskResumeAll ();
90
97
91
98
for (i = 0 ; i < len ; i ++ ) {
92
99
ret = data [i ];
@@ -146,4 +153,4 @@ esp_err_t adc_init(adc_config_t *config)
146
153
}
147
154
148
155
return ESP_OK ;
149
- }
156
+ }
You can’t perform that action at this time.
0 commit comments