基于esp32平台.
#include <inttypes.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
void task1(void *p) {
printf("task1\n");
BaseType_t a = 0;
while (1) {
a++;
vTaskDelay(pdMS_TO_TICKS(1000));
printf("task1:%d\n",a);
}
}
void task2(void *p) {
printf("task2\n");
BaseType_t a = 0;
while (1) {
a++;
vTaskDelay(pdMS_TO_TICKS(1000));
printf("task2:%d\n",a);
}
}
void vApplicationIdleHook( void ){
printf("vApplicationIdleHook\n");
}
void app_main(void) {
TickType_t b = 200;
BaseType_t a = 100;
printf("%d\n", a);
printf("%ld\n", b);
BaseType_t *c;
c = (BaseType_t*) pvPortMalloc(sizeof(BaseType_t));
*c = 300;
printf("%d\n", *c);
vPortFree(c);
xTaskCreate(&task1, "hid_task", 2048, NULL, configMAX_PRIORITIES-1, NULL);
xTaskCreate(&task2, "hid_task", 2048, NULL, 0, NULL);
return;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)