Subversion Repositories HomeAutomation

Rev

Rev 533 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 533 Rev 548
Line 14... Line 14...
14
#define IR_NO_PROTOCOL      2
14
#define IR_NO_PROTOCOL      2
15
#define IR_TIME_OVFL        3
15
#define IR_TIME_OVFL        3
16
#define IR_NO_DATA          4
16
#define IR_NO_DATA          4
17
#define IR_NOT_CORRECT_DATA 5
17
#define IR_NOT_CORRECT_DATA 5
18
#define IR_TO_MUCH_DATA     6
18
#define IR_TO_MUCH_DATA     6
-
 
19
#define IR_NOT_FINISHED     7
-
 
20
 
-
 
21
#define IR_BUTTON_DOWN      0x0
-
 
22
#define IR_BUTTON_UP        0xf
19
 
23
 
20
#define CYCLES_PER_US       (F_CPU/1000000)
24
#define CYCLES_PER_US       (F_CPU/1000000)
21
#define TIMER_PRESC         8
25
#define TIMER_PRESC         8
22
 
26
 
23
#define IR_MIN_PULSE_WIDTH  5                                   //us
27
#define IR_MIN_PULSE_WIDTH  5                                   //us
24
#define IR_MAX_PULSE_WIDTH  12000                               //us
28
#define IR_MAX_PULSE_WIDTH  12000                               //us
25
 
29
 
26
#define TIM_OVFL_RELOAD_VAL (65536-(IR_MAX_PULSE_WIDTH*CYCLES_PER_US/TIMER_PRESC))  //timeout of 12ms, no pulses may be longer than this
30
#define TIM_OVFL_RELOAD_VAL (65536-(IR_MAX_PULSE_WIDTH*CYCLES_PER_US/TIMER_PRESC))  //timeout of 12ms, no pulses may be longer than this
-
 
31
 
-
 
32
#define TIM_1MS_RELOAD_VAL (65536-(1000*CYCLES_PER_US/TIMER_PRESC))
27
 
33
 
28
/* RC5 Implementation
34
/* RC5 Implementation
29
 * Receiver: DONE
35
 * Receiver: DONE
30
 * Transmitter:
36
 * Transmitter:
31
 */
37
 */
32
#define IR_PROTO_RC5        0
38
#define IR_PROTO_RC5        0
33
#define IR_RC5_HALF_BIT     889*CYCLES_PER_US/TIMER_PRESC       //us
39
#define IR_RC5_HALF_BIT     889*CYCLES_PER_US/TIMER_PRESC       //us
34
#define IR_RC5_BIT          889*2*CYCLES_PER_US/TIMER_PRESC     //us
40
#define IR_RC5_BIT          889*2*CYCLES_PER_US/TIMER_PRESC     //us
35
#define IR_RC5_REPETITION   105                                 //ms    (time between pulsetrains)
41
#define IR_RC5_REPETITION   105                                 //ms    (time between ir frames)
-
 
42
#define IR_RC5_REPS         1                                   //      (minimum number of times to repeat code)
36
#define IR_RC5_F_MOD        36                                  //kHz   (modulation frequency)
43
#define IR_RC5_F_MOD        36                                  //kHz   (modulation frequency)
37
#define IR_RC5_TOL_DIV      4
44
#define IR_RC5_TOL_DIV      4
38
 
45
 
39
/* RC6 Implementation
46
/* RC6 Implementation
40
 * Receiver:
47
 * Receiver:
41
 * Transmitter:
48
 * Transmitter:
42
 */
49
 */
43
#define IR_PROTO_RC6        1
50
#define IR_PROTO_RC6        1
44
#define IR_RC6_ST_BIT       1*CYCLES_PER_US/TIMER_PRESC         //us
51
#define IR_RC6_ST_BIT       1*CYCLES_PER_US/TIMER_PRESC         //us
45
#define IR_RC6_REPETITION   1                                   //ms    (time between pulsetrains)
52
#define IR_RC6_REPETITION   1                                   //ms    (time between ir frames)
-
 
53
#define IR_RC6_REPS         1                                   //      (minimum number of times to repeat code)
46
#define IR_RC6_F_MOD        36                                  //kHz   (modulation frequency)
54
#define IR_RC6_F_MOD        36                                  //kHz   (modulation frequency)
47
#define IR_RC6_TOL_DIV      4
55
#define IR_RC6_TOL_DIV      4
48
 
