桌面小屏幕实战课程: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);
    }
}
相关推荐
邹诗钰-电子信息工程18 分钟前
bmp280的压力数据采集(i2c设备驱动+设备树编写)
stm32·单片机·嵌入式硬件
Ronin-Lotus4 小时前
嵌入式硬件篇---有线串口通信问题解决
单片机·嵌入式硬件·ttl·rs232·rs485·有线串口
GalaxySinCos6 小时前
08 51单片机之串口通信
单片机·嵌入式硬件·51单片机
悠哉悠哉愿意6 小时前
【电赛学习笔记】MaxiCAM 项目实践——与单片机的串口通信
笔记·python·单片机·嵌入式硬件·学习·视觉检测
李某学编程8 小时前
Cortex-M内核SysTick定时器介绍
stm32·单片机
李永奉8 小时前
STM32-定时器的基本定时/计数功能实现配置教程(寄存器版)
c语言·开发语言·stm32·单片机·嵌入式硬件
糖糖单片机设计9 小时前
硬件开发_基于STM32单片机的电脑底座系统
stm32·单片机·嵌入式硬件·物联网·51单片机
IT项目分享12 小时前
ESP32入门实战:PC远程控制LED灯完整指南
单片机·嵌入式硬件·micropython·it项目网
Electrical_IT14 小时前
STM32-PWM输入捕获的配置
stm32·单片机
风吹花中花吹风15 小时前
原创-锐能微82xx系列电能计量芯片软件驱动开发与精度校准流程完全指南
驱动开发·单片机·嵌入式硬件·锐能微·计量芯片·精度校准·电能表校准