root / lab2 / lab2.c @ 15
History | View | Annotate | Download (1.29 KB)
1 |
#include <lcom/lcf.h> |
---|---|
2 |
#include <lcom/lab2.h> |
3 |
|
4 |
#include <stdbool.h> |
5 |
#include <stdint.h> |
6 |
|
7 |
|
8 |
int main(int argc, char *argv[]) { |
9 |
// sets the language of LCF messages (can be either EN-US or PT-PT)
|
10 |
lcf_set_language("EN-US");
|
11 |
|
12 |
// enables to log function invocations that are being "wrapped" by LCF
|
13 |
// [comment this out if you don't want/need it]
|
14 |
lcf_trace_calls("/home/lcom/labs/lab2/trace.txt");
|
15 |
|
16 |
// enables to save the output of printf function calls on a file
|
17 |
// [comment this out if you don't want/need it]
|
18 |
lcf_log_output("/home/lcom/labs/lab2/output.txt");
|
19 |
|
20 |
// handles control over to LCF
|
21 |
// [LCF handles command line arguments and invokes the right function]
|
22 |
if (lcf_start(argc, argv))
|
23 |
return 1; |
24 |
|
25 |
// LCF clean up tasks
|
26 |
// [must be the last statement before return]
|
27 |
lcf_cleanup(); |
28 |
|
29 |
return 0; |
30 |
} |
31 |
|
32 |
int(timer_test_read_config)(uint8_t timer, enum timer_status_field field){ |
33 |
uint8_t state = 0;
|
34 |
if(timer_get_conf(timer, &state)) return 1; |
35 |
if(timer_display_conf(timer, state, field)) return 1; |
36 |
return 0; |
37 |
} |
38 |
|
39 |
int(timer_test_time_base)(uint8_t timer, uint32_t freq) {
|
40 |
if (timer_set_frequency(timer, freq)) return 1; |
41 |
|
42 |
return 0; |
43 |
} |
44 |
|
45 |
int(timer_test_int)(uint8_t time) {
|
46 |
/* To be implemented by the students */
|
47 |
printf("%s is not yet implemented!\n", __func__);
|
48 |
|
49 |
return 1; |
50 |
} |