Project

General

Profile

Revision 27

beautifying

View differences:

lab2.c
43 43
extern int no_interrupts;
44 44

  
45 45
int(timer_test_int)(uint8_t time) {
46
    const uint32_t frequency = 60; // Frequency asummed at 60Hz
46 47
    int ipc_status, r;
47 48
    message msg;
48 49
    uint8_t hook = 0;
49 50
    no_interrupts = 0;
50
    int freq = 60; // better way to get the frequency of the timer???
51 51
    timer_subscribe_int(&hook);
52 52
    int irq_set = BIT(hook);
53 53
    while (time) {
......
61 61
                case HARDWARE: /* hardware interrupt notification */
62 62
                    if (msg.m_notify.interrupts & irq_set) { /* subscribed interrupt */
63 63
                        timer_int_handler();
64
                        if (!(no_interrupts % freq)) {
64
                        if (!(no_interrupts % frequency)) {
65 65
                            timer_print_elapsed_time();
66 66
                            time--;
67 67
                        }

Also available in: Unified diff