Subversion Repositories HomeAutomation

Rev

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

Rev 1886 Rev 1904
Line 36... Line 36...
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
#define IR_PROTOCOLS_USE_PANASONIC  1
39
#define IR_PROTOCOLS_USE_SKY        1
39
#define IR_PROTOCOLS_USE_SKY        1
40
#define IR_PROTOCOLS_USE_NEXA2      1
40
#define IR_PROTOCOLS_USE_NEXA2      1
-
 
41
#define IR_PROTOCOLS_USE_NEXA1      1
41
 
42
 
42
/* All these functions take a buffer with pulse times and tries to parse it
43
/* All these functions take a buffer with pulse times and tries to parse it
43
 * to a Ir_Protocol_Data_t structure. They return IR_OK on success
44
 * to a Ir_Protocol_Data_t structure. They return IR_OK on success
44
 * and IR_NOT_CORRECT_DATA if there was no match. */
45
 * and IR_NOT_CORRECT_DATA if there was no match. */
45
#if (IR_PROTOCOLS_USE_SIRC)
46
#if (IR_PROTOCOLS_USE_SIRC)
Line 66... Line 67...
66
#if (IR_PROTOCOLS_USE_SKY)
67
#if (IR_PROTOCOLS_USE_SKY)
67
int8_t parseSky(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto);
68
int8_t parseSky(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto);
68
#endif
69
#endif
69
#if (IR_PROTOCOLS_USE_NEXA2)
70
#if (IR_PROTOCOLS_USE_NEXA2)
70
int8_t parseNexa2(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto);
71
int8_t parseNexa2(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto);
-
 
72
#endif
-
 
73
#if (IR_PROTOCOLS_USE_NEXA1)
-
 
74
int8_t parseNexa1(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto);
71
#endif
75
#endif
72
 
76
 
73
/* Try to parse all above protocols until a match is found. */
77
/* Try to parse all above protocols until a match is found. */
74
int8_t parseProtocol(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto);
78
int8_t parseProtocol(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto);
75
/* The Hash protocol always succeeds and creates a one-way signature of the
79
/* The Hash protocol always succeeds and creates a one-way signature of the
76
 * pulse times buffer that is supposed to be unique and constant for a specific
80
 * pulse times buffer that is supposed to be unique and constant for a specific
77
 * IR event. It may be used to send a valid event even if the protocol hasn't
81
 * IR event. It may be used to send a valid event even if the protocol hasn't
78
 * been implemented or decoded yet. */
82
 * been implemented or decoded yet. */
79
int8_t parseHash(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto);
83
int8_t parseHash(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto);
80
 
84
 
81
/* These functions expand a Ir_Protocol_Data_t structure into a raw buffer with
85
/* These functions expand a Ir_Protocol_Data_t structure into a raw buffer with
82
 * pulse lengths. They return IR_OK on success and IR_NOT_CORRECT_DATA if the
86
 * pulse lengths. They return IR_OK on success and IR_NOT_CORRECT_DATA if the
83
 * Ir_Protocol_Data_t structure is for another protocol or contains invalid
87
 * Ir_Protocol_Data_t structure is for another protocol or contains invalid
84
 * data. */
88
 * data. */
