Skip to content

Commit 4dbde96

Browse files
ci(pre-commit): Apply automatic fixes
1 parent bc694ce commit 4dbde96

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

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

+4-6
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ bool ledcAttachChannel(uint8_t pin, uint32_t freq, uint8_t resolution, uint8_t c
110110
log_e("Attaching pin to already used channel failed!");
111111
return false;
112112
}
113-
}
114-
else {
113+
} else {
115114
ledc_timer_config_t ledc_timer = {.speed_mode = group, .timer_num = timer, .duty_resolution = resolution, .freq_hz = freq, .clk_cfg = LEDC_DEFAULT_CLK};
116115
if (ledc_timer_config(&ledc_timer) != ESP_OK) {
117116
log_e("ledc setup failed!");
@@ -139,8 +138,7 @@ bool ledcAttachChannel(uint8_t pin, uint32_t freq, uint8_t resolution, uint8_t c
139138
ledc_ll_get_duty_resolution(LEDC_LL_GET_HW(), group, timer, &channel_resolution);
140139
log_i("Channel %u frequency: %u, resolution: %u", channel, ledc_get_freq(group, timer), channel_resolution);
141140
handle->channel_resolution = (uint8_t)channel_resolution;
142-
}
143-
else {
141+
} else {
144142
handle->channel_resolution = resolution;
145143
ledc_handle.used_channels |= 1UL << channel;
146144
}
@@ -186,7 +184,7 @@ bool ledcWrite(uint8_t pin, uint32_t duty) {
186184
return false;
187185
}
188186

189-
bool ledcWriteChannel(uint8_t channel, uint32_t duty){
187+
bool ledcWriteChannel(uint8_t channel, uint32_t duty) {
190188
//check if channel is valid and used
191189
if (channel >= LEDC_CHANNELS || !(ledc_handle.used_channels & (1UL << channel))) {
192190
log_e("Channel %u is not available (maximum %u) or not used!", channel, LEDC_CHANNELS);
@@ -197,7 +195,7 @@ bool ledcWriteChannel(uint8_t channel, uint32_t duty){
197195
//Fixing if all bits in resolution is set = LEDC FULL ON
198196
uint32_t resolution = 0;
199197
ledc_ll_get_duty_resolution(LEDC_LL_GET_HW(), group, timer, &resolution);
200-
198+
201199
uint32_t max_duty = (1 << resolution) - 1;
202200

203201
if ((duty == max_duty) && (max_duty != 1)) {

Diff for: libraries/ESP32/examples/AnalogOut/LEDCSingleChannel/LEDCSingleChannel.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
This example shows how to software fade LED
55
using the ledcWriteChannel function on multiple pins.
6-
This example is useful if you need to control synchronously
6+
This example is useful if you need to control synchronously
77
multiple LEDs on different pins.
88
99
Code adapted from original Arduino Fade example:

0 commit comments

Comments
 (0)