teamALI / Mbed 2 deprecated HB2018

Dependencies:   mbed FreeRTOS

Committer:
takeru0x1103
Date:
Wed Nov 28 01:31:46 2018 +0000
Revision:
16:05b9e44889f1
Parent:
14:76a56d517103
Child:
17:f9610f3cfa1b
???????INT??????

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 16:05b9e44889f1 5 //#include "led.h"
takeru0x1103 1:15ab74f0d0f1 6 #include "command.h"
takeru0x1103 16:05b9e44889f1 7 #include "hbManager.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 16:05b9e44889f1 17
takeru0x1103 16:05b9e44889f1 18 long tmp;
takeru0x1103 16:05b9e44889f1 19 /*
takeru0x1103 16:05b9e44889f1 20 tmp = strtol( "0x0001" , NULL , 16);//Z軸角速度
takeru0x1103 16:05b9e44889f1 21 sp.printf("%d(%X)\r\n",tmp,tmp);
takeru0x1103 1:15ab74f0d0f1 22
takeru0x1103 16:05b9e44889f1 23 tmp = strtol( "0xFFFE" , NULL , 16);//Z軸角速度
takeru0x1103 16:05b9e44889f1 24 sp.printf("%d(%X)\r\n",tmp,tmp);
takeru0x1103 16:05b9e44889f1 25 */
takeru0x1103 16:05b9e44889f1 26
takeru0x1103 1:15ab74f0d0f1 27 int8_t *pcTaskName;
takeru0x1103 8:1ca49cb18290 28 portTickType xLastWakeTime;
MasashiNomura 14:76a56d517103 29 Gyro gy(p28,p27);
takeru0x1103 8:1ca49cb18290 30
takeru0x1103 1:15ab74f0d0f1 31 pcTaskName = (int8_t *) pvParameters;
takeru0x1103 1:15ab74f0d0f1 32 xLastWakeTime = xTaskGetTickCount();
takeru0x1103 8:1ca49cb18290 33
takeru0x1103 1:15ab74f0d0f1 34 while(1){
takeru0x1103 16:05b9e44889f1 35 led1=!led1;
takeru0x1103 1:15ab74f0d0f1 36
takeru0x1103 8:1ca49cb18290 37 if(!gDebugFlg){
takeru0x1103 1:15ab74f0d0f1 38 userTest();
takeru0x1103 1:15ab74f0d0f1 39 }
takeru0x1103 1:15ab74f0d0f1 40
takeru0x1103 1:15ab74f0d0f1 41 //次の周期まで待つ
takeru0x1103 16:05b9e44889f1 42 sp.printf("%0.2f\t%d\r\n",gy.GetAngle(),gy.GetAngularRate());
takeru0x1103 8:1ca49cb18290 43
takeru0x1103 8:1ca49cb18290 44 if(gfSetYawRef){gy.SetYawRef();}
takeru0x1103 8:1ca49cb18290 45
takeru0x1103 1:15ab74f0d0f1 46 vTaskDelayUntil(&xLastWakeTime, 20 / portTICK_RATE_MS );
takeru0x1103 1:15ab74f0d0f1 47 }
takeru0x1103 1:15ab74f0d0f1 48 }
takeru0x1103 1:15ab74f0d0f1 49
takeru0x1103 1:15ab74f0d0f1 50 //-------------------------------------------------------------
takeru0x1103 1:15ab74f0d0f1 51 //初期化
takeru0x1103 1:15ab74f0d0f1 52 //-------------------------------------------------------------
takeru0x1103 1:15ab74f0d0f1 53 void taskInit(){
takeru0x1103 1:15ab74f0d0f1 54 portBASE_TYPE TaskRtn;
takeru0x1103 1:15ab74f0d0f1 55 TaskRtn= xTaskCreate(task50Hz, (signed portCHAR *)"TaskB", 192, NULL, 1, NULL);
takeru0x1103 1:15ab74f0d0f1 56 //
takeru0x1103 8:1ca49cb18290 57 if(TaskRtn==pdTRUE){
takeru0x1103 8:1ca49cb18290 58 printf("task1 OK\r\n");
takeru0x1103 8:1ca49cb18290 59 }
takeru0x1103 8:1ca49cb18290 60
takeru0x1103 1:15ab74f0d0f1 61 //カーネルの起動
takeru0x1103 1:15ab74f0d0f1 62 vTaskStartScheduler();
takeru0x1103 1:15ab74f0d0f1 63 }
takeru0x1103 1:15ab74f0d0f1 64
takeru0x1103 1:15ab74f0d0f1 65