Experimenting w/FreeRTOS

Dependencies:   FreeRTOS mbed MMA7660 LM75B

Committer:
tkatolrnmcu
Date:
Sat Aug 19 06:11:07 2017 +0000
Revision:
0:ef389421b079
Child:
1:1990d6e600c2
2 tasks created

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tkatolrnmcu 0:ef389421b079 1 #include "mbed.h"
tkatolrnmcu 0:ef389421b079 2 #include "FreeRTOS.h"
tkatolrnmcu 0:ef389421b079 3 #include "task.h"
tkatolrnmcu 0:ef389421b079 4
tkatolrnmcu 0:ef389421b079 5 DigitalOut myled(LED1);
tkatolrnmcu 0:ef389421b079 6
tkatolrnmcu 0:ef389421b079 7 void vHello(void *pvParameters);
tkatolrnmcu 0:ef389421b079 8 void vGbye(void *pvParameters);
tkatolrnmcu 0:ef389421b079 9
tkatolrnmcu 0:ef389421b079 10 int main() {
tkatolrnmcu 0:ef389421b079 11 /*while(1) {
tkatolrnmcu 0:ef389421b079 12 myled = 1;
tkatolrnmcu 0:ef389421b079 13 wait(0.2);
tkatolrnmcu 0:ef389421b079 14 myled = 0;
tkatolrnmcu 0:ef389421b079 15 wait(0.2);
tkatolrnmcu 0:ef389421b079 16 }*/
tkatolrnmcu 0:ef389421b079 17
tkatolrnmcu 0:ef389421b079 18
tkatolrnmcu 0:ef389421b079 19 xTaskCreate(vHello, "HELLO", configMINIMAL_STACK_SIZE, (void*)NULL, tskIDLE_PRIORITY, NULL);
tkatolrnmcu 0:ef389421b079 20
tkatolrnmcu 0:ef389421b079 21 xTaskCreate(vGbye, "BYE", configMINIMAL_STACK_SIZE, (void*)NULL, tskIDLE_PRIORITY, NULL);
tkatolrnmcu 0:ef389421b079 22
tkatolrnmcu 0:ef389421b079 23
tkatolrnmcu 0:ef389421b079 24 for (;;);
tkatolrnmcu 0:ef389421b079 25 }
tkatolrnmcu 0:ef389421b079 26
tkatolrnmcu 0:ef389421b079 27 void vHello(void *pvParameters)
tkatolrnmcu 0:ef389421b079 28 {
tkatolrnmcu 0:ef389421b079 29 int *ptr;
tkatolrnmcu 0:ef389421b079 30 ptr = (int *)pvParameters;
tkatolrnmcu 0:ef389421b079 31
tkatolrnmcu 0:ef389421b079 32 for(;;)
tkatolrnmcu 0:ef389421b079 33 {
tkatolrnmcu 0:ef389421b079 34 printf("Hello World!\n");
tkatolrnmcu 0:ef389421b079 35 }
tkatolrnmcu 0:ef389421b079 36 }
tkatolrnmcu 0:ef389421b079 37
tkatolrnmcu 0:ef389421b079 38 void vGbye(void *pvParameters)
tkatolrnmcu 0:ef389421b079 39 {
tkatolrnmcu 0:ef389421b079 40 int *ptr;
tkatolrnmcu 0:ef389421b079 41 ptr = (int *)pvParameters;
tkatolrnmcu 0:ef389421b079 42
tkatolrnmcu 0:ef389421b079 43 for(;;)
tkatolrnmcu 0:ef389421b079 44 {
tkatolrnmcu 0:ef389421b079 45 printf("Goodbye World!\n");
tkatolrnmcu 0:ef389421b079 46 }
tkatolrnmcu 0:ef389421b079 47 }