Subversion Repositories HomeAutomation

Rev

Rev 993 | Rev 1324 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 993 Rev 1320
Line 33... Line 33...
33
#define IR_PROTOCOLS_USE_RC5        1
33
#define IR_PROTOCOLS_USE_RC5        1
34
#define IR_PROTOCOLS_USE_SHARP      1
34
#define IR_PROTOCOLS_USE_SHARP      1
35
#define IR_PROTOCOLS_USE_NEC        1
35
#define IR_PROTOCOLS_USE_NEC        1
36
#define IR_PROTOCOLS_USE_SAMSUNG    1
36
#define IR_PROTOCOLS_USE_SAMSUNG    1
37
#define IR_PROTOCOLS_USE_MARANTZ    1
37
#define IR_PROTOCOLS_USE_MARANTZ    1
-
 
38
#define IR_PROTOCOLS_USE_PANASONIC  1
38
 
39
 
39
/* All these functions take a buffer with pulse times and tries to parse it
40
/* All these functions take a buffer with pulse times and tries to parse it
40
 * to a Ir_Protocol_Data_t structure. They return IR_OK on success
41
 * to a Ir_Protocol_Data_t structure. They return IR_OK on success
41
 * and IR_NOT_CORRECT_DATA if there was no match. */
42
 * and IR_NOT_CORRECT_DATA if there was no match. */
42
#if (IR_PROTOCOLS_USE_SIRC)
43
#if (IR_PROTOCOLS_USE_SIRC)
Line 54... Line 55...
54
#if (IR_PROTOCOLS_USE_SAMSUNG)
55
#if (IR_PROTOCOLS_USE_SAMSUNG)
55
int8_t parseSamsung(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto);
56
int8_t parseSamsung(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto);
56
#endif
57
#endif
57
#if (IR_PROTOCOLS_USE_MARANTZ)
58
#if (IR_PROTOCOLS_USE_MARANTZ)
58
int8_t parseMarantz(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto);
59
int8_t parseMarantz(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto);
-
 
60
#endif
-
 
61
#if (IR_PROTOCOLS_USE_PANASONIC)
-
 
