Arduino中RTOS学习笔记1
Arduino中RTOS学习笔记[1]
本文是作者自己整理的学习资料,如果侵权请联系删除,如有错误也请指出。
楼主常年生活在国外,所以一些中文译名会有些出入,请见谅。
欢迎有兴趣的同学一起学习进步 =)
常见名称
变量
‘c’ — int8_t = char
‘s’ — int16_t = short
‘l’ — int32_t = long
‘b’ — BaseType_t
‘u’ — unsigned
‘p’ — pointer
… to be added
eg.
pointer to char : pc
uint8_t :uc (unsigned char)
方程
前置首先声明 return type
其次声明定义文件(definition file)
e.g
vTaskFunction() returns a void type and is defined within task.c
xQueueFunction() returns a BaseType and is defined within queue.c
pvTimerFunction() returns a pointer to void and is defined within Timer.c
宏
通常宏用大写,而前缀用小写。
e.g
Macro | Value |
---|---|
pdTRUE | 1 |
pdFALSE | 0 |
pdPASS | 1 |
pdFAIL | 0 |
任务
什么是任务:
task is implemented as a C function.
e,g
void ATaskFunction(void *pvParameters);
is a function that returns void type and the input argument is a pointer to void.
任务的状态
Not running — Running
…to be added
任务创立
BaseType_t xTaskCreate( TaskFunction_t pvTaskCode,
const char * const pcName,
uyint16_t usStackDepth,
void *pvParameters,
UBaseType_t uxPriority,
TaskHandle_t *pxCreatedTask
);
pvTaskCode: a pointer that points to a function that implement the task, i.e. the name of the task function
pcName: descriptive task name, only for debugging purpose
usStackDepth: stack size(number of words[32bits])
*pvParameters: argument pass to the task function
uxPriority: task priority from 0~highest
TaskHandle_t: handle
如果return是1则代表成功创立task,如果是0则失败,通常是因为heap memory不够了。
- 点赞
- 收藏
- 分享
- 文章举报
- ESP8266_RTOS_SDK学习笔记之 FreeRTOS移植浅析
- Kienct与Arduino学习笔记(2) 深度图像与现实世界的深度图的坐标
- Arduino101学习笔记(三)—— 101简介
- 51操作系统学习笔记(三):建立一个属于自己的AVR的RTOS(1)
- Arduino101学习笔记(八)—— 函数库
- Arduino学习笔记 -自制延时函数,可以实现多线程
- arduino学习笔记3 蜂鸣器
- arduino 学习笔记
- arduino学习笔记 一
- 基于Protues的Arduino学习笔记01-Arduino UNO实验板设计
- arduino学习笔记1 hello world和LED灯的使用
- ROS学习笔记-序(基于树莓派,ROS,arduino,激光雷达SLAM的扫地机器人)
- Arduino学习笔记 -入门
- Arduino学习笔记01――单个LED灯闪烁
- arduino学习笔记
- Arduino学习笔记 函数的秘密~~~
- Arduino学习笔记2--安装Arduino系统
- Arduino学习笔记之 Arduino的串口输出
- 【学习笔记】arduino mega2560 和 ESP8266WIFI模块 联合调试 ①
- Arduino学习笔记—Arduino编程基础