桌面小屏幕实战课程:DesktopScreen 5 任务创建

飞书文档http://https://x509p6c8to.feishu.cn/docx/doxcnQK95afEkiRfOVqGveLClTY

任务创建

API

FreeRTOS - - ‒ ESP-IDF 编程指南 release-v4.1 文档

复制代码
/* Hello World Example

   This example code is in the Public Domain (or CC0 licensed, at your option.)

   Unless required by applicable law or agreed to in writing, this
   software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
   CONDITIONS OF ANY KIND, either express or implied.
*/
#include <stdio.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_spi_flash.h"
#include "esp_log.h"

#define CHIP_NAME "ESP32"

static const char *TAG = "MAIN APP";

static void test_task_example(void* arg)
{
    for(;;) {
        vTaskDelay(1000 / portTICK_PERIOD_MS);
        printf("task run \n");
    }
}

void app_main(void)
{
    printf("Hello world!\n");

    /* Print chip information */
    esp_chip_info_t chip_info;
    esp_chip_info(&chip_info);
    printf("This is %s chip with %d CPU core(s), WiFi%s%s, ",
            CHIP_NAME,
            chip_info.cores,
            (chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "",
            (chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "");

    printf("silicon revision %d, ", chip_info.revision);

    printf("%dMB %s flash\n", spi_flash_get_chip_size() / (1024 * 1024),
            (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");

    printf("Minimum free heap size: %d bytes\n", esp_get_minimum_free_heap_size());

    ESP_LOGI(TAG, "system init V1.1");

    xTaskCreate(test_task_example, "test_task_example", 2048, NULL, 10, NULL);

    while(1){
        printf("system run ...\n");
        vTaskDelay(1000 / portTICK_PERIOD_MS);
    }
}
相关推荐
无敌贵点大王9 小时前
嵌入式软件面试经(自用)
c语言·stm32·单片机·学习·mongodb·面试·职场和发展
IT规划师9 小时前
MQTT实战 - MQTT vs HTTP:为什么你的物联网项目上线就崩?(二)
物联网·mqtt·.net core·http文件
我是海飞9 小时前
使用杰理 AC7925B 实现 Windows电脑 USB 副屏
windows·单片机·电脑·嵌入式·杰理
我是海飞10 小时前
杰理 JL703N SDK 实现 AI 自动化调试:自动进入下载模式、下载、重启与日志抓取
人工智能·单片机·自动化·音视频·杰理
Zwawa10 小时前
PID 的三个参数之外:位置式、增量式和反馈控制
c语言·单片机·嵌入式
创界工坊工作室10 小时前
29-基于单片机的万年历设计
stm32·单片机·嵌入式硬件·proteus
木由里予11 小时前
NAND 这门生意
运维·服务器·网络·单片机
找方案11 小时前
数字乡镇综合解决方案:从“1+2+3+4”顶层架构到落地建设,一文看懂乡村振兴的数字化打法
物联网·数字化转型·乡村振兴·数字乡镇·智慧乡镇
沐欣工作室_lvyiyi11 小时前
基于STM32的社区养老控制系统设计(论文+源码)
stm32·单片机·嵌入式硬件·社区养老控制系统·保定理工学院·华德学院·淮南师范学院
snow@li12 小时前
单片机:全景梳理核心原理与体系深度分析
单片机·嵌入式硬件