/** * @file main_app.c * @author Alvin Young (impressionyang@outlook.com) * @brief * @version 0.1 * @date 2024-11-25 * * _ _ * (_)_ _ ___ _______ ___ ___ (_)__ ___ __ _____ ____ ___ _ * / / ' \/ _ \/ __/ -_|_-<(_- * Date Version Author Description * 2024-11-25 v1.0 Alvin Young 首次创建 * * */ /* Define to prevent recursive inclusion -------------------------------------*/ /* Includes ------------------------------------------------------------------*/ #include "main_app.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "esp_system.h" #include "esp_chip_info.h" #include "sdkconfig.h" #include #include #include "main_common.h" #include "shell_port.h" /* define --------------------------------------------------------------------*/ /* typedef -------------------------------------------------------------------*/ /* variables -----------------------------------------------------------------*/ static uint8_t print_en = 0; /* Private function(only *.c) -----------------------------------------------*/ uint8_t _set_print_en(int argc, char **argv) { if (argc < 2) { cdc_printf("too few argv\r\n"); } int en_v = atoi(argv[1]); print_en = en_v; return 0; } /* Exported functions --------------------------------------------------------*/ uint8_t imp_main_app_task() { int i = 0; while (1) { if (print_en) { cdc_printf("hello %d\r\n", i++); } vTaskDelay(1000 / portTICK_PERIOD_MS); } return 0; } SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN), main_pe, _set_print_en, set print value); /* * EOF */