85
int8_t expandSIRC(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
89
int8_t expandSIRC(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
Line 89... Line 93...
89
int8_t expandSamsung(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
93
int8_t expandSamsung(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
90
int8_t expandMarantz(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
94
int8_t expandMarantz(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
91
int8_t expandPanasonic(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
95
int8_t expandPanasonic(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
92
int8_t expandSky(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
96
int8_t expandSky(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
93
int8_t expandNexa2(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
97
int8_t expandNexa2(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
-
 
98
int8_t expandNexa1(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
94
/* Pass the Ir_Protocol_Data_t automatically to the correct function. */
99
/* Pass the Ir_Protocol_Data_t automatically to the correct function. */
95
int8_t expandProtocol(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
100
int8_t expandProtocol(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto);
96
 
101
 
97
 
102
 
98
#define IR_OK               1
103
#define IR_OK               1
99
#define IR_NO_PROTOCOL      2
104
#define IR_NO_PROTOCOL      2
100
#define IR_TIME_OVFL        3
105
#define IR_TIME_OVFL        3
101
#define IR_NO_DATA          4
106
#define IR_NO_DATA          4
102
#define IR_NOT_CORRECT_DATA 5
107
#define IR_NOT_CORRECT_DATA 5
Line 242... Line 247...
242
#define IR_PANA_F_MOD       (38)                                //kHz   (modulation frequency)
247
#define IR_PANA_F_MOD       (38)                                //kHz   (modulation frequency)
243
#define IR_PANA_TOL_DIV     (4)
248
#define IR_PANA_TOL_DIV     (4)
244
 
249
 
245
/* Sky Implementation
250
/* Sky Implementation
246
 * Receiver: DONE
251
 * Receiver: DONE
247
 * Transmitter:
252
 * Transmitter:
248
 */
253
 */
249
#define IR_PROTO_SKY        (9)
254
#define IR_PROTO_SKY        (9)
250
#define IR_SKY_ST_BIT       (2800*CYCLES_PER_US/TIMER_PRESC)    //us
255
#define IR_SKY_ST_BIT       (2800*CYCLES_PER_US/TIMER_PRESC)    //us
251
#define IR_SKY_SHORT        (460*CYCLES_PER_US/TIMER_PRESC)     //us
256
#define IR_SKY_SHORT        (460*CYCLES_PER_US/TIMER_PRESC)     //us
252
#define IR_SKY_LONG         (920*CYCLES_PER_US/TIMER_PRESC)     //us
257
#define IR_SKY_LONG         (920*CYCLES_PER_US/TIMER_PRESC)     //us
253
#define IR_SKY_TIMEOUT      (162-IR_MAX_PULSE_WIDTH/1000)       //ms    (time between ir frames)
258
#define IR_SKY_TIMEOUT      (162-IR_MAX_PULSE_WIDTH/1000)       //ms    (time between ir frames)
254
#define IR_SKY_REPS         (1)                                 //      (minimum number of times to repeat code)
259
#define IR_SKY_REPS         (1)                                 //      (minimum number of times to repeat code)
255
#define IR_SKY_F_MOD        (38)                                //kHz   (modulation frequency)
260
#define IR_SKY_F_MOD        (38)                                //kHz   (modulation frequency)
256
#define IR_SKY_TOL_DIV      (4)
261
#define IR_SKY_TOL_DIV      (4)
257
 
262
 
258
 
263
 
259
/* Nexa2 Implementation
264
/* Nexa2 Implementation
260
 * Receiver:
265
 * Receiver:
261
 * Transmitter:
266
 * Transmitter:
262
 */
267
 */
263
#define IR_PROTO_NEXA2      (10)
268
#define IR_PROTO_NEXA2      (10)
264
#define IR_NEXA2_START1     (10000*CYCLES_PER_US/TIMER_PRESC)   //us
269
#define IR_NEXA2_START1     (10000*CYCLES_PER_US/TIMER_PRESC)   //us
265
#define IR_NEXA2_START2     (2500*CYCLES_PER_US/TIMER_PRESC)    //us
270
#define IR_NEXA2_START2     (2500*CYCLES_PER_US/TIMER_PRESC)    //us
Line 268... Line 273...
268
#define IR_NEXA2_LOW_ZERO   (1200*CYCLES_PER_US/TIMER_PRESC)    //us
273
#define IR_NEXA2_LOW_ZERO   (1200*CYCLES_PER_US/TIMER_PRESC)    //us
269
#define IR_NEXA2_TIMEOUT    (5)                                 //ms    (time between ir frames)
274
#define IR_NEXA2_TIMEOUT    (5)                                 //ms    (time between ir frames)
270
#define IR_NEXA2_REPS       (5)                                 //      (minimum number of times to repeat code)
275
#define IR_NEXA2_REPS       (5)                                 //      (minimum number of times to repeat code)
271
#define IR_NEXA2_F_MOD      (38)                                //kHz   (modulation frequency)
276
#define IR_NEXA2_F_MOD      (38)                                //kHz   (modulation frequency)
272
#define IR_NEXA2_TOL_DIV    (2)
277
#define IR_NEXA2_TOL_DIV    (2)
-
 
278
 
-
 
279
 
-
 
280
/* Nexa1 Implementation
-
 
281
 * Receiver:
-
 
282
 * Transmitter:
-
 
283
 */
-
 
284
#define IR_PROTO_NEXA1      (11)
-
 
285
#define IR_NEXA1_SHORT      (320*CYCLES_PER_US/TIMER_PRESC)     //us
-
 
286
#define IR_NEXA1_LONG       (210*CYCLES_PER_US/TIMER_PRESC)     //us
-
 
287
#define IR_NEXA1_TIMEOUT    (5)                                 //ms    (time between ir frames)
-
 
288
#define IR_NEXA1_REPS       (5)                                 //      (minimum number of times to repeat code)
-
 
289
#define IR_NEXA1_F_MOD      (38)                                //kHz   (modulation frequency)
-
 
290
#define IR_NEXA1_TOL_DIV    (2)
273
 
291
 
274
 
292
 
275
#define IR_PROTO_HASH       0xfe
293
#define IR_PROTO_HASH       0xfe
276
#define IR_PROTO_UNKNOWN    0xff                                //
294
#define IR_PROTO_UNKNOWN    0xff                                //
277
 
295