56
 
49
/* RCMM Implementation
57
/* RCMM Implementation
50
 * Receiver:
58
 * Receiver:
51
 * Transmitter:
59
 * Transmitter:
52
 */
60
 */
53
#define IR_PROTO_RCMM       2
61
#define IR_PROTO_RCMM       2
54
#define IR_RCMM_ST_BIT      256*CYCLES_PER_US/TIMER_PRESC       //us
62
#define IR_RCMM_ST_BIT      256*CYCLES_PER_US/TIMER_PRESC       //us
55
#define IR_RCMM_REPETITION 158                                  //ms    (time between pulsetrains)
63
#define IR_RCMM_REPETITION 158                                  //ms    (time between ir frames)
-
 
64
#define IR_RCMM_REPS        1                                   //      (minimum number of times to repeat code)
56
#define IR_RCMM_F_MOD       36                                  //kHz   (modulation frequency)
65
#define IR_RCMM_F_MOD       36                                  //kHz   (modulation frequency)
57
#define IR_RCMM_TOL_DIV     4
66
#define IR_RCMM_TOL_DIV     4
58
 
67
 
59
/* SIRC Implementation
68
/* SIRC Implementation
60
 * Receiver: DONE
69
 * Receiver: DONE
Line 63... Line 72...
63
#define IR_PROTO_SIRC       3
72
#define IR_PROTO_SIRC       3
64
#define IR_SIRC_ST_BIT      2400*CYCLES_PER_US/TIMER_PRESC      //us
73
#define IR_SIRC_ST_BIT      2400*CYCLES_PER_US/TIMER_PRESC      //us
65
#define IR_SIRC_LOW         600*CYCLES_PER_US/TIMER_PRESC       //us
74
#define IR_SIRC_LOW         600*CYCLES_PER_US/TIMER_PRESC       //us
66
#define IR_SIRC_HIGH_ONE    1200*CYCLES_PER_US/TIMER_PRESC      //us
75
#define IR_SIRC_HIGH_ONE    1200*CYCLES_PER_US/TIMER_PRESC      //us
67
#define IR_SIRC_HIGH_ZERO   600*CYCLES_PER_US/TIMER_PRESC       //us
76
#define IR_SIRC_HIGH_ZERO   600*CYCLES_PER_US/TIMER_PRESC       //us
68
#define IR_SIRC_REPETITION  40                                  //ms    (time between pulsetrains)
77
#define IR_SIRC_REPETITION  40                                  //ms    (time between ir frames)
-
 
78
#define IR_SIRC_REPS        1                                   //      (minimum number of times to repeat code)
69
#define IR_SIRC_F_MOD       40                                  //kHz   (modulation frequency)
79
#define IR_SIRC_F_MOD       40                                  //kHz   (modulation frequency)
70
#define IR_SIRC_TOL_DIV     4
80
#define IR_SIRC_TOL_DIV     4
71
 
81
 
72
/* Sharp Implementation
82
/* Sharp Implementation
73
 * Receiver: DONE
83
 * Receiver: DONE
Line 75... Line 85...
75
 */
85
 */
76
#define IR_PROTO_SHARP      4
86
#define IR_PROTO_SHARP      4
77
#define IR_SHARP_HIGH       280*CYCLES_PER_US/TIMER_PRESC       //us
87
#define IR_SHARP_HIGH       280*CYCLES_PER_US/TIMER_PRESC       //us
78
#define IR_SHARP_LOW_ONE    1850*CYCLES_PER_US/TIMER_PRESC      //us
88
#define IR_SHARP_LOW_ONE    1850*CYCLES_PER_US/TIMER_PRESC      //us
79
#define IR_SHARP_LOW_ZERO   780*CYCLES_PER_US/TIMER_PRESC       //us
89
#define IR_SHARP_LOW_ZERO   780*CYCLES_PER_US/TIMER_PRESC       //us
80
#define IR_SHARP_REPETITION 55                                  //ms    (time between pulsetrains)
90
#define IR_SHARP_REPETITION 55                                  //ms    (time between ir frames)
-
 
