forked from russlank/FreeRTOS710-template-for-ATmega328P
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
110 lines (85 loc) · 2.71 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/******************************************************************************
* Header file inclusions.
******************************************************************************/
#include "FreeRTOS.h"
#include "semphr.h"
#include "task.h"
#include "queue.h"
#include <avr/io.h>
#include "extras/serial.h"
/******************************************************************************
* Private macro definitions.
******************************************************************************/
#define sbi(x,y) x |= _BV(y) //set bit
#define cbi(x,y) x &= ~(_BV(y)) //clear bit
#define ibi(x,y) x ^= _BV(y) //flip bit
#define my_TASK_PRIORITY (tskIDLE_PRIORITY)
/******************************************************************************
* Private function prototypes.
******************************************************************************/
static void vTask1(void* pvParameters);
static void vTask2(void* pvParameters);
static void vTask3(void* pvParameters);
/**************************************************************************//**
* \fn int main(void)
*
* \brief Main function.
*
* \return
******************************************************************************/
int main(void)
{
{
xTaskHandle handle1;
xTaskHandle handle2;
xTaskHandle handle3;
xTaskCreate( vTask1, (signed char*)"task01", configMINIMAL_STACK_SIZE, NULL, my_TASK_PRIORITY + 0, &handle1);
xTaskCreate( vTask2, (signed char*)"task02", configMINIMAL_STACK_SIZE, NULL, my_TASK_PRIORITY + 1, &handle2);
xTaskCreate( vTask3, (signed char*)"task03", configMINIMAL_STACK_SIZE, NULL, my_TASK_PRIORITY + 3, &handle3);
}
// Start scheduler.
vTaskStartScheduler();
return 0;
}
/**************************************************************************//**
* \fn static vApplicationIdleHook(void)
*
* \brief
******************************************************************************/
void vApplicationIdleHook(void)
{
}
/******************************************************************************
* Private function definitions.
******************************************************************************/
/**************************************************************************//**
* \fn static void vBlinkLed(void* pvParameters)
*
* \brief
*
* \param[in] pvParameters
******************************************************************************/
static void vTask1(void* pvParameters)
{
for(;;)
{
//...
}
vTaskDelete( NULL);
}
static void vTask2(void* pvParameters)
{
for(;;)
{
//...
}
vTaskDelete( NULL);
}
static void vTask3(void* pvParameters)
{
for(;;)
{
//...
}
vTaskDelete( NULL);
}