62
int8_t parsePanasonic(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto);
59
#endif
63
#endif
60
/* Try to parse all above protocols until a match is found. */
64
/* Try to parse all above protocols until a match is found. */
61
int8_t parseProtocol(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto);
65
int8_t parseProtocol(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto);
62
/* The Hash protocol always succeeds and creates a one-way signature of the
66
/* The Hash protocol always succeeds and creates a one-way signature of the
63
 * pulse times buffer that is supposed to be unique and constant for a specific
67
 * pulse times buffer that is supposed to be unique and constant for a specific
Line 73... Line 77...
73
int8_t expandRC5(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
77
int8_t expandRC5(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
74
int8_t expandSharp(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
78
int8_t expandSharp(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
75
int8_t expandNEC(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
79
int8_t expandNEC(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
76
int8_t expandSamsung(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
80
int8_t expandSamsung(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
77
int8_t expandMarantz(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
81
int8_t expandMarantz(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
-
 
82
int8_t expandPanasonic(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
78
/* Pass the Ir_Protocol_Data_t automatically to the correct function. */
83
/* Pass the Ir_Protocol_Data_t automatically to the correct function. */
79
int8_t expandProtocol(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
84
int8_t expandProtocol(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
80
 
85
 
81
 
86
 
82
#define IR_OK               1
87
#define IR_OK               1
Line 92... Line 97...
92
 
97
 
93
// defined for the module, uses same definitions for pressed and released as other buttons
98
// defined for the module, uses same definitions for pressed and released as other buttons
94
#define IR_BUTTON_RELEASED  0x0
99
#define IR_BUTTON_RELEASED  0x0
95
#define IR_BUTTON_PRESSED   0x1
100
#define IR_BUTTON_PRESSED   0x1
96
 
101
 
97
 
102
 
98
#define CYCLES_PER_US       (F_CPU/1000000)
103
#define CYCLES_PER_US       (F_CPU/1000000)
99
#define TIMER_PRESC         8
104
#define TIMER_PRESC         8
100
 
105
 
101
#define IR_MIN_PULSE_WIDTH  5                                   //us
106
#define IR_MIN_PULSE_WIDTH  5                                   //us
102
#define IR_MAX_PULSE_WIDTH  12000                               //us
107
#define IR_MAX_PULSE_WIDTH  12000                               //us
103
 
108
 
104
/* RC5 Implementation
109
/* RC5 Implementation
105
 * Receiver: DONE
110
 * Receiver: DONE
Line 110... Line 115...
110
#define IR_RC5_BIT          889*2*CYCLES_PER_US/TIMER_PRESC     //us
115
#define IR_RC5_BIT          889*2*CYCLES_PER_US/TIMER_PRESC     //us
111
#define IR_RC5_TIMEOUT      105                                 //ms    (time between ir frames)
116
#define IR_RC5_TIMEOUT      105                                 //ms    (time between ir frames)
112
#define IR_RC5_REPS         1                                   //      (minimum number of times to repeat code)
117
#define IR_RC5_REPS         1                                   //      (minimum number of times to repeat code)
113
#define IR_RC5_F_MOD        36                                  //kHz   (modulation frequency)
118
#define IR_RC5_F_MOD        36                                  //kHz   (modulation frequency)
114
#define IR_RC5_TOL_DIV      4
119
#define IR_RC5_TOL_DIV      4
115
 
120
 
116
/* RC6 Implementation
121
/* RC6 Implementation
117
 * Receiver:
122
 * Receiver:
118
 * Transmitter:
123
 * Transmitter:
119
 */
124
 */
120
#define IR_PROTO_RC6        1
125
#define IR_PROTO_RC6        1
Line 146... Line 151...
146
#define IR_SIRC_HIGH_ZERO   600*CYCLES_PER_US/TIMER_PRESC       //us
151
#define IR_SIRC_HIGH_ZERO   600*CYCLES_PER_US/TIMER_PRESC       //us
147
#define IR_SIRC_TIMEOUT     40                                  //ms    (time between ir frames)
152
#define IR_SIRC_TIMEOUT     40                                  //ms    (time between ir frames)
148
#define IR_SIRC_REPS        1                                   //      (minimum number of times to repeat code)
153
#define IR_SIRC_REPS        1                                   //      (minimum number of times to repeat code)
149
#define IR_SIRC_F_MOD       40                                  //kHz   (modulation frequency)
154
#define IR_SIRC_F_MOD       40                                  //kHz   (modulation frequency)
150
#define IR_SIRC_TOL_DIV     4
155
#define IR_SIRC_TOL_DIV     4
151
 
156
 
152
/* Sharp Implementation
157
/* Sharp Implementation
153
 * Receiver: DONE
158
 * Receiver: DONE
154
 * Transmitter:
159
 * Transmitter:
155
 */
160
 */
156
#define IR_PROTO_SHARP      4
161
#define IR_PROTO_SHARP      4
Line 202... Line 207...
202
#define IR_MARANTZ_BIT          889*2*CYCLES_PER_US/TIMER_PRESC     //us
207
#define IR_MARANTZ_BIT          889*2*CYCLES_PER_US/TIMER_PRESC     //us
203
#define IR_MARANTZ_TIMEOUT      105                                 //ms    (time between ir frames)
208
#define IR_MARANTZ_TIMEOUT      105                                 //ms    (time between ir frames)
204
#define IR_MARANTZ_REPS         1                                   //      (minimum number of times to repeat code)
209
#define IR_MARANTZ_REPS         1                                   //      (minimum number of times to repeat code)
205
#define IR_MARANTZ_F_MOD        36                                  //kHz   (modulation frequency)
210
#define IR_MARANTZ_F_MOD        36                                  //kHz   (modulation frequency)
206
#define IR_MARANTZ_TOL_DIV      4
211
#define IR_MARANTZ_TOL_DIV      4
-
 
212
 
-
 
213
/* Panasonic Implementation
-
 
214
 * Receiver: DONE
-
 
215
 * Transmitter: DONE (untested)
-
 
216
 */
-
 
217
#define IR_PROTO_PANASONIC  8
-
 
218
#define IR_PANA_ST_BIT      3570*CYCLES_PER_US/TIMER_PRESC      //us
-
 
219
#define IR_PANA_ST_PAUSE    1630*CYCLES_PER_US/TIMER_PRESC      //us
-
 
220
#define IR_PANA_LOW_ONE     1240*CYCLES_PER_US/TIMER_PRESC      //us
-
 
221
#define IR_PANA_LOW_ZERO    360*CYCLES_PER_US/TIMER_PRESC       //us
-
 
222
#define IR_PANA_HIGH        495*CYCLES_PER_US/TIMER_PRESC       //us
-
 
223
#define IR_PANA_TIMEOUT     80                                  //ms    (time between ir frames)
-
 
224
#define IR_PANA_REPS        1                                   //      (minimum number of times to repeat code)
-
 
225
#define IR_PANA_F_MOD       38                                  //kHz   (modulation frequency)
-
 
226
#define IR_PANA_TOL_DIV     4
-
 
227
 
207
 
228
 
208
#define IR_PROTO_HASH       0xfe
229
#define IR_PROTO_HASH       0xfe
209
#define IR_PROTO_UNKNOWN    0xff                                //
230
#define IR_PROTO_UNKNOWN    0xff                                //
210
 
231
 
211
 
232