Revisão 88
Changed calculation and some flags
myTimer.h | ||
---|---|---|
1 |
/*
|
|
2 |
* File: myTimer.h
|
|
1 |
/* |
|
2 |
* File: Timer.h |
|
3 | 3 |
* Author: ana |
4 | 4 |
* |
5 |
* Created on 30 de Setembro de 2014, 17:56
|
|
5 |
* Created on 10 de Outubro de 2014, 18:50
|
|
6 | 6 |
*/ |
7 | 7 |
|
8 |
#ifndef MYTIMER_H
|
|
9 |
#define MYTIMER_H
|
|
8 |
#ifndef TIMER_H |
|
9 |
#define TIMER_H |
|
10 | 10 |
|
11 | 11 |
#ifdef __cplusplus |
12 | 12 |
extern "C" { |
13 | 13 |
#endif |
14 | 14 |
|
15 |
int initialize(int tempo); |
|
16 |
void start(); |
|
17 |
void stop(); |
|
18 |
int setInterrupts(short flag, short enable, short priority, short subpriority); |
|
15 |
#define ISR() void __attribute__((interrupt, no_auto_psv)) _ISR(void) |
|
19 | 16 |
|
20 |
/** |
|
21 |
* |
|
22 |
* @param flag Activa a flag. (valor 0 ou 1)
|
|
23 |
* @param enable Activa interrupção. (valor 0 ou 1)
|
|
24 |
* @param priority Atribui prioridade.
|
|
25 |
* @param subpriority Atribui subprioridade.
|
|
26 |
*/ |
|
27 |
void __ISR();
|
|
17 |
/**
|
|
18 |
*
|
|
19 |
* @param time Period of timer in seconds.
|
|
20 |
* @return 0 = success \n
|
|
21 |
* -1 = wrong time. It must be higher then zero.
|
|
22 |
* -2 = there are no valid values for PR1 and prescaler
|
|
23 |
*/
|
|
24 |
int initialize(int time);
|
|
28 | 25 |
|
26 |
/** |
|
27 |
* Timer is enabled. |
|
28 |
*/ |
|
29 |
void start(); |
|
30 |
|
|
31 |
/** |
|
32 |
* Timer is disabled. |
|
33 |
*/ |
|
34 |
void stop(); |
|
35 |
|
|
36 |
/** |
|
37 |
* |
|
38 |
* @param flag Flag to enable/disable the timer. |
|
39 |
* @param enable Flag to enable/disable the interrupts. |
|
40 |
* @param priority Set priority. Between 0 and 3. |
|
41 |
* @param subpriority Set subpriority. Between 0 and 3. |
|
42 |
* @return 0 = success \n |
|
43 |
* -1 = invalid input |
|
44 |
*/ |
|
45 |
int setInterrupts(int flag, int enable, int priority, int subpriority); |
|
46 |
|
|
47 |
int getInterruptFlag(); |
|
48 |
|
|
49 |
|
|
29 | 50 |
#ifdef __cplusplus |
30 | 51 |
} |
31 | 52 |
#endif |
32 | 53 |
|
33 |
#endif /* MYTIMER_H */ |
|
34 |
|
|
54 |
#endif /* TIMER_H */ |
Também disponível em: Unified diff