Skip to content

Commit d68a146

Browse files
ci(pre-commit): Apply automatic fixes
1 parent b37a764 commit d68a146

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

cores/esp32/esp32-hal-ledc.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static bool find_free_timer(uint8_t speed_mode, uint8_t *timer_num) {
8484
}
8585
}
8686
}
87-
87+
8888
// Find first unused timer
8989
for (uint8_t i = 0; i < SOC_LEDC_TIMER_NUM; i++) {
9090
if (!(used_timers & (1 << i))) {
@@ -100,7 +100,7 @@ static bool find_free_timer(uint8_t speed_mode, uint8_t *timer_num) {
100100
// Helper function to remove a channel from a timer and clear timer if no channels are using it
101101
static void remove_channel_from_timer(uint8_t speed_mode, uint8_t timer_num, uint8_t channel) {
102102
log_d("Removing channel %u from timer %u in speed_mode %u", channel, timer_num, speed_mode);
103-
103+
104104
// Check if any other channels are using this timer
105105
bool timer_in_use = false;
106106
for (uint8_t i = 0; i < SOC_GPIO_PIN_COUNT; i++) {
@@ -110,8 +110,7 @@ static void remove_channel_from_timer(uint8_t speed_mode, uint8_t timer_num, uin
110110
peripheral_bus_type_t type = perimanGetPinBusType(i);
111111
if (type == ESP32_BUS_TYPE_LEDC) {
112112
ledc_channel_handle_t *bus = (ledc_channel_handle_t *)perimanGetPinBus(i, ESP32_BUS_TYPE_LEDC);
113-
if (bus != NULL && (bus->channel / 8) == speed_mode &&
114-
bus->timer_num == timer_num && bus->channel != channel) {
113+
if (bus != NULL && (bus->channel / 8) == speed_mode && bus->timer_num == timer_num && bus->channel != channel) {
115114
log_d("Timer %u is still in use by channel %u", timer_num, bus->channel);
116115
timer_in_use = true;
117116
break;
@@ -208,9 +207,9 @@ bool ledcAttachChannel(uint8_t pin, uint32_t freq, uint8_t resolution, uint8_t c
208207
}
209208

210209
uint8_t group = (channel / 8);
211-
uint8_t timer = 0;
210+
uint8_t timer = 0;
212211
bool channel_used = ledc_handle.used_channels & (1UL << channel);
213-
212+
214213
if (channel_used) {
215214
log_i("Channel %u is already set up, given frequency and resolution will be ignored", channel);
216215
if (ledc_set_pin(pin, group, channel % 8) != ESP_OK) {
@@ -224,7 +223,7 @@ bool ledcAttachChannel(uint8_t pin, uint32_t freq, uint8_t resolution, uint8_t c
224223
log_e("No free timers available for speed mode %u", group);
225224
return false;
226225
}
227-
226+
228227
// Configure the timer if we're using a new one
229228
ledc_timer_config_t ledc_timer;
230229
memset((void *)&ledc_timer, 0, sizeof(ledc_timer_config_t));

cores/esp32/esp32-hal-ledc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ typedef struct {
5151
uint8_t pin; // Pin assigned to channel
5252
uint8_t channel; // Channel number
5353
uint8_t channel_resolution; // Resolution of channel
54-
uint8_t timer_num; // Timer number used by this channel
55-
uint32_t freq_hz; // Frequency configured for this channel
54+
uint8_t timer_num; // Timer number used by this channel
55+
uint32_t freq_hz; // Frequency configured for this channel
5656
voidFuncPtr fn;
5757
void *arg;
5858
#ifndef SOC_LEDC_SUPPORT_FADE_STOP

0 commit comments

Comments
 (0)