main: init USB CDC ACM
This commit is contained in:
parent
83501e3b60
commit
3905220c12
23
main/main.c
23
main/main.c
|
@ -2,8 +2,31 @@
|
|||
* Copyright 2022 King Kévin <kingkevin@cuvoodoo.info>
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/reent.h>
|
||||
#include "esp_log.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "tinyusb.h"
|
||||
#include "tusb_cdc_acm.h"
|
||||
#include "tusb_console.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
static const char *TAG = "main";
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
// setup USB CDC ACM for printing
|
||||
ESP_LOGI(TAG, "USB initialization");
|
||||
tinyusb_config_t tusb_cfg = { 0 }; // the configuration uses default values
|
||||
ESP_ERROR_CHECK( tinyusb_driver_install(&tusb_cfg) ); // configure USB
|
||||
tinyusb_config_cdcacm_t amc_cfg = { 0 }; // the configuration uses default values
|
||||
ESP_ERROR_CHECK( tusb_cdc_acm_init(&amc_cfg) ); // configure CDC ACM
|
||||
esp_tusb_init_console(TINYUSB_CDC_ACM_0); // log to USB
|
||||
ESP_LOGI(TAG, "USB initialized");
|
||||
|
||||
ESP_LOGI(TAG, "application ready");
|
||||
while (1) {
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
CONFIG_IDF_TARGET="esp32s2"
|
||||
CONFIG_IDF_TARGET_ESP32S2=y
|
||||
CONFIG_TINYUSB=y
|
||||
CONFIG_TINYUSB_CDC_ENABLED=y
|
Loading…
Reference in New Issue