Espressif Systems ESP8266EX Programming Manual page 20

Esp8266 rtos sdk
Hide thumbs Also See for ESP8266EX:
Table of Contents

Advertisement

!
// test_q is the corresponding array of test_task.
// (2) is the priority of test_task.
// Q_NUM is the queue length of test_task.
}
RTOS SDK: creating a new task
#define Q_NUM (10)
xQueueHandle test_q;
xTaskHandle test_task_hdl;
void test_task(void *pvParameters)
{
int *sig;
for(;;) {
if(pdTRUE == xQueueReceive(test_q, &sig, (portTickType)portMAX_DELAY) ){
vTaskSuspendAll();
switch(*sig)
{
case 1:
func1();
break;
case 2:
func2();
break;
default:
break;
}
free(sig);
xTaskResumeAll();
}
}
}
void func_send_Sig(void)
{
int *evt = (int *)malloc(sizeif(int));
*evt = 2;
if(xQueueSend(test_q,&evt,10/portTick_RATE_MS)!=pdTRUE){
os_printf("test_q is full\n");
}
// It is the address of parameter that stored in test_q, so int *evt and int *sig can be
other types.
}
void task_ini(void)
Espressif
16 37
!
/!
3. Sample Codes
2017.05

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP8266EX and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents