桌面小屏幕实战课程: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);
    }
}
相关推荐
传感器与混合集成电路4 小时前
电流频率转换模块选型要考虑哪些参数?量程匹配、精度等级与封装形式的综合决策
单片机·嵌入式硬件
JNX_SEMI4 小时前
AT2659 L1频段多模卫星导航低噪声放大器技术解析
前端·单片机·嵌入式硬件·物联网·硬件工程
zlinear数据采集卡5 小时前
从协议解析到波形实时显示:硬核拆解ZLinear采集卡上位机软件的开发架构
arm开发·单片机·嵌入式硬件·fpga开发·架构·开源
会周易的程序员6 小时前
microLog 后端开发指南
开发语言·c++·物联网·设计模式·日志·iot·aiot
GuHenryCheng7 小时前
【ESP32】ESP-IDF开发环境搭建(cursor)
git·stm32·单片机·学习
xyz_CDragon8 小时前
OpenAI发布首款自研芯片Jalapeño:9个月流片,AI设计芯片的时代来了
人工智能·单片机·深度学习·神经网络·芯片设计
青衫嵌入式9 小时前
FreeRTOS 链表源码深度解析:从数据结构到调度内核的基石
物联网
wuyk5559 小时前
25. 函数指针表:用查表替代 switch-case,打造高效可维护的嵌入式状态机
c语言·stm32·单片机·mcu·51单片机
灯厂码农9 小时前
STM32三大通信协议详解——UART、I2C、SPI
stm32·单片机·嵌入式硬件
来生硬件工程师10 小时前
【硬件笔记】DCDC电源设计—BUCK电路设计要点
笔记·单片机·嵌入式硬件·硬件工程·智能硬件