91
#define IR_SHARP_REPS       2                                   //      (minimum number of times to repeat code)
81
#define IR_SHARP_F_MOD      38                                  //kHz   (modulation frequency)
92
#define IR_SHARP_F_MOD      38                                  //kHz   (modulation frequency)
82
#define IR_SHARP_TOL_DIV    4
93
#define IR_SHARP_TOL_DIV    4
83
 
94
 
84
/* NEC Implementation
95
/* NEC Implementation
85
 * Receiver: DONE
96
 * Receiver: DONE
Line 89... Line 100...
89
#define IR_NEC_ST_BIT       9000*CYCLES_PER_US/TIMER_PRESC      //us
100
#define IR_NEC_ST_BIT       9000*CYCLES_PER_US/TIMER_PRESC      //us
90
#define IR_NEC_ST_PAUSE     4500*CYCLES_PER_US/TIMER_PRESC      //us
101
#define IR_NEC_ST_PAUSE     4500*CYCLES_PER_US/TIMER_PRESC      //us
91
#define IR_NEC_LOW_ONE      1690*CYCLES_PER_US/TIMER_PRESC      //us
102
#define IR_NEC_LOW_ONE      1690*CYCLES_PER_US/TIMER_PRESC      //us
92
#define IR_NEC_LOW_ZERO     560*CYCLES_PER_US/TIMER_PRESC       //us
103
#define IR_NEC_LOW_ZERO     560*CYCLES_PER_US/TIMER_PRESC       //us
93
#define IR_NEC_HIGH         560*CYCLES_PER_US/TIMER_PRESC       //us
104
#define IR_NEC_HIGH         560*CYCLES_PER_US/TIMER_PRESC       //us
94
#define IR_NEC_REPETITION   110                                 //ms    (time between pulsetrains)
105
#define IR_NEC_REPETITION   110                                 //ms    (time between ir frames)
-
 
106
#define IR_NEC_REPS         1                                   //      (minimum number of times to repeat code)
95
#define IR_NEC_F_MOD        38                                  //kHz   (modulation frequency)
107
#define IR_NEC_F_MOD        38                                  //kHz   (modulation frequency)
96
#define IR_NEC_TOL_DIV      4
108
#define IR_NEC_TOL_DIV      4
97
 
109
 
98
/* Samsung Implementation
110
/* Samsung Implementation
99
 * Receiver: DONE
111
 * Receiver: DONE
Line 103... Line 115...
103
#define IR_SAMS_ST_BIT      4500*CYCLES_PER_US/TIMER_PRESC      //us
115
#define IR_SAMS_ST_BIT      4500*CYCLES_PER_US/TIMER_PRESC      //us
104
#define IR_SAMS_ST_PAUSE    4500*CYCLES_PER_US/TIMER_PRESC      //us
116
#define IR_SAMS_ST_PAUSE    4500*CYCLES_PER_US/TIMER_PRESC      //us
105
#define IR_SAMS_LOW_ONE     1720*CYCLES_PER_US/TIMER_PRESC      //us
117
#define IR_SAMS_LOW_ONE     1720*CYCLES_PER_US/TIMER_PRESC      //us
106
#define IR_SAMS_LOW_ZERO    650*CYCLES_PER_US/TIMER_PRESC       //us
118
#define IR_SAMS_LOW_ZERO    650*CYCLES_PER_US/TIMER_PRESC       //us
107
#define IR_SAMS_HIGH        500*CYCLES_PER_US/TIMER_PRESC       //us
119
#define IR_SAMS_HIGH        500*CYCLES_PER_US/TIMER_PRESC       //us
108
#define IR_SAMS_REPETITION  50                                  //ms    (time between pulsetrains)
120
#define IR_SAMS_REPETITION  50                                  //ms    (time between ir frames)
-
 
121
#define IR_SAMS_REPS        1                                   //      (minimum number of times to repeat code)
109
#define IR_SAMS_F_MOD       38                                  //kHz   (modulation frequency)
122
#define IR_SAMS_F_MOD       38                                  //kHz   (modulation frequency)
110
#define IR_SAMS_TOL_DIV     4
123
#define IR_SAMS_TOL_DIV     4
111
 
124
 
112
#define IR_PROTO_UNKNOWN    0xff                                //
125
#define IR_PROTO_UNKNOWN    0xff                                //
113
 
126