mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
esp32s2: wifi and pwm
s2 ROM needs an explicit set_mode() as tested on Kaluga Adapt PWM but unable to test as Kaluga has a smart RGB LED unlike Wrover Kit
This commit is contained in:
parent
fcbc0dafa4
commit
7db51f4096
2 changed files with 18 additions and 3 deletions
|
@ -406,6 +406,8 @@ lws_netdev_plat_wifi_init(void)
|
|||
return 1;
|
||||
}
|
||||
|
||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -445,11 +447,11 @@ lws_netdev_wifi_up_plat(struct lws_netdev_instance *nd)
|
|||
return 0;
|
||||
|
||||
ESP_ERROR_CHECK(esp_event_handler_instance_register(IP_EVENT,
|
||||
IP_EVENT_STA_GOT_IP, &_event_handler_ip, nd,
|
||||
IP_EVENT_STA_GOT_IP, _event_handler_ip, nd,
|
||||
&wnde32->instance_got_ip));
|
||||
|
||||
ESP_ERROR_CHECK(esp_event_handler_instance_register(WIFI_EVENT,
|
||||
ESP_EVENT_ANY_ID, &_event_handler_wifi, nd,
|
||||
ESP_EVENT_ANY_ID, _event_handler_wifi, nd,
|
||||
&wnde32->instance_any_id));
|
||||
|
||||
esp_wifi_start();
|
||||
|
|
|
@ -29,10 +29,18 @@
|
|||
#define _LEDC_HIGH_SPEED_MODE 0
|
||||
|
||||
static const ledc_timer_config_t tc = {
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
.speed_mode = LEDC_LOW_SPEED_MODE,
|
||||
#else
|
||||
.speed_mode = _LEDC_HIGH_SPEED_MODE,
|
||||
#endif
|
||||
.duty_resolution = LEDC_TIMER_13_BIT,
|
||||
.timer_num = LEDC_TIMER_0,
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
.freq_hz = 1000,
|
||||
#else
|
||||
.freq_hz = 5000,
|
||||
#endif
|
||||
.clk_cfg = LEDC_AUTO_CLK
|
||||
};
|
||||
|
||||
|
@ -40,9 +48,14 @@ int
|
|||
lws_pwm_plat_init(const struct lws_pwm_ops *lo)
|
||||
{
|
||||
ledc_channel_config_t lc = {
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
.speed_mode = LEDC_LOW_SPEED_MODE,
|
||||
.duty = 8191,
|
||||
.intr_type = LEDC_INTR_FADE_END,
|
||||
#else
|
||||
.speed_mode = _LEDC_HIGH_SPEED_MODE,
|
||||
.duty = 8191,
|
||||
#endif
|
||||
.intr_type = LEDC_INTR_FADE_END,
|
||||
.timer_sel = LEDC_TIMER_0,
|
||||
};
|
||||
size_t n;
|
||||
|
|
Loading…
Add table
Reference in a new issue