EasyManua.ls Logo

Espressif Systems ESP8266EX - How to Port Apps from Non-OS SDK to RTOS SDK

Espressif Systems ESP8266EX
41 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
!
3. Sample Codes
3. Power off the module, and change it to operation mode; then power on the module and
run the program.
Result:
rtc_time:󰲧1613921
cal:󰲧6.406
3.2.11. How to Port Apps from Non-OS SDK to RTOS SDK
1. Codes for setting the timer do not need to be revised.
2. Codes for executing callback functions do not need to be revised.
3. The method of creating a new task should be revised. When creating a new task, RTOS
SDK uses xTaskCreate, a self-contained interface owned by freeRTOS.
Non-OS SDK: creating a new task
#define󰲧Q_NUM󰲧󰲧(10)
ETSEvent󰲧test_q[Q_NUM];
void󰲧test_task(ETSEvent󰲧*e)
{
󰲧󰲧󰲧󰲧switch(e->sig)
󰲧󰲧󰲧󰲧{
󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧case󰲧1:
󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧func1(e->par);
󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧break;
󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧case󰲧2:
󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧func2();
󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧break;
󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧case󰲧3:
󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧func3();
󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧break;
󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧default:
󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧󰲧break;
󰲧󰲧󰲧󰲧}
}
void󰲧func_send_Sig(void)
{
󰲧󰲧󰲧󰲧ETSSignal󰲧sig󰲧=󰲧2;
󰲧󰲧󰲧󰲧system_os_post(2,sig,0);
}
void󰲧task_ini(void)
{
󰲧󰲧󰲧󰲧system_os_task(test_task,󰲧2,󰲧test_q,Q_NUM);
Espressif
! /!15 37
2017.05

Other manuals for Espressif Systems ESP8266EX

Related product manuals