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.
Diff: userTask.cpp
- Revision:
- 8:1ca49cb18290
- Parent:
- 1:15ab74f0d0f1
- Child:
- 14:76a56d517103
--- a/userTask.cpp Sat Nov 24 11:49:51 2018 +0000 +++ b/userTask.cpp Mon Nov 26 13:58:16 2018 +0000 @@ -5,6 +5,9 @@ #include "led.h" #include "command.h" #include "userOperate.h" +#include "Gyro.h" +#include "uart.h" +#include "globalFlags.h" //---------------------------------------------------------------- @@ -13,20 +16,24 @@ void task50Hz(void *pvParameters){ int8_t *pcTaskName; + portTickType xLastWakeTime; + Gyro gy; + pcTaskName = (int8_t *) pvParameters; - portTickType xLastWakeTime; xLastWakeTime = xTaskGetTickCount(); - + while(1){ ledTggle(); - if(gDebugFlg){ + if(!gDebugFlg){ userTest(); - }else{ - userIdleSet(); } //次の周期まで待つ + sp.printf("%0.2f,%0.2f\r\n",gy.GetAngle(),gy.GetAngularRate()); + + if(gfSetYawRef){gy.SetYawRef();} + vTaskDelayUntil(&xLastWakeTime, 20 / portTICK_RATE_MS ); } } @@ -38,7 +45,10 @@ portBASE_TYPE TaskRtn; TaskRtn= xTaskCreate(task50Hz, (signed portCHAR *)"TaskB", 192, NULL, 1, NULL); // - if(TaskRtn==pdTRUE){printf("task1 OK\r\n");} + if(TaskRtn==pdTRUE){ + printf("task1 OK\r\n"); + } + //カーネルの起動 vTaskStartScheduler(); }