teamALI / Mbed 2 deprecated HB2018

Dependencies:   mbed FreeRTOS

userTask.cpp

Committer:
MasashiNomura
Date:
2018-11-27
Revision:
14:76a56d517103
Parent:
8:1ca49cb18290
Child:
16:05b9e44889f1

File content as of revision 14:76a56d517103:

//RTOS関連
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "led.h"
#include "command.h"
#include "userOperate.h"
#include "Gyro.h"
#include "uart.h"
#include "globalFlags.h"


//----------------------------------------------------------------
//タスク処理
//----------------------------------------------------------------
void task50Hz(void *pvParameters){

    int8_t *pcTaskName;
    portTickType xLastWakeTime;
    Gyro    gy(p28,p27);
    
    pcTaskName = (int8_t *) pvParameters;
    xLastWakeTime = xTaskGetTickCount();
    
    while(1){
        ledTggle();
        
        if(!gDebugFlg){
            userTest();
        }
        
        //次の周期まで待つ
        sp.printf("%0.2f,%0.2f\r\n",gy.GetAngle(),gy.GetAngularRate());
        
        if(gfSetYawRef){gy.SetYawRef();}
        
        vTaskDelayUntil(&xLastWakeTime, 20 / portTICK_RATE_MS );
    }
}

//-------------------------------------------------------------
//初期化
//-------------------------------------------------------------
void taskInit(){
    portBASE_TYPE   TaskRtn;
    TaskRtn= xTaskCreate(task50Hz, (signed portCHAR *)"TaskB", 192, NULL, 1, NULL);
    //
    if(TaskRtn==pdTRUE){
        printf("task1 OK\r\n");
    }
    
    //カーネルの起動
    vTaskStartScheduler();
}