teamALI / Mbed 2 deprecated HB2018

Dependencies:   mbed FreeRTOS

Committer:
takeru0x1103
Date:
Mon Nov 26 13:58:16 2018 +0000
Revision:
8:1ca49cb18290
Parent:
1:15ab74f0d0f1
Child:
14:76a56d517103
?????????????12bit?

Who changed what in which revision?

UserRevisionLine numberNew 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 8:1ca49cb18290 8 #include "Gyro.h"
takeru0x1103 8:1ca49cb18290 9 #include "uart.h"
takeru0x1103 8:1ca49cb18290 10 #include "globalFlags.h"
takeru0x1103 1:15ab74f0d0f1 11
takeru0x1103 1:15ab74f0d0f1 12
takeru0x1103 1:15ab74f0d0f1 13 //----------------------------------------------------------------
takeru0x1103 1:15ab74f0d0f1 14 //タスク処理
takeru0x1103 1:15ab74f0d0f1 15 //----------------------------------------------------------------
takeru0x1103 1:15ab74f0d0f1 16 void task50Hz(void *pvParameters){
takeru0x1103 1:15ab74f0d0f1 17
takeru0x1103 1:15ab74f0d0f1 18 int8_t *pcTaskName;
takeru0x1103 8:1ca49cb18290 19 portTickType xLastWakeTime;
takeru0x1103 8:1ca49cb18290 20 Gyro gy;
takeru0x1103 8:1ca49cb18290 21
takeru0x1103 1:15ab74f0d0f1 22 pcTaskName = (int8_t *) pvParameters;
takeru0x1103 1:15ab74f0d0f1 23 xLastWakeTime = xTaskGetTickCount();
takeru0x1103 8:1ca49cb18290 24
takeru0x1103 1:15ab74f0d0f1 25 while(1){
takeru0x1103 1:15ab74f0d0f1 26 ledTggle();
takeru0x1103 1:15ab74f0d0f1 27
takeru0x1103 8:1ca49cb18290 28 if(!gDebugFlg){
takeru0x1103 1:15ab74f0d0f1 29 userTest();
takeru0x1103 1:15ab74f0d0f1 30 }
takeru0x1103 1:15ab74f0d0f1 31
takeru0x1103 1:15ab74f0d0f1 32 //次の周期まで待つ
takeru0x1103 8:1ca49cb18290 33 sp.printf("%0.2f,%0.2f\r\n",gy.GetAngle(),gy.GetAngularRate());
takeru0x1103 8:1ca49cb18290 34
takeru0x1103 8:1ca49cb18290 35 if(gfSetYawRef){gy.SetYawRef();}
takeru0x1103 8:1ca49cb18290 36
takeru0x1103 1:15ab74f0d0f1 37 vTaskDelayUntil(&xLastWakeTime, 20 / portTICK_RATE_MS );
takeru0x1103 1:15ab74f0d0f1 38 }
takeru0x1103 1:15ab74f0d0f1 39 }
takeru0x1103 1:15ab74f0d0f1 40
takeru0x1103 1:15ab74f0d0f1 41 //-------------------------------------------------------------
takeru0x1103 1:15ab74f0d0f1 42 //初期化
takeru0x1103 1:15ab74f0d0f1 43 //-------------------------------------------------------------
takeru0x1103 1:15ab74f0d0f1 44 void taskInit(){
takeru0x1103 1:15ab74f0d0f1 45 portBASE_TYPE TaskRtn;
takeru0x1103 1:15ab74f0d0f1 46 TaskRtn= xTaskCreate(task50Hz, (signed portCHAR *)"TaskB", 192, NULL, 1, NULL);
takeru0x1103 1:15ab74f0d0f1 47 //
takeru0x1103 8:1ca49cb18290 48 if(TaskRtn==pdTRUE){
takeru0x1103 8:1ca49cb18290 49 printf("task1 OK\r\n");
takeru0x1103 8:1ca49cb18290 50 }
takeru0x1103 8:1ca49cb18290 51
takeru0x1103 1:15ab74f0d0f1 52 //カーネルの起動
takeru0x1103 1:15ab74f0d0f1 53 vTaskStartScheduler();
takeru0x1103 1:15ab74f0d0f1 54 }
takeru0x1103 1:15ab74f0d0f1 55
takeru0x1103 1:15ab74f0d0f1 56