Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 01c8cae

Browse filesBrowse files
authored
Added method to change the ledc PWM frequency programmatically (espressif#5003)
Added method to change the ledc PWM frequence programmatically Returning frequency from ledcChangeFrequency
1 parent 57cf2fb commit 01c8cae
Copy full SHA for 01c8cae

File tree

Expand file treeCollapse file tree

2 files changed

+10
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-0
lines changed

‎cores/esp32/esp32-hal-ledc.c

Copy file name to clipboardExpand all lines: cores/esp32/esp32-hal-ledc.c
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,3 +318,12 @@ void ledcDetachPin(uint8_t pin)
318318
{
319319
pinMatrixOutDetach(pin, false, false);
320320
}
321+
322+
double ledcChangeFrequency(uint8_t chan, double freq, uint8_t bit_num)
323+
{
324+
if (chan > 15) {
325+
return 0;
326+
}
327+
double res_freq = _ledcSetupTimerFreq(chan, freq, bit_num);
328+
return res_freq;
329+
}

‎cores/esp32/esp32-hal-ledc.h

Copy file name to clipboardExpand all lines: cores/esp32/esp32-hal-ledc.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ uint32_t ledcRead(uint8_t channel);
3535
double ledcReadFreq(uint8_t channel);
3636
void ledcAttachPin(uint8_t pin, uint8_t channel);
3737
void ledcDetachPin(uint8_t pin);
38+
double ledcChangeFrequency(uint8_t channel, double freq, uint8_t resolution_bits);
3839

3940

4041
#ifdef __cplusplus

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.