|
28 | 28 | #include "driver/gpio.h"
|
29 | 29 |
|
30 | 30 |
|
31 |
| -// if the MCU is not ESP32S3, the ADC read time is too long to |
32 |
| -// sample all three phase currents in one interrupt |
33 |
| -// so we will sample one phase per interrupt |
34 |
| -#ifdef CONFIG_IDF_TARGET_ESP32S3 |
35 |
| -#define SIMPLEFOC_SAMPLE_ONCE_PER_INTERRUPT |
36 |
| -#endif |
37 |
| - |
38 |
| - |
39 | 31 | #ifdef CONFIG_IDF_TARGET_ESP32S3
|
40 | 32 | #define DEBUGPIN 16
|
41 | 33 | #define GPIO_NUM GPIO_NUM_16
|
@@ -181,17 +173,12 @@ void* _driverSyncLowSide(void* driver_params, void* cs_params){
|
181 | 173 | gpio_set_level(GPIO_NUM,1); //cca 250ns for on+off
|
182 | 174 | #endif
|
183 | 175 |
|
184 |
| -#ifdef SIMPLEFOC_SAMPLE_ONCE_PER_INTERRUPT // sample the phase currents one at a time |
185 |
| - // ex. ESP32's adc read takes around 10us which is very long |
| 176 | + // sample the phase currents one at a time |
| 177 | + // ESP's adc read takes around 10us which is very long |
186 | 178 | // increment buffer index
|
187 | 179 | p->buffer_index = (p->buffer_index + 1) % p->no_adc_channels;
|
188 | 180 | // so we are sampling one phase per call
|
189 | 181 | p->adc_buffer[p->buffer_index] = adcRead(p->pins[p->buffer_index]);
|
190 |
| -#else // sample all available phase currents at once |
191 |
| - // ex. ESP32S3's adc read takes around 1us which is good enough |
192 |
| - for(int i=0; i < p->no_adc_channels; i++) |
193 |
| - p->adc_buffer[p->buffer_index] = adcRead(p->pins[p->buffer_index]); |
194 |
| -#endif |
195 | 182 |
|
196 | 183 | #ifdef SIMPLEFOC_ESP32_INTERRUPT_DEBUG // debugging toggle pin to measure the time of the interrupt with oscilloscope
|
197 | 184 | gpio_set_level(GPIO_NUM,0); //cca 250ns for on+off
|
|
0 commit comments