桌面小屏幕实战课程: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);
    }
}
相关推荐
余生皆假期-12 小时前
永磁同步电机二次起步处理
单片机·嵌入式硬件
DLGXY14 小时前
STM32——TIM定时器、定时中断、RCC时序(八)
stm32·单片机·嵌入式硬件
CQ_YM14 小时前
ARM之I2C
arm开发·单片机·嵌入式硬件·嵌入式
让世界再也没有bug14 小时前
测试工具之一 ------示波器
单片机·嵌入式硬件·硬件测试·嵌入式软件测试
CircuitWizard14 小时前
STM32 + 淘晶驰T1串口屏波形显示
stm32·单片机·嵌入式硬件
Q_219327645516 小时前
基于单片机的个性化服装尺寸红外 测量仪的设计
单片机·嵌入式硬件
Polanda。17 小时前
定时器-PWM参数测量实验
stm32·单片机·嵌入式硬件
恶魔泡泡糖18 小时前
51单片机串口通信
c语言·单片机·嵌入式硬件·51单片机
wotaifuzao18 小时前
【Keil 5安装】keil 5最新版本安装+环境配置+下载百度资源分享(安装包,注册机等)
stm32·单片机·嵌入式硬件·mcu·学习·keil5·最新keil
方芯半导体19 小时前
EtherCAT “通信 + 控制“ 的全国产化控制方案,ESC芯片(FCE1323)与国产MCU芯片功能板解析
xml·网络·单片机·嵌入式硬件·网络协议·机器人·自动化