-
Notifications
You must be signed in to change notification settings - Fork 0
/
freertos_Test2.c
63 lines (46 loc) · 966 Bytes
/
freertos_Test2.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
#include "freertos/FreeRTOSConfig.h"
#include "freertos/include/FreeRTOS.h"
#include "freertos/include/task.h"
#include "LIB/BITMATH.h"
#include "LIB/STD_Type.h"
#include "MCAL/UART/UART_Interface.h"
#include "MCAL/DIO/DIO_interface.h"
#define F_CPU 16000000
void LED_0(void* copy_pvParameter);
void Switch_0(void* copy_pvParameter);
static u8 flag=0;
int main(void) {
DIO_Vid_Set_Pin_Dir(PORTC,PIN2,OUTPUT);
DIO_Vid_Set_Pin_Dir(PORTB,PIN0,INPUT);
xTaskCreate(&LED_0,(const char*)"Task_1",100,NULL,1,NULL);
xTaskCreate(&Switch_0,(const char*)"Task_2",100,NULL,2,NULL);
vTaskStartScheduler();
while (1)
{
}
}
void LED_0(void* copy_pvParameter)
{
while(1)
{
vTaskDelay(500);
if(flag==1)
{
DIO_Vid_Toggle_Pin_Val(PORTC,PIN2);
flag=0;
}
}
}
void Switch_0 (void* copy_pvParameter)
{
u8 Loc_State;
while(1)
{
vTaskDelay(100);
Loc_State=DIO_u8_Get_Pin_Val(PORTB,PIN0);
if(Loc_State==1)
{
flag=1;
}
}
}