Revision 27
beautifying
timer.c | ||
---|---|---|
8 | 8 |
int (timer_set_frequency)(uint8_t timer, uint32_t freq) { |
9 | 9 |
|
10 | 10 |
// Frequencies out this range are not supported (by limitation of hardware) |
11 |
if (freq > TIMER_FREQ || freq < TIMER_MIN_FREQ) return 1; |
|
11 |
if (freq > TIMER_FREQ || freq < TIMER_MIN_FREQ) { |
|
12 |
printf("%s: Frequency out of range, must be between %d and %d.\n", __func__, TIMER_MIN_FREQ, TIMER_FREQ); |
|
13 |
return 1; |
|
14 |
} |
|
12 | 15 |
|
13 | 16 |
uint8_t status = 0; |
14 | 17 |
if (timer_get_conf(timer, &status)) return 1; |
... | ... | |
48 | 51 |
return 0; |
49 | 52 |
} |
50 | 53 |
|
51 |
int hook_id = 2;
|
|
54 |
int hook_id; |
|
52 | 55 |
|
53 | 56 |
int (timer_subscribe_int)(uint8_t *bit_no) { |
57 |
hook_id = 2; |
|
54 | 58 |
if(bit_no == NULL) return 1; |
55 | 59 |
*bit_no = hook_id; |
56 |
if(sys_irqsetpolicy(TIMER0_IRQ, IRQ_REENABLE, &hook_id)) return 1; |
|
57 |
return 0; |
|
60 |
return sys_irqsetpolicy(TIMER0_IRQ, IRQ_REENABLE, &hook_id); |
|
58 | 61 |
} |
59 | 62 |
|
60 | 63 |
int (timer_unsubscribe_int)() { |
Also available in: Unified diff