Skip to content

Commit 23c316f

Browse files
authored
1 parent b3a41a3 commit 23c316f

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

Diff for: cores/esp32/esp32-hal-ledc.c

-19
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "freertos/task.h"
1818
#include "freertos/semphr.h"
1919
#include "esp32-hal-matrix.h"
20-
#include "soc/soc_caps.h"
2120
#include "soc/ledc_reg.h"
2221
#include "soc/ledc_struct.h"
2322
#include "driver/periph_ctrl.h"
@@ -332,21 +331,3 @@ double ledcChangeFrequency(uint8_t chan, double freq, uint8_t bit_num)
332331
double res_freq = _ledcSetupTimerFreq(chan, freq, bit_num);
333332
return res_freq;
334333
}
335-
336-
static int8_t pin_to_channel[SOC_GPIO_PIN_COUNT] = { 0 };
337-
static int cnt_channel = SOC_LEDC_CHANNEL_NUM;
338-
void analogWrite(uint8_t pin, int value) {
339-
// Use ledc hardware for internal pins
340-
if (pin < SOC_GPIO_PIN_COUNT) {
341-
if (pin_to_channel[pin] == 0) {
342-
if (!cnt_channel) {
343-
log_e("No more analogWrite channels available! You can have maximum %u", SOC_LEDC_CHANNEL_NUM);
344-
return;
345-
}
346-
pin_to_channel[pin] = cnt_channel--;
347-
ledcAttachPin(pin, cnt_channel);
348-
ledcSetup(cnt_channel, 1000, 8);
349-
}
350-
ledcWrite(pin_to_channel[pin] - 1, value);
351-
}
352-
}

0 commit comments

Comments
 (0)