Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
userTask.cpp@1:15ab74f0d0f1, 2018-11-24 (annotated)
- Committer:
- takeru0x1103
- Date:
- Sat Nov 24 11:35:48 2018 +0000
- Revision:
- 1:15ab74f0d0f1
- Child:
- 8:1ca49cb18290
8??????;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
takeru0x1103 | 1:15ab74f0d0f1 | 1 | //RTOS関連 |
takeru0x1103 | 1:15ab74f0d0f1 | 2 | #include "FreeRTOS.h" |
takeru0x1103 | 1:15ab74f0d0f1 | 3 | #include "task.h" |
takeru0x1103 | 1:15ab74f0d0f1 | 4 | #include "queue.h" |
takeru0x1103 | 1:15ab74f0d0f1 | 5 | #include "led.h" |
takeru0x1103 | 1:15ab74f0d0f1 | 6 | #include "command.h" |
takeru0x1103 | 1:15ab74f0d0f1 | 7 | #include "userOperate.h" |
takeru0x1103 | 1:15ab74f0d0f1 | 8 | |
takeru0x1103 | 1:15ab74f0d0f1 | 9 | |
takeru0x1103 | 1:15ab74f0d0f1 | 10 | //---------------------------------------------------------------- |
takeru0x1103 | 1:15ab74f0d0f1 | 11 | //タスク処理 |
takeru0x1103 | 1:15ab74f0d0f1 | 12 | //---------------------------------------------------------------- |
takeru0x1103 | 1:15ab74f0d0f1 | 13 | void task50Hz(void *pvParameters){ |
takeru0x1103 | 1:15ab74f0d0f1 | 14 | |
takeru0x1103 | 1:15ab74f0d0f1 | 15 | int8_t *pcTaskName; |
takeru0x1103 | 1:15ab74f0d0f1 | 16 | pcTaskName = (int8_t *) pvParameters; |
takeru0x1103 | 1:15ab74f0d0f1 | 17 | portTickType xLastWakeTime; |
takeru0x1103 | 1:15ab74f0d0f1 | 18 | xLastWakeTime = xTaskGetTickCount(); |
takeru0x1103 | 1:15ab74f0d0f1 | 19 | |
takeru0x1103 | 1:15ab74f0d0f1 | 20 | while(1){ |
takeru0x1103 | 1:15ab74f0d0f1 | 21 | ledTggle(); |
takeru0x1103 | 1:15ab74f0d0f1 | 22 | |
takeru0x1103 | 1:15ab74f0d0f1 | 23 | if(gDebugFlg){ |
takeru0x1103 | 1:15ab74f0d0f1 | 24 | userTest(); |
takeru0x1103 | 1:15ab74f0d0f1 | 25 | }else{ |
takeru0x1103 | 1:15ab74f0d0f1 | 26 | userIdleSet(); |
takeru0x1103 | 1:15ab74f0d0f1 | 27 | } |
takeru0x1103 | 1:15ab74f0d0f1 | 28 | |
takeru0x1103 | 1:15ab74f0d0f1 | 29 | //次の周期まで待つ |
takeru0x1103 | 1:15ab74f0d0f1 | 30 | vTaskDelayUntil(&xLastWakeTime, 20 / portTICK_RATE_MS ); |
takeru0x1103 | 1:15ab74f0d0f1 | 31 | } |
takeru0x1103 | 1:15ab74f0d0f1 | 32 | } |
takeru0x1103 | 1:15ab74f0d0f1 | 33 | |
takeru0x1103 | 1:15ab74f0d0f1 | 34 | //------------------------------------------------------------- |
takeru0x1103 | 1:15ab74f0d0f1 | 35 | //初期化 |
takeru0x1103 | 1:15ab74f0d0f1 | 36 | //------------------------------------------------------------- |
takeru0x1103 | 1:15ab74f0d0f1 | 37 | void taskInit(){ |
takeru0x1103 | 1:15ab74f0d0f1 | 38 | portBASE_TYPE TaskRtn; |
takeru0x1103 | 1:15ab74f0d0f1 | 39 | TaskRtn= xTaskCreate(task50Hz, (signed portCHAR *)"TaskB", 192, NULL, 1, NULL); |
takeru0x1103 | 1:15ab74f0d0f1 | 40 | // |
takeru0x1103 | 1:15ab74f0d0f1 | 41 | if(TaskRtn==pdTRUE){printf("task1 OK\r\n");} |
takeru0x1103 | 1:15ab74f0d0f1 | 42 | //カーネルの起動 |
takeru0x1103 | 1:15ab74f0d0f1 | 43 | vTaskStartScheduler(); |
takeru0x1103 | 1:15ab74f0d0f1 | 44 | } |
takeru0x1103 | 1:15ab74f0d0f1 | 45 | |
takeru0x1103 | 1:15ab74f0d0f1 | 46 |