본문 바로가기

12 FreeRTOS Tutorial: Direct To Task Notifications part2 https://www.youtube.com/watch?v=cv9VIotr4Ms&list=PLEfMFrwVdbPYzMgeaLiFRb4ogjV8m3lt6&index=13&t=0s TaskHandle_t myTask1Handle = NULL; TaskHandle_t myTask2Handle = NULL; int notificationValue; void myTask1(void *pvParameters) { TickType_t xDelay = pdMS_TO_TICKS(1000); TickType_t myLastUnblock; myLastUnblock = xTaskGetTickCount(); for(;;) { xTaskNotify(myTask2Handle , 0 , eNoAction); //notification..
11 FreeRTOS Tutorial: Direct To Task Notifications part1 https://www.youtube.com/watch?v=Ht7QRfUvWsI&list=PLEfMFrwVdbPYzMgeaLiFRb4ogjV8m3lt6&index=12&t=0s /* USER CODE BEGIN 0 */ TaskHandle_t myTask1Handle = NULL; TaskHandle_t myTask2Handle = NULL; void myTask1(void *pvParameters) { TickType_t xDelay = pdMS_TO_TICKS(1000); TickType_t myLastUnblock; myLastUnblock = xTaskGetTickCount(); for(;;) { xTaskNotifyGive(myTask2Handle); vTaskDelay(1000); } } voi..
정수를 문자열로 변환하기 이번에는 정수를 문자열 형태로 변환하는 방법입니다. sprintf 함수를 사용하면 정수를 문자열로 변환할 수 있습니다(stdio.h 헤더 파일에 선언되어 있습니다). sprintf(문자열, "%d", 정수); sprintf(문자열, "%x", 정수); sprintf(문자열, "%X", 정수); 다음 내용을 소스 코드 편집 창에 입력한 뒤 실행해보세요. #define _CRT_SECURE_NO_WARNINGS // sprintf 보안 경고로 인한 컴파일 에러 방지 #include // sprintf 함수가 선언된 헤더 파일 int main() { char s1[10]; // 변환한 문자열을 저장할 배열 int num1 = 283; // 283은 정수 sprintf(s1, "%d", num1); // %d를..
10 FreeRTOS Tutorial: Queues part2 https://www.youtube.com/watch?v=Z-XD3Q7Hqps&list=PLEfMFrwVdbPYzMgeaLiFRb4ogjV8m3lt6&index=10 TaskHandle_t myTask1Handle = NULL; TaskHandle_t myTask2Handle = NULL; QueueHandle_t myQueue; void myTask1(void *pvParameters) { TickType_t xDelay = pdMS_TO_TICKS(1000); TickType_t myLastUnblock; myLastUnblock = xTaskGetTickCount(); char myTxBuff[30]; myQueue = xQueueCreate( 5 , sizeof(myTxBuff) ); //size..
09 FreeRTOS Tutorial: Queues part1 https://www.youtube.com/watch?v=elgkseFUpmk TaskHandle_t myTask1Handle = NULL; TaskHandle_t myTask2Handle = NULL; QueueHandle_t myQueue; void myTask1(void *pvParameters) { TickType_t xDelay = pdMS_TO_TICKS(1000); TickType_t myLastUnblock; myLastUnblock = xTaskGetTickCount(); char myTxBuff[30]; myQueue = xQueueCreate( 5 , sizeof(myTxBuff) ); //size of queue (number of block), size of each block s..
08 FreeRTOS Tutorial: Task Utilities part2 이번 시간에는 TaskState에 대해 받아오는 것을 해본다. https://www.youtube.com/watch?v=hh8huHGpYLA void myTask1(void *pvParameters) { TickType_t xDelay = pdMS_TO_TICKS(1000); TickType_t myLastUnblock; myLastUnblock = xTaskGetTickCount(); //char* text = "Task1\r\n"; //char* text = pcTaskGetName(myTask1Handle); char* text = "Task1"; int count = 0; vTaskSuspend(myTask1Handle); for(;;) { vTaskDelayUntil( &myLastUnblock..
07 FreeRTOS Tutorial: Task Utilities part1 https://www.youtube.com/watch?v=cUO_Hn6536s TaskHandle_t myTask1Handle = NULL; TaskHandle_t myTask2Handle = NULL; void myTask1(void *pvParameters) { TickType_t xDelay = pdMS_TO_TICKS(1000); TickType_t myLastUnblock; myLastUnblock = xTaskGetTickCount(); //char* text = "Task1\r\n"; char* text = pcTaskGetName(myTask1Handle); int count = 0; for(;;) { HAL_UART_Transmit(&huart2, (uint8_t *)text,strlen..
#ifndef ~ #endif 구조체 중복 정의로 인해 발생하는 오류 ☞ 일단 main.c에서 point.h를 포함한다. 그리고 pointOperation.h를 포함하는데, pointOperation.h가 point.h를 포함하므로 결과적으로 main.c는 point.h를 두 번 포함하는 셈이 된다. 전처리기는 이를 문제삼지 않는다. 전처리기는 #include 문의 명령대로 main.c에 구조체 point의 정의를 두 번 포함시킬 뿐이다. 문제는 컴파일러가 일으킨다. 컴파일러는 point 구조체의 정의가 두 번 등장했음 을 인식하고 에러메시지를 발생시킨다. ♠ 중복 정의를 피하기 위한 매크로 #ifndef ~ #endif ☞ ifndef는 "If not defined"의 약자로서 "~을 정의(define)하지 않았다면" 이라는 뜻이다..