-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTarefaTeste.c
More file actions
135 lines (106 loc) · 2.72 KB
/
TarefaTeste.c
File metadata and controls
135 lines (106 loc) · 2.72 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
* TarefaTeste.h
*
* Created on: 7 de dez de 2016
* Author: willian
*/
/* Standard includes. */
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
/* MCU includes */
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/debug.h"
/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "TarefaTeste.h"
#include "ctrDriver.h" // Driver Controllers
#include "drvUART.h"
#define modulo_teste 0
// Task to Echo the UART (send and receive the same string)
void TestTask1(void *parameters)
{
// To avoid warning
// Evitar avisos do compilador
(void) parameters;
//initialSet Conf;
//Conf.module = 0;
// Install the driver of the UART -> DRV_UART
initDriver(DRV_UART);
uartConf Teste;
//Teste.module = 0; // UART Mod 0
Teste.module = modulo_teste; // UART Mod 0
//Teste.baudrate = 115200; // 115200 of Baud Rate
Teste.baudrate = 9600; // 9600 of Baud Rate
Teste.databits = 8; // 8-n-1 data bits
Teste.stopbits = 1; // 0 stop bits
Teste.parity = 0; // none parity
// Call the function to Configurate the UART
// Chama a funcao para configurar a UART
//UARTEnable(UART0_BASE);
callDriver(DRV_UART,CONFIG_UART,&Teste);
message M;
M.module = modulo_teste;
M.value = "Teste\r\n";
M.size = strlen(M.value);
// Call the function to Send via UART
// Chama a funcao para enviar via UART
callDriver(DRV_UART,SEND_STRING_UART,&M);
getChar g;
g.module = modulo_teste;
g.character = 'A';
callDriver(DRV_UART,SEND_CHAR_UART,&g);
callDriver(DRV_UART,SEND_CHAR_UART,&g);
while(1)
{
// Echo/ Eco
callDriver(DRV_UART,RECEIVE_UART,&g);
callDriver(DRV_UART,SEND_CHAR_UART,&g);
vTaskDelay(100);
}
}
// Task to receive via UART
void TestTask2(void *parameters)
{
// Install the driver of the UART -> DRV_UART
//initDriver(DRV_UART);
vTaskDelay(5000);
//UARTEnable(UART1_BASE);
uartConf Teste;
//Teste.module = 1; // UART Mod 0
Teste.module = 1; // UART Mod 0
//Teste.baudrate = 115200; // 115200 of Baud Rate
Teste.baudrate = 115200; // 9600 of Baud Rate
Teste.databits = 8; // 8-n-1 data bits
Teste.stopbits = 1; // 0 stop bits
Teste.parity = 0; // none parity
// Call the function to Configurate the UART
// Chama a funcao para configurar a UART
callDriver(DRV_UART,CONFIG_UART,&Teste);
int i=0;
//getChar g;
//g.module = 1;
//g.character = 'G';
message M;
M.module = 1;
M.value = "UART1\r\n";
M.size = strlen(M.value);
while(1)
{
//i++;
callDriver(DRV_UART,SEND_STRING_UART,&M);
vTaskDelay(1000);
}
}