root / lab2 / lab2.c @ 19
History | View | Annotate | Download (1.29 KB)
1 | 4 | up20180655 | #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 | 6 | up20180642 | int(timer_test_read_config)(uint8_t timer, enum timer_status_field field){ |
33 | 5 | up20180642 | uint8_t state = 0;
|
34 | if(timer_get_conf(timer, &state)) return 1; |
||
35 | 6 | up20180642 | if(timer_display_conf(timer, state, field)) return 1; |
36 | 5 | up20180642 | return 0; |
37 | 4 | up20180655 | } |
38 | |||
39 | int(timer_test_time_base)(uint8_t timer, uint32_t freq) {
|
||
40 | 15 | up20180655 | if (timer_set_frequency(timer, freq)) return 1; |
41 | return 0; |
||
42 | 4 | up20180655 | } |
43 | |||
44 | int(timer_test_int)(uint8_t time) {
|
||
45 | /* To be implemented by the students */
|
||
46 | printf("%s is not yet implemented!\n", __func__);
|
||
47 | |||
48 | return 1; |
||
49 | } |