-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_tests.c
More file actions
74 lines (59 loc) · 1.11 KB
/
main_tests.c
File metadata and controls
74 lines (59 loc) · 1.11 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
#include "lowlevel/clock.h"
#include "lowlevel/gpio.h"
#include "lowlevel/uart.h"
// Here you can list all the test functions
void led_blink();
void all_blink();
void uart_send();
void uart_parrot();
int main() {
clock_setup();
gpio_setup();
uart_setup();
uart_parrot();
// led_blink();
while (1) {};
return 0;
}
void led_blink() {
while(true) {
led_toggle_status();
delay_ms(1000);
}
}
void all_blink() {
while(true) {
set_all_0();
delay_ms(1000);
set_all_1();
delay_ms(1000);
}
}
void uart_send() {
while(true) {
uart_send_string("hello world\n\r");
// led_toggle_status();
delay_ms(300);
}
}
// Should be kinda implemented in a function ?
void uart_parrot() {
char line[80];
uint16_t curr = 0;
while(true) {
led_set_status(0);
if (UART_getc(&line[curr])) {
led_set_status(1);
if (line[curr] == '\r' || line[curr] == '\n') {
line[curr++] = '\n';
line[curr++] = '\r';
line[curr++] = '\0';
uart_send_string(line);
curr = 0;
} else {
curr++;
}
}
delay_ms(30);
}
}