CDC
This commit is contained in:
@@ -8,27 +8,41 @@
|
||||
#include "esp_flash.h"
|
||||
#include "esp_system.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "esp_vfs_dev.h"
|
||||
#include "esp_vfs_cdcacm.h"
|
||||
|
||||
#define LED_GPIO 15
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
// Initialisation explicite du CDC-ACM pour ESP32-S2
|
||||
#if CONFIG_ESP_CONSOLE_USB_CDC
|
||||
esp_err_t ret = esp_vfs_dev_cdcacm_register();
|
||||
if (ret != ESP_OK) {
|
||||
// Si l'initialisation échoue, on continue quand même
|
||||
}
|
||||
#endif
|
||||
|
||||
// Délai pour permettre l'initialisation USB-CDC
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
|
||||
printf("\n\n=== Démarrage ESP32-S2 avec USB-CDC ===\n\n");
|
||||
|
||||
gpio_config_t io_conf = {
|
||||
.pin_bit_mask = LED_GPIO,
|
||||
.pin_bit_mask = (1ULL << 15),
|
||||
.mode = GPIO_MODE_OUTPUT,
|
||||
.pull_up_en = GPIO_PULLUP_DISABLE,
|
||||
.pull_down_en = GPIO_PULLDOWN_DISABLE,
|
||||
.intr_type = GPIO_INTR_DISABLE, // No interrupt for now
|
||||
};
|
||||
|
||||
esp_err_t ret = gpio_config(&io_conf);
|
||||
gpio_config(&io_conf);
|
||||
|
||||
while(1) {
|
||||
printf("hello");
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
printf("loop from ESP32-S2 via USB-CDC!\n");
|
||||
gpio_set_level(LED_GPIO, 1);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
gpio_set_level(LED_GPIO, 0);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user