Make example slightly more complex
This commit is contained in:
parent
5825ce763c
commit
a63d6b61c9
1 changed files with 7 additions and 6 deletions
|
@ -10,10 +10,11 @@ void task1(void *pvParameters)
|
|||
{
|
||||
xQueueHandle *queue = (xQueueHandle *)pvParameters;
|
||||
printf("Hello from task1!\r\n");
|
||||
uint32_t count = 0;
|
||||
while(1) {
|
||||
char msg = 'c';
|
||||
vTaskDelay(100);
|
||||
xQueueSend(*queue, &msg, 0);
|
||||
xQueueSend(*queue, &count, 0);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,9 +23,9 @@ void task2(void *pvParameters)
|
|||
printf("Hello from task 2!\r\n");
|
||||
xQueueHandle *queue = (xQueueHandle *)pvParameters;
|
||||
while(1) {
|
||||
char msg;
|
||||
if(xQueueReceive(*queue, &msg, 1000)) {
|
||||
printf("Got %c\n", msg);
|
||||
uint32_t count;
|
||||
if(xQueueReceive(*queue, &count, 1000)) {
|
||||
printf("Got %d\n", count);
|
||||
} else {
|
||||
printf("No msg :(\n");
|
||||
}
|
||||
|
@ -37,7 +38,7 @@ void user_init(void)
|
|||
{
|
||||
uart_div_modify(0, UART_CLK_FREQ / 115200);
|
||||
printf("SDK version:%s\n", system_get_sdk_version());
|
||||
mainqueue = xQueueCreate(10, 1);
|
||||
mainqueue = xQueueCreate(10, sizeof(uint32_t));
|
||||
xTaskCreate(task1, (signed char *)"tsk1", 256, &mainqueue, 2, NULL);
|
||||
xTaskCreate(task2, (signed char *)"tsk2", 256, &mainqueue, 2, NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue