Subversion Repositories HomeAutomation

Rev

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

Rev 2246 Rev 2254
Line 67... Line 67...
67
#endif
67
#endif
68
#if (IR_PROTOCOLS_USE_RUBICSON)
68
#if (IR_PROTOCOLS_USE_RUBICSON)
69
    res = parseRubicson(buf, len, index, proto);
69
    res = parseRubicson(buf, len, index, proto);
70
    if (res!=IR_NOT_CORRECT_DATA) return res;
70
    if (res!=IR_NOT_CORRECT_DATA) return res;
71
#endif
71
#endif
-
 
72
#if (IR_PROTOCOLS_USE_OREGON)
-
 
73
    res = parseOregon(buf, len, index, proto);
-
 
74
    if (res!=IR_NOT_CORRECT_DATA) return res;
72
       
75
#endif      
73
   
76
   
74
    /* No protocol matched. */
77
    /* No protocol matched. */
75
    proto->protocol = IR_PROTO_UNKNOWN;
78
    proto->protocol = IR_PROTO_UNKNOWN;
76
    return IR_NOT_CORRECT_DATA;
79
    return IR_NOT_CORRECT_DATA;
77
}
80
}
Line 114... Line 117...
114
    /* Invalid protocol specified. */
117
    /* Invalid protocol specified. */
115
    return IR_NOT_CORRECT_DATA;
118
    return IR_NOT_CORRECT_DATA;
116
}
119
}
117
 
120
 
118
#if (IR_PROTOCOLS_USE_SIRC)
121
#if (IR_PROTOCOLS_USE_SIRC)
119
/**
122
/**
120
 * Test data on SIRC protocol, 12-bit version
123
 * Test data on SIRC protocol, 12-bit version
121
 * http://www.sbprojects.com/knowledge/ir/sirc.htm
124
 * http://www.sbprojects.com/knowledge/ir/sirc.htm
122
 * http://picprojects.org.uk/projects/sirc/sonysirc.pdf
125
 * http://picprojects.org.uk/projects/sirc/sonysirc.pdf
123
 *
126
 *
124
 * @param buf
127
 * @param buf
Line 137... Line 140...
137
           supporting two versions of SIRC:
140
           supporting two versions of SIRC:
138
           12 bit = 25, 15 bit = 31
141
           12 bit = 25, 15 bit = 31
139
           there is also a 20 bit protocol, but we don't support it
142
           there is also a 20 bit protocol, but we don't support it
140
         */
143
         */
141
    if (len != 25 && len != 31) {
144
    if (len != 25 && len != 31) {
142
        return IR_NOT_CORRECT_DATA;
145
        return IR_NOT_CORRECT_DATA;
143
    }
146
    }
144
   
147
   
145
    /* check startbit */
148
    /* check startbit */
146
    if (buf[0] > IR_SIRC_ST_BIT + IR_SIRC_ST_BIT/IR_SIRC_TOL_DIV || buf[0] < IR_SIRC_ST_BIT - IR_SIRC_ST_BIT/IR_SIRC_TOL_DIV) {
149
    if (buf[0] > IR_SIRC_ST_BIT + IR_SIRC_ST_BIT/IR_SIRC_TOL_DIV || buf[0] < IR_SIRC_ST_BIT - IR_SIRC_ST_BIT/IR_SIRC_TOL_DIV) {
147
        return IR_NOT_CORRECT_DATA;
150
        return IR_NOT_CORRECT_DATA;
148
    }
151
    }
149
   
152
   
150
    uint16_t rawbits=0;
153
    uint16_t rawbits=0;
151
   
154
   
152
    for (uint8_t i = 1; i < len; i++) {
155
    for (uint8_t i = 1; i < len; i++) {
Line 159... Line 162...
159
            if (buf[i] > IR_SIRC_HIGH_ONE - IR_SIRC_HIGH_ONE/IR_SIRC_TOL_DIV && buf[i] < IR_SIRC_HIGH_ONE + IR_SIRC_HIGH_ONE/IR_SIRC_TOL_DIV) {
162
            if (buf[i] > IR_SIRC_HIGH_ONE - IR_SIRC_HIGH_ONE/IR_SIRC_TOL_DIV && buf[i] < IR_SIRC_HIGH_ONE + IR_SIRC_HIGH_ONE/IR_SIRC_TOL_DIV) {
160
                /* write a one */
163
                /* write a one */
161
                rawbits |= 1<<((i-2)>>1);
164
                rawbits |= 1<<((i-2)>>1);
162
            } else if (buf[i] > IR_SIRC_HIGH_ZERO - IR_SIRC_HIGH_ZERO/IR_SIRC_TOL_DIV && buf[i] < IR_SIRC_HIGH_ZERO + IR_SIRC_HIGH_ZERO/IR_SIRC_TOL_DIV) {
165
            } else if (buf[i] > IR_SIRC_HIGH_ZERO - IR_SIRC_HIGH_ZERO/IR_SIRC_TOL_DIV && buf[i] < IR_SIRC_HIGH_ZERO + IR_SIRC_HIGH_ZERO/IR_SIRC_TOL_DIV) {
163
                /* do nothing, a zero is already in rawbits */
166
                /* do nothing, a zero is already in rawbits */
164
            } else {
167
            } else {
165
                return IR_NOT_CORRECT_DATA;
168
                return IR_NOT_CORRECT_DATA;
166
            }
169
            }
-
 
170
        }
167
        }
171
    }
168
    }
-
 
169
   
172
   
170
    proto->protocol = CAN_MODULE_ENUM_PHYSICAL_IR_PROTOCOL_SIRC;
173
    proto->protocol = CAN_MODULE_ENUM_PHYSICAL_IR_PROTOCOL_SIRC;
171
    proto->timeout = IR_SIRC_TIMEOUT;
174
    proto->timeout = IR_SIRC_TIMEOUT;
172
    proto->data = rawbits;
175
    proto->data = rawbits;
173
   
176
   
174
    return IR_OK;
177
    return IR_OK;
Line 185... Line 188...
185
 *      Pointer to length of the data
188
 *      Pointer to length of the data
186
 * @param proto
189
 * @param proto
187
 *      Pointer to protocol information
190
 *      Pointer to protocol information
188
 * @return
191
 * @return
189
 *      IR_OK if data expanded successfully, one of several errormessages if not
192
 *      IR_OK if data expanded successfully, one of several errormessages if not
190
 */
193
 */
191
int8_t expandSIRC(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto) {
194
int8_t expandSIRC(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto) {
192
    buf[0] = IR_SIRC_ST_BIT;
195
    buf[0] = IR_SIRC_ST_BIT;
193
    buf[1] = IR_SIRC_LOW; //start pulse finished
196
    buf[1] = IR_SIRC_LOW; //start pulse finished
194
 
197
 
195
        /* Assume 12 bit protocol */
198
        /* Assume 12 bit protocol */
Line 233... Line 236...
233
 *      IR_OK if data parsed successfully, one of several errormessages if not
236
 *      IR_OK if data parsed successfully, one of several errormessages if not
234
 */
237
 */
235
int8_t parseRC5(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto) {
238
int8_t parseRC5(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto) {
236
    uint8_t halfbitscnt = 1;
239
    uint8_t halfbitscnt = 1;
237
    uint16_t rawbits = 0;
240
    uint16_t rawbits = 0;
238
   
241
   
239
    for (uint8_t i = 0; i<len; i++) {
242
    for (uint8_t i = 0; i<len; i++) {
240
        //halfbitscnt&1==1 in the middle of bits
243
        //halfbitscnt&1==1 in the middle of bits
241
        //i&1==0 positive flank
244
        //i&1==0 positive flank
242
 
245
 
243
        if ((halfbitscnt&1)==1 && (i&1)==0) {       /* in the middle of bit AND a positve flank */
246
        if ((halfbitscnt&1)==1 && (i&1)==0) {       /* in the middle of bit AND a positve flank */
Line 248... Line 251...
248
            halfbitscnt += 1;
251
            halfbitscnt += 1;
249
        } else if (buf[i] > IR_RC5_BIT - IR_RC5_BIT/IR_RC5_TOL_DIV && buf[i] < IR_RC5_BIT + IR_RC5_BIT/IR_RC5_TOL_DIV) {
252
        } else if (buf[i] > IR_RC5_BIT - IR_RC5_BIT/IR_RC5_TOL_DIV && buf[i] < IR_RC5_BIT + IR_RC5_BIT/IR_RC5_TOL_DIV) {
250
            halfbitscnt += 2;
253
            halfbitscnt += 2;
251
        } else {
254
        } else {
252
            return IR_NOT_CORRECT_DATA;
255
            return IR_NOT_CORRECT_DATA;
253
        }
256
        }
254
       
257
       
255
    }
258
    }
256
 
259
 
257
    proto->protocol=CAN_MODULE_ENUM_PHYSICAL_IR_PROTOCOL_RC5;
260
    proto->protocol=CAN_MODULE_ENUM_PHYSICAL_IR_PROTOCOL_RC5;
258
    proto->timeout=IR_RC5_TIMEOUT;
261
    proto->timeout=IR_RC5_TIMEOUT;
259
    //support RC5-extended keeping second startbit 
262
    //support RC5-extended keeping second startbit 
260
    //remove togglebit
263
    //remove togglebit
261
    proto->data = rawbits&0x37ff; //This seems to be wrong? Does not invert second start bit and keeps first start bit
264
    proto->data = rawbits&0x37ff; //This seems to be wrong? Does not invert second start bit and keeps first start bit
262
    //proto->data = (rawbits&0x07ff) | ((~rawbits)&0x0100);
265
    //proto->data = (rawbits&0x07ff) | ((~rawbits)&0x0100);
263
 
266
 
264
   
267
   
265
    return IR_OK;
268
    return IR_OK;
266
}
269
}
267
#endif
270
#endif
268
 
271
 
269
/**
272
/**
270
 * Used by the expandRC5 to ensure that we toggle the signal with each button press.
273
 * Used by the expandRC5 to ensure that we toggle the signal with each button press.
271
 */
274
 */
272
int8_t rc5_toggle=0;
275
int8_t rc5_toggle=0;
273
 
276
 
274
/**
277
/**
275
 * Expand data from RC5 protocol
278
 * Expand data from RC5 protocol
276
 * http://www.sbprojects.com/knowledge/ir/rc5.htm
279
 * http://www.sbprojects.com/knowledge/ir/rc5.htm
Line 340... Line 343...
340
            buf[*len]=IR_RC5_HALF_BIT;
343
            buf[*len]=IR_RC5_HALF_BIT;
341
            *len=*len+1;
344
            *len=*len+1;
342
           
345
           
343
            //Invert the previous bit
346
            //Invert the previous bit
344
            previousBit = (!previousBit) & 1;
347
            previousBit = (!previousBit) & 1;
345
        }
348
        }
346
    }
349
    }
347
    //We have to handle the last bit specially since we have to 
350
    //We have to handle the last bit specially since we have to 
348
    //end with low signal on the IR diod
351
    //end with low signal on the IR diod
349
    if(previousBit == 0)
352
    if(previousBit == 0)
350
    {
353
    {
351
        //We have to remove the last time since that would bring us to a high signal again.
354
        //We have to remove the last time since that would bring us to a high signal again.
352
        *len=*len-1;
355
        *len=*len-1;
353
        buf[*len]=0;
356
        buf[*len]=0;
354
    }
357
    }
355
   
358
   
356
    proto->modfreq=IR_RC5_F_MOD;
359
    proto->modfreq=IR_RC5_F_MOD;
357
    proto->timeout=IR_RC5_TIMEOUT;
360
    proto->timeout=IR_RC5_TIMEOUT;
358
    proto->repeats=IR_RC5_REPS;
361
    proto->repeats=IR_RC5_REPS;
359
    return IR_OK;
362
    return IR_OK;
360
}
363
}
361
 
364
 
362
 
365
 
363
#if (IR_PROTOCOLS_USE_SHARP)
366
#if (IR_PROTOCOLS_USE_SHARP)
364
/**
367
/**
365
 * Test data on SHARP protocol
368
 * Test data on SHARP protocol
366
 * http://www.sbprojects.com/knowledge/ir/sharp.htm
369
 * http://www.sbprojects.com/knowledge/ir/sharp.htm
367
 *
370
 *
368
 * @param buf
371
 * @param buf
369
 *      Pointer to buffer to where to data to parse is stored
372
 *      Pointer to buffer to where to data to parse is stored
370
 * @param len
373
 * @param len
371
 *      Length of the data
374
 *      Length of the data
372
 * @param proto
375
 * @param proto
373
 *      Pointer to protocol information
376
 *      Pointer to protocol information
374
 * @return
377
 * @return
375
 *      IR_OK if data parsed successfully, one of several errormessages if not
378
 *      IR_OK if data parsed successfully, one of several errormessages if not
376
 */
379
 */
Line 379... Line 382...
379
 
382
 
380
    /* check if we have correct amount of data */
383
    /* check if we have correct amount of data */
381
    if (len != 31) {
384
    if (len != 31) {
382
        return IR_NOT_CORRECT_DATA;
385
        return IR_NOT_CORRECT_DATA;
383
    }
386
    }
384
   
387
   
385
    uint16_t rawbits=0;
388
    uint16_t rawbits=0;
386
   
389
   
387
    for (uint8_t i = 1; i < len; i++) {
390
    for (uint8_t i = 1; i < len; i++) {
388
        if ((i&1) == 1) {       /* if odd, ir-pause */
391
        if ((i&1) == 1) {       /* if odd, ir-pause */
389
            /* check length of pause between bits */
392
            /* check length of pause between bits */
390
            if (buf[i] > IR_SHARP_LOW_ONE - IR_SHARP_LOW_ONE/IR_SHARP_TOL_DIV && buf[i] < IR_SHARP_LOW_ONE + IR_SHARP_LOW_ONE/IR_SHARP_TOL_DIV) {
393
            if (buf[i] > IR_SHARP_LOW_ONE - IR_SHARP_LOW_ONE/IR_SHARP_TOL_DIV && buf[i] < IR_SHARP_LOW_ONE + IR_SHARP_LOW_ONE/IR_SHARP_TOL_DIV) {
391
                /* write a one */
394
                /* write a one */
392
                rawbits |= 1<<((i-1)>>1);
395
                rawbits |= 1<<((i-1)>>1);
393
            } else if (buf[i] > IR_SHARP_LOW_ZERO - IR_SHARP_LOW_ZERO/IR_SHARP_TOL_DIV && buf[i] < IR_SHARP_LOW_ZERO + IR_SHARP_LOW_ZERO/IR_SHARP_TOL_DIV) {
396
            } else if (buf[i] > IR_SHARP_LOW_ZERO - IR_SHARP_LOW_ZERO/IR_SHARP_TOL_DIV && buf[i] < IR_SHARP_LOW_ZERO + IR_SHARP_LOW_ZERO/IR_SHARP_TOL_DIV) {
394
                /* do nothing, a zero is already in rawbits */
397
                /* do nothing, a zero is already in rawbits */
395
            } else {
398
            } else {
396
                return IR_NOT_CORRECT_DATA;
399
                return IR_NOT_CORRECT_DATA;
397
            }
400
            }
398
        } else {            /* if even, ir-bit */
401
        } else {            /* if even, ir-bit */
399
            if (buf[i] > IR_SHARP_HIGH + IR_SHARP_HIGH/IR_SHARP_TOL_DIV || buf[i] < IR_SHARP_HIGH - IR_SHARP_HIGH/IR_SHARP_TOL_DIV) {
402
            if (buf[i] > IR_SHARP_HIGH + IR_SHARP_HIGH/IR_SHARP_TOL_DIV || buf[i] < IR_SHARP_HIGH - IR_SHARP_HIGH/IR_SHARP_TOL_DIV) {
400
                return IR_NOT_CORRECT_DATA;
403
                return IR_NOT_CORRECT_DATA;
401
            }
404
            }
Line 415... Line 418...
415
 *
418
 *
416
 * @param buf
419
 * @param buf
417
 *      Pointer to buffer to store the expanded data
420
 *      Pointer to buffer to store the expanded data
418
 * @param len
421
 * @param len
419
 *      Pointer to length of the data
422
 *      Pointer to length of the data
420
 * @param proto
423
 * @param proto
421
 *      Pointer to protocol information
424
 *      Pointer to protocol information
422
 * @return
425
 * @return
423
 *      IR_OK if data expanded successfully, one of several errormessages if not
426
 *      IR_OK if data expanded successfully, one of several errormessages if not
424
 */
427
 */
425
int8_t expandSharp(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto) {
428
int8_t expandSharp(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto) {
426
    //TODO: Implement this function.
429
    //TODO: Implement this function.
Line 464... Line 467...
464
 
467
 
465
    for (uint8_t i = 3; i < len; i++) {
468
    for (uint8_t i = 3; i < len; i++) {
466
        if ((i&1) == 1) {       /* if odd, ir-pause */
469
        if ((i&1) == 1) {       /* if odd, ir-pause */
467
            /* check length of pause between bits */
470
            /* check length of pause between bits */
468
            if (buf[i] > IR_NEC_LOW_ONE - IR_NEC_LOW_ONE/IR_NEC_TOL_DIV && buf[i] < IR_NEC_LOW_ONE + IR_NEC_LOW_ONE/IR_NEC_TOL_DIV) {
471
            if (buf[i] > IR_NEC_LOW_ONE - IR_NEC_LOW_ONE/IR_NEC_TOL_DIV && buf[i] < IR_NEC_LOW_ONE + IR_NEC_LOW_ONE/IR_NEC_TOL_DIV) {
469
                /* write a one */
472
                /* write a one */
470
                rawbits |= 1UL<<((i-3)>>1);
473
                rawbits |= 1UL<<((i-3)>>1);
471
            } else if (buf[i] > IR_NEC_LOW_ZERO - IR_NEC_LOW_ZERO/IR_NEC_TOL_DIV && buf[i] < IR_NEC_LOW_ZERO + IR_NEC_LOW_ZERO/IR_NEC_TOL_DIV) {
474
            } else if (buf[i] > IR_NEC_LOW_ZERO - IR_NEC_LOW_ZERO/IR_NEC_TOL_DIV && buf[i] < IR_NEC_LOW_ZERO + IR_NEC_LOW_ZERO/IR_NEC_TOL_DIV) {
472
                /* do nothing, a zero is already in place */
475
                /* do nothing, a zero is already in place */
473
            } else {
476
            } else {
474
                return IR_NOT_CORRECT_DATA;
477
                return IR_NOT_CORRECT_DATA;
475
            }
478
            }
Line 487... Line 490...
487
}
490
}
488
#endif
491
#endif
489
 
492
 
490
/**
493
/**
491
 * Expand data from NEC protocol
494
 * Expand data from NEC protocol
492
 * http://www.sbprojects.com/knowledge/ir/nec.htm
495
 * http://www.sbprojects.com/knowledge/ir/nec.htm
493
 *
496
 *
494
 * @param buf
497
 * @param buf
495
 *      Pointer to buffer to store the expanded data
498
 *      Pointer to buffer to store the expanded data
496
 * @param len
499
 * @param len
497
 *      Pointer to length of the data
500
 *      Pointer to length of the data
498
 * @param proto
501
 * @param proto
Line 512... Line 515...
512
            if ((i&1) == 1) {       /* if odd, ir-pause */
515
            if ((i&1) == 1) {       /* if odd, ir-pause */
513
                if ((proto->data>>(i>>1))&1) {
516
                if ((proto->data>>(i>>1))&1) {
514
                    buf[i+2] = IR_NEC_LOW_ONE;
517
                    buf[i+2] = IR_NEC_LOW_ONE;
515
                } else {
518
                } else {
516
                    buf[i+2] = IR_NEC_LOW_ZERO;
519
                    buf[i+2] = IR_NEC_LOW_ZERO;
517
                }
520
                }
518
            } else {            /* if even, ir-bit */
521
            } else {            /* if even, ir-bit */
519
                buf[i+2] = IR_NEC_HIGH;
522
                buf[i+2] = IR_NEC_HIGH;
520
            }
523
            }
521
        }
524
        }
522
        proto->timeout=IR_NEC_TIMEOUT;
525
        proto->timeout=IR_NEC_TIMEOUT;
523
    } else {
526
    } else {
Line 533... Line 536...
533
 
536
 
534
 
537
 
535
#if (IR_PROTOCOLS_USE_SAMSUNG)
538
#if (IR_PROTOCOLS_USE_SAMSUNG)
536
/**
539
/**
537
 * Test data on Samsung protocol
540
 * Test data on Samsung protocol
538
 * Very much like NEC, different start bit/pause lengths etc.
541
 * Very much like NEC, different start bit/pause lengths etc.
539
 * http://www.sbprojects.com/knowledge/ir/nec.htm
542
 * http://www.sbprojects.com/knowledge/ir/nec.htm
540
 *
543
 *
541
 * @param buf
544
 * @param buf
542
 *      Pointer to buffer to where to data to parse is stored
545
 *      Pointer to buffer to where to data to parse is stored
543
 * @param len
546
 * @param len
544
 *      Length of the data
547
 *      Length of the data
545
 * @param proto
548
 * @param proto
546
 *      Pointer to protocol information
549
 *      Pointer to protocol information
547
 * @return
550
 * @return
548
 *      IR_OK if data parsed successfully, one of several errormessages if not
551
 *      IR_OK if data parsed successfully, one of several errormessages if not
Line 550... Line 553...
550
int8_t parseSamsung(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto) {
553
int8_t parseSamsung(const uint16_t *buf, uint8_t len, Ir_Protocol_Data_t *proto) {
551
    /* parse buf[], max is len */
554
    /* parse buf[], max is len */
552
 
555
 
553
    /* check if we have correct amount of data */
556
    /* check if we have correct amount of data */
554
    if (len != 67) {
557
    if (len != 67) {
555
        return IR_NOT_CORRECT_DATA;
558
        return IR_NOT_CORRECT_DATA;
556
    }
559
    }
557
   
560
   
558
    /* check startbit */
561
    /* check startbit */
559
    if (buf[0] > IR_SAMS_ST_BIT + IR_SAMS_ST_BIT/IR_SAMS_TOL_DIV || buf[0] < IR_SAMS_ST_BIT - IR_SAMS_ST_BIT/IR_SAMS_TOL_DIV) {
562
    if (buf[0] > IR_SAMS_ST_BIT + IR_SAMS_ST_BIT/IR_SAMS_TOL_DIV || buf[0] < IR_SAMS_ST_BIT - IR_SAMS_ST_BIT/IR_SAMS_TOL_DIV) {
560
        return IR_NOT_CORRECT_DATA;
563
        return IR_NOT_CORRECT_DATA;
561
    }
564
    }
562
 
565
 
563
    /* check pause after startbit */
566
    /* check pause after startbit */
564
    if (buf[1] > IR_SAMS_ST_PAUSE + IR_SAMS_ST_PAUSE/IR_SAMS_TOL_DIV || buf[1] < IR_SAMS_ST_PAUSE - IR_SAMS_ST_PAUSE/IR_SAMS_TOL_DIV) {
567
    if (buf[1] > IR_SAMS_ST_PAUSE + IR_SAMS_ST_PAUSE/IR_SAMS_TOL_DIV || buf[1] < IR_SAMS_ST_PAUSE - IR_SAMS_ST_PAUSE/IR_SAMS_TOL_DIV) {
565
        return IR_NOT_CORRECT_DATA;
568
        return IR_NOT_CORRECT_DATA;
566
    }
569
    }
567
 
570
 
568
    uint32_t rawbits = 0;
571
    uint32_t rawbits = 0;
569
   
572
   
570
    for (uint8_t i = 3; i < len; i++) {
573
    for (uint8_t i = 3; i < len; i++) {
571
        if ((i&1) == 1) {       /* if odd, ir-pause */
574
        if ((i&1) == 1) {       /* if odd, ir-pause */
572
            /* check length of pause between bits */
575
            /* check length of pause between bits */
573
            if (buf[i] > IR_SAMS_LOW_ONE - IR_SAMS_LOW_ONE/IR_SAMS_TOL_DIV && buf[i] < IR_SAMS_LOW_ONE + IR_SAMS_LOW_ONE/IR_SAMS_TOL_DIV) {
576
            if (buf[i] > IR_SAMS_LOW_ONE - IR_SAMS_LOW_ONE/IR_SAMS_TOL_DIV && buf[i] < IR_SAMS_LOW_ONE + IR_SAMS_LOW_ONE/IR_SAMS_TOL_DIV) {
Line 613... Line 616...
613
   
616
   
614
    for (uint8_t i = 0; i < 65; i++) {
617
    for (uint8_t i = 0; i < 65; i++) {
615
        if ((i&1) == 1) {       /* if odd, ir-pause */
618
        if ((i&1) == 1) {       /* if odd, ir-pause */
616
            if ((proto->data>>(i>>1))&1) {
619
            if ((proto->data>>(i>>1))&1) {
617
                buf[i+2] = IR_SAMS_LOW_ONE;
620
                buf[i+2] = IR_SAMS_LOW_ONE;
618
            } else {
621
            } else {
619
                buf[i+2] = IR_SAMS_LOW_ZERO;
622
                buf[i+2] = IR_SAMS_LOW_ZERO;
620
            }
623
            }
621
        } else {                /* if even, ir-bit */
624
        } else {                /* if even, ir-bit */
622
            buf[i+2] = IR_SAMS_HIGH;
625
            buf[i+2] = IR_SAMS_HIGH;
623
        }
626
        }
Line 663... Line 666...
663
            halfbitscnt += 1;
666
            halfbitscnt += 1;
664
        } else if (buf[i] > IR_MARANTZ_BIT - IR_MARANTZ_BIT/IR_MARANTZ_TOL_DIV && buf[i] < IR_MARANTZ_BIT + IR_MARANTZ_BIT/IR_MARANTZ_TOL_DIV) {
667
        } else if (buf[i] > IR_MARANTZ_BIT - IR_MARANTZ_BIT/IR_MARANTZ_TOL_DIV && buf[i] < IR_MARANTZ_BIT + IR_MARANTZ_BIT/IR_MARANTZ_TOL_DIV) {
665
            halfbitscnt += 2;
668
            halfbitscnt += 2;
666
        } else if (buf[i] > IR_MARANTZ_BIT - IR_MARANTZ_BIT/IR_MARANTZ_TOL_DIV && buf[i] < 5*IR_MARANTZ_HALF_BIT + IR_MARANTZ_BIT/IR_MARANTZ_TOL_DIV) {
669
        } else if (buf[i] > IR_MARANTZ_BIT - IR_MARANTZ_BIT/IR_MARANTZ_TOL_DIV && buf[i] < 5*IR_MARANTZ_HALF_BIT + IR_MARANTZ_BIT/IR_MARANTZ_TOL_DIV) {
667
            halfbitscnt += 1; //It seems to work, not entirely sure of the purpose of this long zero though.
670
            halfbitscnt += 1; //It seems to work, not entirely sure of the purpose of this long zero though.
668
        } else {
671
        } else {
669
            return IR_NOT_CORRECT_DATA;
672
            return IR_NOT_CORRECT_DATA;
670
        }
673
        }
671
       
674
       
672
    }
675
    }
673
   
676
   
674
    proto->protocol=CAN_MODULE_ENUM_PHYSICAL_IR_PROTOCOL_MARANTZ;
677
    proto->protocol=CAN_MODULE_ENUM_PHYSICAL_IR_PROTOCOL_MARANTZ;
675
    proto->timeout=IR_MARANTZ_TIMEOUT;
678
    proto->timeout=IR_MARANTZ_TIMEOUT;
Line 714... Line 717...
714
            if (previousBit == 1){//11
717
            if (previousBit == 1){//11
715
                buf[*len] = IR_MARANTZ_HALF_BIT;
718
                buf[*len] = IR_MARANTZ_HALF_BIT;
716
                buf[*len+1] = IR_MARANTZ_HALF_BIT;
719
                buf[*len+1] = IR_MARANTZ_HALF_BIT;
717
                *len = *len + 2;
720
                *len = *len + 2;
718
            } else {//01
721
            } else {//01
719
                buf[*len-1] = IR_MARANTZ_BIT;
722
                buf[*len-1] = IR_MARANTZ_BIT;
720
                buf[*len] = IR_MARANTZ_HALF_BIT;
723
                buf[*len] = IR_MARANTZ_HALF_BIT;
721
                *len = *len + 1;
724
                *len = *len + 1;
722
            }
725
            }
723
            previousBit = 1;
726
            previousBit = 1;
724
        } else {
727
        } else {
725
            if (previousBit == 1){//10
728
            if (previousBit == 1){//10
726
                buf[*len-1] = IR_MARANTZ_BIT;
729
                buf[*len-1] = IR_MARANTZ_BIT;
727
                buf[*len] = IR_MARANTZ_HALF_BIT;
730
                buf[*len] = IR_MARANTZ_HALF_BIT;
728
                *len = *len + 1;
731
                *len = *len + 1;
729
            } else {//00
732
            } else {//00
730
                buf[*len] = IR_MARANTZ_HALF_BIT;
733
                buf[*len] = IR_MARANTZ_HALF_BIT;
731
                if (i==4){
734
                if (i==4){
732
                    buf[*len+1] = IR_MARANTZ_HALF_BIT*5;
735
                    buf[*len+1] = IR_MARANTZ_HALF_BIT*5;
Line 740... Line 743...
740
        }
743
        }
741
    }
744
    }
742
    //make sure that we finish high by removing the last zero if needed
745
    //make sure that we finish high by removing the last zero if needed
743
    if (*len%2 == 0){
746
    if (*len%2 == 0){
744
        *len = *len - 1;
747
        *len = *len - 1;
745
    }
748
    }
746
 
749
 
747
    proto->modfreq=IR_MARANTZ_F_MOD;
750
    proto->modfreq=IR_MARANTZ_F_MOD;
748
    proto->timeout=IR_MARANTZ_TIMEOUT;
751
    proto->timeout=IR_MARANTZ_TIMEOUT;
749
    proto->repeats=IR_MARANTZ_REPS;
752
    proto->repeats=IR_MARANTZ_REPS;
750
    return IR_OK;
753
    return IR_OK;
Line 790... Line 793...
790
            if (buf[i] > IR_PANA_LOW_ONE - IR_PANA_LOW_ONE/IR_PANA_TOL_DIV && buf[i] < IR_PANA_LOW_ONE + IR_PANA_LOW_ONE/IR_PANA_TOL_DIV) {
793
            if (buf[i] > IR_PANA_LOW_ONE - IR_PANA_LOW_ONE/IR_PANA_TOL_DIV && buf[i] < IR_PANA_LOW_ONE + IR_PANA_LOW_ONE/IR_PANA_TOL_DIV) {
791
                /* write a one */
794
                /* write a one */
792
                rawbits |= 1UL<<((i-(3+16*2))>>1);
795
                rawbits |= 1UL<<((i-(3+16*2))>>1);
793
            } else if (buf[i] > IR_PANA_LOW_ZERO - IR_PANA_LOW_ZERO/IR_PANA_TOL_DIV && buf[i] < IR_PANA_LOW_ZERO + IR_PANA_LOW_ZERO/IR_PANA_TOL_DIV) {
796
            } else if (buf[i] > IR_PANA_LOW_ZERO - IR_PANA_LOW_ZERO/IR_PANA_TOL_DIV && buf[i] < IR_PANA_LOW_ZERO + IR_PANA_LOW_ZERO/IR_PANA_TOL_DIV) {
794
                /* do nothing, a zero is already in rawbits */
797
                /* do nothing, a zero is already in rawbits */
795
            } else {
798
            } else {
796
                return IR_NOT_CORRECT_DATA;
799
                return IR_NOT_CORRECT_DATA;
797
            }
800
            }
798
        } else {            /* if even, ir-bit */
801
        } else {            /* if even, ir-bit */
799
            if (buf[i] > IR_PANA_HIGH + IR_PANA_HIGH/IR_PANA_TOL_DIV || buf[i] < IR_PANA_HIGH - IR_PANA_HIGH/IR_PANA_TOL_DIV) {
802
            if (buf[i] > IR_PANA_HIGH + IR_PANA_HIGH/IR_PANA_TOL_DIV || buf[i] < IR_PANA_HIGH - IR_PANA_HIGH/IR_PANA_TOL_DIV) {
800
                return IR_NOT_CORRECT_DATA;
803
                return IR_NOT_CORRECT_DATA;
Line 862... Line 865...
862
}
865
}
863
 
866
 
864
#if (IR_PROTOCOLS_USE_SKY)
867
#if (IR_PROTOCOLS_USE_SKY)
865
/**
868
/**
866
 * Test data on Sky protocol
869
 * Test data on Sky protocol
867
 *
870
 *
868
 *
871
 *
869
 * @param buf
872
 * @param buf
870
 *      Pointer to buffer to where to data to parse is stored
873
 *      Pointer to buffer to where to data to parse is stored
871
 * @param len
874
 * @param len
872
 *      Length of the data
875
 *      Length of the data
873
 * @param proto
876
 * @param proto
874
 *      Pointer to protocol information
877
 *      Pointer to protocol information
Line 893... Line 896...
893
    {
896
    {
894
        if (buf[i] > IR_SKY_SHORT - IR_SKY_SHORT/IR_SKY_TOL_DIV && buf[i] < IR_SKY_SHORT + IR_SKY_SHORT/IR_SKY_TOL_DIV) {
897
        if (buf[i] > IR_SKY_SHORT - IR_SKY_SHORT/IR_SKY_TOL_DIV && buf[i] < IR_SKY_SHORT + IR_SKY_SHORT/IR_SKY_TOL_DIV) {
895
            current = SKYSHORT;
898
            current = SKYSHORT;
896
        }
899
        }
897
        else if (buf[i] > IR_SKY_LONG - IR_SKY_LONG/IR_SKY_TOL_DIV && buf[i] < IR_SKY_LONG + IR_SKY_LONG/IR_SKY_TOL_DIV) {
900
        else if (buf[i] > IR_SKY_LONG - IR_SKY_LONG/IR_SKY_TOL_DIV && buf[i] < IR_SKY_LONG + IR_SKY_LONG/IR_SKY_TOL_DIV) {
898
            current = SKYLONG;
901
            current = SKYLONG;
899
        }
902
        }
900
        else {
903
        else {
901
            return IR_NOT_CORRECT_DATA;
904
            return IR_NOT_CORRECT_DATA;
902
        }
905
        }
903
       
906
       
904
        /* if level is low */
907
        /* if level is low */
905
        if ((rawbits&1)==0) {
908
        if ((rawbits&1)==0) {
906
            /* and there is a long pulse */
909
            /* and there is a long pulse */
907
            if (current == SKYLONG) {
910
            if (current == SKYLONG) {
908
                /* push a one */
911
                /* push a one */
909
                rawbits = rawbits<<1;
912
                rawbits = rawbits<<1;
910
                rawbits |= 1;
913
                rawbits |= 1;
911
                cnt = 0;
914
                cnt = 0;
912
            }
915
            }
913
            else if (cnt == 0) {
916
            else if (cnt == 0) {
914
                cnt=1;
917
                cnt=1;
915
                /* push a zero */
918
                /* push a zero */
916
                rawbits = rawbits<<1;
919
                rawbits = rawbits<<1;
917
               
920
               
918
            }
921
            }
919
            else {
922
            else {
920
                cnt = 0;
923
                cnt = 0;
921
            }
924
            }
922
        }
925
        }
923
       
926
       
924
        /* if level is high */
927
        /* if level is high */
925
        if ((rawbits&1)==1) {
928
        if ((rawbits&1)==1) {
926
            /* and there is a long pulse */
929
            /* and there is a long pulse */
927
            if (current == SKYLONG) {
930
            if (current == SKYLONG) {
928
                /* push a zero */
931
                /* push a zero */
929
                rawbits = rawbits<<1;
932
                rawbits = rawbits<<1;
930
               
933
               
931
                if (previous == SKYLONG) {
934
                if (previous == SKYLONG) {
932
                    cnt = 1;
935
                    cnt = 1;
933
                }
936
                }
934
                else {
937
                else {
935
                    cnt = 0;
938
                    cnt = 0;
936
                }
939
                }
937
            }
940
            }
938
            else if (cnt == 0) {
941
            else if (cnt == 0) {
939
                cnt=1;
942
                cnt=1;
940
                /* push a one */
943
                /* push a one */
941
                rawbits = rawbits<<1;
944
                rawbits = rawbits<<1;
942
                rawbits |= 1;
945
                rawbits |= 1;
943
            }
946
            }
944
            else {
947
            else {
945
                cnt = 0;
948
                cnt = 0;
946
            }
949
            }
Line 1011... Line 1014...
1011
 
1014
 
1012
    for (uint8_t i = 0; i < len; i++)
1015
    for (uint8_t i = 0; i < len; i++)
1013
    {
1016
    {
1014
        if (buf[i] > IR_IROBOT_SHORT - IR_IROBOT_SHORT/IR_IROBOT_TOL_DIV && buf[i] < IR_IROBOT_SHORT + IR_IROBOT_SHORT/IR_IROBOT_TOL_DIV) {
1017
        if (buf[i] > IR_IROBOT_SHORT - IR_IROBOT_SHORT/IR_IROBOT_TOL_DIV && buf[i] < IR_IROBOT_SHORT + IR_IROBOT_SHORT/IR_IROBOT_TOL_DIV) {
1015
            current = IROBOTSHORT;
1018
            current = IROBOTSHORT;
1016
        }
1019
        }
1017
        else if (buf[i] > IR_IROBOT_LONG - IR_IROBOT_LONG/IR_IROBOT_TOL_DIV && buf[i] < IR_IROBOT_LONG + IR_IROBOT_LONG/IR_IROBOT_TOL_DIV) {
1020
        else if (buf[i] > IR_IROBOT_LONG - IR_IROBOT_LONG/IR_IROBOT_TOL_DIV && buf[i] < IR_IROBOT_LONG + IR_IROBOT_LONG/IR_IROBOT_TOL_DIV) {
1018
            current = IROBOTLONG;
1021
            current = IROBOTLONG;
1019
        }
1022
        }
1020
        else {
1023
        else {
1021
            return IR_NOT_CORRECT_DATA;
1024
            return IR_NOT_CORRECT_DATA;
1022
        }
1025
        }
1023
       
1026
       
1024
        /* if level is low */
1027
        /* if level is low */
1025
        if ((rawbits&1)==0) {
1028
        if ((rawbits&1)==0) {
1026
            /* and there is a long pulse */
1029
            /* and there is a long pulse */
1027
            if (current == IROBOTLONG) {
1030
            if (current == IROBOTLONG) {
1028
                /* push a one */
1031
                /* push a one */
1029
                rawbits = rawbits<<1;
1032
                rawbits = rawbits<<1;
1030
                rawbits |= 1;
1033
                rawbits |= 1;
1031
                cnt = 0;
1034
                cnt = 0;
1032
            }
1035
            }
1033
            else if (cnt == 0) {
1036
            else if (cnt == 0) {
1034
                cnt=1;
1037
                cnt=1;
1035
                /* push a zero */
1038
                /* push a zero */
1036
                rawbits = rawbits<<1;
1039
                rawbits = rawbits<<1;
1037
               
1040
               
1038
            }
1041
            }
1039
            else {
1042
            else {
1040
                cnt = 0;
1043
                cnt = 0;
1041
            }
1044
            }
1042
        }
1045
        }
1043
       
1046
       
1044
        /* if level is high */
1047
        /* if level is high */
1045
        if ((rawbits&1)==1) {
1048
        if ((rawbits&1)==1) {
1046
            /* and there is a long pulse */
1049
            /* and there is a long pulse */
1047
            if (current == IROBOTLONG) {
1050
            if (current == IROBOTLONG) {
1048
                /* push a zero */
1051
                /* push a zero */
1049
                rawbits = rawbits<<1;
1052
                rawbits = rawbits<<1;
1050
               
1053
               
1051
                if (previous == IROBOTLONG) {
1054
                if (previous == IROBOTLONG) {
1052
                    cnt = 1;
1055
                    cnt = 1;
1053
                }
1056
                }
1054
                else {
1057
                else {
1055
                    cnt = 0;
1058
                    cnt = 0;
1056
                }
1059
                }
1057
            }
1060
            }
1058
            else if (cnt == 0) {
1061
            else if (cnt == 0) {
1059
                cnt=1;
1062
                cnt=1;
1060
                /* push a one */
1063
                /* push a one */
1061
                rawbits = rawbits<<1;
1064
                rawbits = rawbits<<1;
1062
                rawbits |= 1;
1065
                rawbits |= 1;
1063
            }
1066
            }
1064
            else {
1067
            else {
1065
                cnt = 0;
1068
                cnt = 0;
1066
            }
1069
            }
1067
        }
1070
        }
1068
       
1071
       
1069
        previous=current;
1072
        previous=current;
1070
       
1073
       
1071
    }
1074
    }
1072
   
1075
   
1073
    proto->protocol = CAN_MODULE_ENUM_PHYSICAL_IR_PROTOCOL_IROBOT;
1076
    proto->protocol = CAN_MODULE_ENUM_PHYSICAL_IR_PROTOCOL_IROBOT;
1074
    proto->timeout = IR_IROBOT_TIMEOUT;
1077
    proto->timeout = IR_IROBOT_TIMEOUT;
Line 1451... Line 1454...
1451
        }
1454
        }
1452
        else
1455
        else
1453
        {           /* if odd, data */
1456
        {           /* if odd, data */
1454
            /* check length of transmit pulse */
1457
            /* check length of transmit pulse */
1455
            if ((buf[i2] > IR_VIKING_HIGH_ONE - IR_VIKING_HIGH_ONE/IR_VIKING_TOL_DIV) && (buf[i2] < IR_VIKING_HIGH_ONE + IR_VIKING_HIGH_ONE/IR_VIKING_TOL_DIV))
1458
            if ((buf[i2] > IR_VIKING_HIGH_ONE - IR_VIKING_HIGH_ONE/IR_VIKING_TOL_DIV) && (buf[i2] < IR_VIKING_HIGH_ONE + IR_VIKING_HIGH_ONE/IR_VIKING_TOL_DIV))
1456
            {
1459
            {
1457
                /* write a one */
1460
                /* write a one */
1458
                rawbitsTemp = rawbitsTemp<<1;
1461
                rawbitsTemp = rawbitsTemp<<1;
1459
                rawbitsTemp |= 1;
1462
                rawbitsTemp |= 1;
1460
            }
1463
            }
1461
            else if ((buf[i2] > IR_VIKING_HIGH_ZERO - IR_VIKING_HIGH_ZERO/IR_VIKING_TOL_DIV) && (buf[i2] < IR_VIKING_HIGH_ZERO + IR_VIKING_HIGH_ZERO/IR_VIKING_TOL_DIV))
1464
            else if ((buf[i2] > IR_VIKING_HIGH_ZERO - IR_VIKING_HIGH_ZERO/IR_VIKING_TOL_DIV) && (buf[i2] < IR_VIKING_HIGH_ZERO + IR_VIKING_HIGH_ZERO/IR_VIKING_TOL_DIV))
1462
            {
1465
            {
1463
                /* do nothing, a zero is already in rawbits */
1466
                /* do nothing, a zero is already in rawbits */
1464
                rawbitsTemp = rawbitsTemp<<1;
1467
                rawbitsTemp = rawbitsTemp<<1;
1465
            }
1468
            }
1466
            else
1469
            else
1467
            {
1470
            {
1468
                return IR_NOT_CORRECT_DATA;
1471
                return IR_NOT_CORRECT_DATA;
1469
            }
1472
            }
1470
        }
1473
        }
1471
    }
1474
    }
1472
   
1475
   
1473
    rawbitsTemp = ~rawbitsTemp;
1476
    rawbitsTemp = ~rawbitsTemp;
1474
    rawbitsTemp = rawbitsTemp&0xFFFFFFFFFF;
1477
    rawbitsTemp = rawbitsTemp&0xFFFFFFFFFF;
1475
   
1478
   
1476
    proto->protocol=CAN_MODULE_ENUM_PHYSICAL_IR_PROTOCOL_VIKING;
1479
    proto->protocol=CAN_MODULE_ENUM_PHYSICAL_IR_PROTOCOL_VIKING;
1477
    proto->timeout=0;
1480
    proto->timeout=0;
1478
    proto->data=rawbitsTemp;
1481
    proto->data=rawbitsTemp;
1479
 
1482
 
1480
    return IR_OK;
1483
    return IR_OK;
Line 1482... Line 1485...
1482
    return IR_NOT_CORRECT_DATA;
1485
    return IR_NOT_CORRECT_DATA;
1483
#endif
1486
#endif
1484
}
1487
}
1485
#endif
1488
#endif
1486
 
1489
 
1487
 
1490
 
1488
#if (IR_PROTOCOLS_USE_VIKING_STEAK)
1491
#if (IR_PROTOCOLS_USE_VIKING_STEAK)
1489
/**
1492
/**
1490
 * Test data on Viking steak temperature sensor protocol
1493
 * Test data on Viking steak temperature sensor protocol
-
 
1494
 *
-
 
1495
 *
-
 
1496
 *
-
 
1497
 * @param buf
-
 
1498
 *      Pointer to buffer to where to data to parse is stored
-
 
1499
 * @param len
-
 
1500
 *      Length of the data
-
 
1501
 * @param proto
-
 
1502
 *      Pointer to protocol information
-
 
1503
 * @return
-
 
1504
 *      IR_OK if data parsed successfully, one of several errormessages if not
-
 
1505
 */
-
 
1506
 
-
 
1507
int8_t parseVikingSteak(const uint16_t *buf, uint8_t len, uint8_t index, Ir_Protocol_Data_t *proto)
-
 
1508
{
-
 
1509
#if IR_RX_CONTINUOUS_MODE==1
-
 
1510
    /* check if we have correct amount of data */
-
 
1511
    if (len < 74) {
-
 
1512
        return IR_NOT_CORRECT_DATA;
-
 
1513
    }
-
 
1514
    uint8_t i, i2;
-
 
1515
    uint64_t rawbitsTemp = 0;//0xffffffffffffffff;
-
 
1516
   
-
 
1517
    /* Check start bit condition */
-
 
1518
    i2=index-74;
-
 
1519
    if (i2>index)
-
 
1520
        i2+=MAX_NR_TIMES;
-
 
1521
 
-
 
1522
    proto->data=i2;     /*Store startindex for debug output */
-
 
1523
   
-
 
1524
    if ((buf[i2] < IR_VIKING_STEAK_LOW_START - IR_VIKING_STEAK_LOW_START/IR_VIKING_STEAK_TOL_DIV) || (buf[i2] > IR_VIKING_STEAK_LOW_START + IR_VIKING_STEAK_LOW_START/IR_VIKING_STEAK_TOL_DIV))
-
 
1525
    {
-
 
1526
        return IR_NOT_CORRECT_DATA;
-
 
1527
    }
-
 
1528
   
-
 
1529
    for (i = 73; i > 0; i--)
-
 
1530
    {
-
 
1531
        i2=index-i;
-
 
1532
        if (i2>index)
-
 
1533
            i2+=MAX_NR_TIMES;
-
 
1534
 
-
 
1535
        /* Check if correct amount of data have been received */
-
 
1536
        //if ((i == 78) && (rawbitsTemp != 0b00001))
-
 
1537
        //  return IR_NOT_CORRECT_DATA;
-
 
1538
 
-
 
1539
        if ((i&1) != 0)
-
 
1540
        {       /* if odd, no data */
-
 
1541
            if ((buf[i2] < IR_VIKING_STEAK_HIGH - IR_VIKING_STEAK_HIGH/IR_VIKING_STEAK_TOL_DIV) || (buf[i2] > IR_VIKING_STEAK_HIGH + IR_VIKING_STEAK_HIGH/IR_VIKING_STEAK_TOL_DIV))
-
 
1542
            {
-
 
1543
                return IR_NOT_CORRECT_DATA;
-
 
1544
            }
-
 
1545
        }
-
 
1546
        else
-
 
1547
        {           /* if even, data */
-
 
1548
            /* check length of transmit pulse */
-
 
1549
            if ((buf[i2] > IR_VIKING_STEAK_LOW_ONE - IR_VIKING_STEAK_LOW_ONE/IR_VIKING_STEAK_TOL_DIV) && (buf[i2] < IR_VIKING_STEAK_LOW_ONE + IR_VIKING_STEAK_LOW_ONE/IR_VIKING_STEAK_TOL_DIV))
-
 
1550
            {
-
 
1551
                /* write a one */
-
 
1552
                rawbitsTemp = rawbitsTemp<<1;
-
 
1553
                rawbitsTemp |= 1;
-
 
1554
            }
-
 
1555
            else if ((buf[i2] > IR_VIKING_STEAK_LOW_ZERO - IR_VIKING_STEAK_LOW_ZERO/IR_VIKING_STEAK_TOL_DIV) && (buf[i2] < IR_VIKING_STEAK_LOW_ZERO + IR_VIKING_STEAK_LOW_ZERO/IR_VIKING_STEAK_TOL_DIV))
-
 
1556
            {
-
 
1557
                /* do nothing, a zero is already in rawbits */
-
 
1558
                rawbitsTemp = rawbitsTemp<<1;
-
 
1559
            }
-
 
1560
            else
-
 
1561
            {
-
 
1562
                return IR_NOT_CORRECT_DATA;
-
 
1563
            }
-
 
1564
        }
-
 
1565
    }
-
 
1566
   
-
 
1567
    //rawbitsTemp = ~rawbitsTemp;
-
 
1568
    //rawbitsTemp = rawbitsTemp&0xFFFFFFFFFF;
-
 
1569
   
-
 
1570
    proto->protocol=CAN_MODULE_ENUM_PHYSICAL_IR_PROTOCOL_VIKINGSTEAK;
-
 
1571
    proto->timeout=IR_VIKING_STEAK_TIMEOUT;
-
 
1572
    proto->data=rawbitsTemp;
-
 
1573
 
-
 
1574
    return IR_OK;
-
 
1575
#else
-
 
1576
    return IR_NOT_CORRECT_DATA;
-
 
1577
#endif
-
 
1578
}
-
 
1579
#endif
-
 
1580
 
-
 
1581
#if (IR_PROTOCOLS_USE_RUBICSON)
-
 
1582
/**
-
 
1583
 * Test data on Rubicson temperature sensor protocol
1491
 *
1584
 *
1492
 *
1585
 *
1493
 *
1586
 *
1494
 * @param buf
1587
 * @param buf
1495
 *      Pointer to buffer to where to data to parse is stored
1588
 *      Pointer to buffer to where to data to parse is stored
1496
 * @param len
1589
 * @param len
1497
 *      Length of the data
1590
 *      Length of the data
1498
 * @param proto
1591
 * @param proto
1499
 *      Pointer to protocol information
1592
 *      Pointer to protocol information
1500
 * @return
1593
 * @return
1501
 *      IR_OK if data parsed successfully, one of several errormessages if not
1594
 *      IR_OK if data parsed successfully, one of several errormessages if not
1502
 */
1595
 */
1503
 
1596
 
1504
int8_t parseVikingSteak(const uint16_t *buf, uint8_t len, uint8_t index, Ir_Protocol_Data_t *proto)
1597
int8_t parseRubicson(const uint16_t *buf, uint8_t len, uint8_t index, Ir_Protocol_Data_t *proto)
1505
{
1598
{
1506
#if IR_RX_CONTINUOUS_MODE==1
1599
#if IR_RX_CONTINUOUS_MODE==1
1507
    /* check if we have correct amount of data */
1600
    /* check if we have correct amount of data */
1508
    if (len < 74) {
1601
    if (len < 74) {
1509
        return IR_NOT_CORRECT_DATA;
1602
        return IR_NOT_CORRECT_DATA;
Line 1511... Line 1604...
1511
    uint8_t i, i2;
1604
    uint8_t i, i2;
1512
    uint64_t rawbitsTemp = 0;//0xffffffffffffffff;
1605
    uint64_t rawbitsTemp = 0;//0xffffffffffffffff;
1513
   
1606
   
1514
    /* Check start bit condition */
1607
    /* Check start bit condition */
1515
    i2=index-74;
1608
    i2=index-74;
1516
    if (i2>index)
1609
    if (i2>index)
1517
        i2+=MAX_NR_TIMES;
1610
        i2+=MAX_NR_TIMES;
1518
 
1611
 
1519
    proto->data=i2;     /*Store startindex for debug output */
1612
    proto->data=i2;     /*Store startindex for debug output */
1520
   
1613
   
1521
    if ((buf[i2] < IR_VIKING_STEAK_LOW_START - IR_VIKING_STEAK_LOW_START/IR_VIKING_STEAK_TOL_DIV) || (buf[i2] > IR_VIKING_STEAK_LOW_START + IR_VIKING_STEAK_LOW_START/IR_VIKING_STEAK_TOL_DIV))
1614
    if ((buf[i2] < IR_RUBICSON_LOW_START - IR_RUBICSON_LOW_START/IR_RUBICSON_TOL_DIV) || (buf[i2] > IR_RUBICSON_LOW_START + IR_RUBICSON_LOW_START/IR_RUBICSON_TOL_DIV))
1522
    {
1615
    {
1523
        return IR_NOT_CORRECT_DATA;
1616
        return IR_NOT_CORRECT_DATA;
1524
    }
1617
    }
1525
   
1618
   
1526
    for (i = 73; i > 0; i--)
1619
    for (i = 73; i > 0; i--)
1527
    {
1620
    {
1528
        i2=index-i;
1621
        i2=index-i;
1529
        if (i2>index)
1622
        if (i2>index)
Line 1533... Line 1626...
1533
        //if ((i == 78) && (rawbitsTemp != 0b00001))
1626
        //if ((i == 78) && (rawbitsTemp != 0b00001))
1534
        //  return IR_NOT_CORRECT_DATA;
1627
        //  return IR_NOT_CORRECT_DATA;
1535
 
1628
 
1536
        if ((i&1) != 0)
1629
        if ((i&1) != 0)
1537
        {       /* if odd, no data */
1630
        {       /* if odd, no data */
1538
            if ((buf[i2] < IR_VIKING_STEAK_HIGH - IR_VIKING_STEAK_HIGH/IR_VIKING_STEAK_TOL_DIV) || (buf[i2] > IR_VIKING_STEAK_HIGH + IR_VIKING_STEAK_HIGH/IR_VIKING_STEAK_TOL_DIV))
1631
            if ((buf[i2] < IR_RUBICSON_HIGH - IR_RUBICSON_HIGH/IR_RUBICSON_TOL_DIV) || (buf[i2] > IR_RUBICSON_HIGH + IR_RUBICSON_HIGH/IR_RUBICSON_TOL_DIV))
1539
            {
1632
            {
1540
                return IR_NOT_CORRECT_DATA;
1633
                return IR_NOT_CORRECT_DATA;
1541
            }
1634
            }
1542
        }
1635
        }
1543
        else
1636
        else
1544
        {           /* if even, data */
1637
        {           /* if even, data */
1545
            /* check length of transmit pulse */
1638
            /* check length of transmit pulse */
1546
            if ((buf[i2] > IR_VIKING_STEAK_LOW_ONE - IR_VIKING_STEAK_LOW_ONE/IR_VIKING_STEAK_TOL_DIV) && (buf[i2] < IR_VIKING_STEAK_LOW_ONE + IR_VIKING_STEAK_LOW_ONE/IR_VIKING_STEAK_TOL_DIV))
1639
            if ((buf[i2] > IR_RUBICSON_LOW_ONE - IR_RUBICSON_LOW_ONE/IR_RUBICSON_TOL_DIV) && (buf[i2] < IR_RUBICSON_LOW_ONE + IR_RUBICSON_LOW_ONE/IR_RUBICSON_TOL_DIV))
1547
            {
1640
            {
1548
                /* write a one */
1641
                /* write a one */
1549
                rawbitsTemp = rawbitsTemp<<1;
1642
                rawbitsTemp = rawbitsTemp<<1;
1550
                rawbitsTemp |= 1;
1643
                rawbitsTemp |= 1;
1551
            }
1644
            }
1552
            else if ((buf[i2] > IR_VIKING_STEAK_LOW_ZERO - IR_VIKING_STEAK_LOW_ZERO/IR_VIKING_STEAK_TOL_DIV) && (buf[i2] < IR_VIKING_STEAK_LOW_ZERO + IR_VIKING_STEAK_LOW_ZERO/IR_VIKING_STEAK_TOL_DIV))
1645
            else if ((buf[i2] > IR_RUBICSON_LOW_ZERO - IR_RUBICSON_LOW_ZERO/IR_RUBICSON_TOL_DIV) && (buf[i2] < IR_RUBICSON_LOW_ZERO + IR_RUBICSON_LOW_ZERO/IR_RUBICSON_TOL_DIV))
1553
            {
1646
            {
1554
                /* do nothing, a zero is already in rawbits */
1647
                /* do nothing, a zero is already in rawbits */
1555
                rawbitsTemp = rawbitsTemp<<1;
1648
                rawbitsTemp = rawbitsTemp<<1;
1556
            }
1649
            }
1557
            else
1650
            else
1558
            {
1651
            {
1559
                return IR_NOT_CORRECT_DATA;
1652
                return IR_NOT_CORRECT_DATA;
1560
            }
1653
            }
1561
        }
1654
        }
1562
    }
1655
    }
1563
   
1656
   
1564
    //rawbitsTemp = ~rawbitsTemp;
1657
    //rawbitsTemp = ~rawbitsTemp;
1565
    //rawbitsTemp = rawbitsTemp&0xFFFFFFFFFF;
1658
    //rawbitsTemp = rawbitsTemp&0xFFFFFFFFFF;
1566
   
1659
   
1567
    proto->protocol=CAN_MODULE_ENUM_PHYSICAL_IR_PROTOCOL_VIKINGSTEAK;
1660
    proto->protocol=CAN_MODULE_ENUM_PHYSICAL_IR_PROTOCOL_RUBICSON;
1568
    proto->timeout=IR_VIKING_STEAK_TIMEOUT;
1661
    proto->timeout=IR_RUBICSON_TIMEOUT;
1569
    proto->data=rawbitsTemp;
1662
    proto->data=rawbitsTemp;
1570
 
1663
 
1571
    return IR_OK;
1664
    return IR_OK;
1572
#else
1665
#else
1573
    return IR_NOT_CORRECT_DATA;
1666
    return IR_NOT_CORRECT_DATA;
1574
#endif
1667
#endif
1575
}
1668
}
1576
#endif
1669
#endif
1577
 
1670
 
-
 
1671
 
-
 
1672
 
1578
#if (IR_PROTOCOLS_USE_RUBICSON)
1673
#if (IR_PROTOCOLS_USE_OREGON)
1579
/**
1674
/**
1580
 * Test data on Rubicson temperature sensor protocol
1675
 * Test data on OREGON weather sensor protocol
1581
 *
1676
 *
1582
 *
1677
 *
1583
 *
1678
 *
1584
 * @param buf
1679
 * @param buf
1585
 *      Pointer to buffer to where to data to parse is stored
1680
 *      Pointer to buffer to where to data to parse is stored
1586
 * @param len
1681
 * @param len
Line 1588... Line 1683...
1588
 * @param proto
1683
 * @param proto
1589
 *      Pointer to protocol information
1684
 *      Pointer to protocol information
1590
 * @return
1685
 * @return
1591
 *      IR_OK if data parsed successfully, one of several errormessages if not
1686
 *      IR_OK if data parsed successfully, one of several errormessages if not
1592
 */
1687
 */
1593
 
1688
 
1594
int8_t parseRubicson(const uint16_t *buf, uint8_t len, uint8_t index, Ir_Protocol_Data_t *proto)
1689
int8_t parseOregon(const uint16_t *buf, uint8_t len, uint8_t index, Ir_Protocol_Data_t *proto)
1595
{
1690
{
1596
#if IR_RX_CONTINUOUS_MODE==1
1691
#if IR_RX_CONTINUOUS_MODE==1
1597
    /* check if we have correct amount of data */
1692
    /* check if we have correct amount of data */
1598
    if (len < 74) {
-
 
1599
        return IR_NOT_CORRECT_DATA;
-
 
1600
    }
-
 
1601
    uint8_t i, i2;
-
 
1602
    uint64_t rawbitsTemp = 0;//0xffffffffffffffff;
-
 
1603
   
-
 
1604
    /* Check start bit condition */
1693
    if (len < 74) { //Ändra till vettigt värde
1605
    i2=index-74;
-
 
1606
    if (i2>index)
-
 
1607
        i2+=MAX_NR_TIMES;
-
 
1608
 
-
 
1609
    proto->data=i2;     /*Store startindex for debug output */
-
 
1610
   
-
 
1611
    if ((buf[i2] < IR_RUBICSON_LOW_START - IR_RUBICSON_LOW_START/IR_RUBICSON_TOL_DIV) || (buf[i2] > IR_RUBICSON_LOW_START + IR_RUBICSON_LOW_START/IR_RUBICSON_TOL_DIV))
-
 
1612
    {
-
 
1613
        return IR_NOT_CORRECT_DATA;
1694
        return IR_NOT_CORRECT_DATA;
1614
    }
1695
    }
-
 
1696
    uint8_t data[IR_OREGON_DATASIZE]; //Verifiera minsta möjliga storlek
-
 
1697
    uint8_t i2 = 0;
-
 
1698
    uint8_t b_i;
-
 
1699
    uint8_t currentBit = 0;
-
 
1700
    uint8_t done = 0;
-
 
1701
    uint8_t invert = 0;
-
 
1702
    uint8_t shift = 0;
-
 
1703
    uint8_t i = index;
-
 
1704
    uint64_t rawbitsTemp = 0;//0xffffffffffffffff;
1615
   
1705
   
1616
    for (i = 73; i > 0; i--)
-
 
1617
    {
-
 
1618
        i2=index-i;
-
 
1619
        if (i2>index)
-
 
1620
            i2+=MAX_NR_TIMES;
-
 
1621
 
-
 
1622
        /* Check if correct amount of data have been received */
1706
    /* Check stop condition */
1623
        //if ((i == 78) && (rawbitsTemp != 0b00001))
-
 
1624
        //  return IR_NOT_CORRECT_DATA;
1707
    if (buf[i] < IR_OREGON_END)
1625
 
-
 
1626
        if ((i&1) != 0)
-
 
1627
        {       /* if odd, no data */
-
 
1628
            if ((buf[i2] < IR_RUBICSON_HIGH - IR_RUBICSON_HIGH/IR_RUBICSON_TOL_DIV) || (buf[i2] > IR_RUBICSON_HIGH + IR_RUBICSON_HIGH/IR_RUBICSON_TOL_DIV))
-
 
1629
            {
1708
    {
1630
                return IR_NOT_CORRECT_DATA;
1709
        return IR_NOT_CORRECT_DATA;
1631
            }
1710
    }
1632
        }
1711
    i--; //set index to last bit
1633
        else
1712
    len--; //Store remaining length
1634
        {           /* if even, data */
1713
    //loop to store data
-
 
1714
    while (done == 0) { //Wait for sync pulse and preamble, loop for all bytes
1635
            /* check length of transmit pulse */
1715
        for (b_i = 0;b_i<8;b_i++) { //loop for each bit
1636
            if ((buf[i2] > IR_RUBICSON_LOW_ONE - IR_RUBICSON_LOW_ONE/IR_RUBICSON_TOL_DIV) && (buf[i2] < IR_RUBICSON_LOW_ONE + IR_RUBICSON_LOW_ONE/IR_RUBICSON_TOL_DIV))
1716
            if (((buf[i] < IR_OREGON_SHORT_L) && (buf[i] > IR_OREGON_SHORT_S)) ) {
1637
            {
1717
                i--;
-
 
1718
                if (i > MAX_NR_TIMES) i = MAX_NR_TIMES - 1;
-
 
1719
                if (((buf[i] < IR_OREGON_SHORT_L) && (buf[i] > IR_OREGON_SHORT_S))) {
1638
                /* write a one */
1720
                    //Keep previous bit value
1639
                rawbitsTemp = rawbitsTemp<<1;
1721
                    data[i2] = data[b_i] << 1;
1640
                rawbitsTemp |= 1;
1722
                    data[i2] += currentBit;
1641
            }
1723
                    i--;
1642
            else if ((buf[i2] > IR_RUBICSON_LOW_ZERO - IR_RUBICSON_LOW_ZERO/IR_RUBICSON_TOL_DIV) && (buf[i2] < IR_RUBICSON_LOW_ZERO + IR_RUBICSON_LOW_ZERO/IR_RUBICSON_TOL_DIV))
1724
                    if (i > MAX_NR_TIMES) i = MAX_NR_TIMES - 1;
-
 
1725
                } else { return IR_NOT_CORRECT_DATA;}  
1643
            {
1726
            }
-
 
1727
            else if (((buf[i] < IR_OREGON_LONG_L) && (buf[i] > IR_OREGON_LONG_S))) {
1644
                /* do nothing, a zero is already in rawbits */
1728
                //Invert previous bit value
1645
                rawbitsTemp = rawbitsTemp<<1;
1729
                if (currentBit)
1646
            }
1730
                    currentBit = 0;
1647
            else
1731
                else
-
 
1732
                    currentBit = 1;
-
 
1733
                data[i2] = data[b_i] << 1;
-
 
1734
                data[i2] += currentBit;
-
 
1735
                i--;
-
 
1736
                if (i > MAX_NR_TIMES) i = MAX_NR_TIMES - 1;
-
 
1737
            }
-
 
1738
            else { return IR_NOT_CORRECT_DATA;}
-
 
1739
        }
-
 
1740
        //swap nibbles to make parsing easier
-
 
1741
        uint8_t temp = data[i2] << 4;
-
 
1742
        data[i2] = (data[i2] >> 4) + temp;
-
 
1743
        //check for end condition
-
 
1744
        if (i2 > 6) { // TODO check what value to use here
-
 
1745
            if (data[i2] == 0xFFu && data[i2-1] == 0xFAu) {
-
 
1746
                done = 1;
-
 
1747
            }
-
 
1748
            if (data[i2] == 0x00u && data[i2-1] == 0x05u) {
-
 
1749
                done = 1;
-
 
1750
                invert = 1;
-
 
1751
            }
-
 
1752
            if (data[i2] == 0xFFu && (data[i2-1]&0xF0u) == 0xA0u) {
-
 
1753
                shift = 1;
-
 
1754
                done = 1;
-
 
1755
            }
-
 
1756
            if (data[i2] == 0x00u && (data[i2-1]&0xF0u) == 0x50u) {
-
 
1757
                shift = 1;
-
 
1758
                done = 1;
-
 
1759
                invert = 1;
-
 
1760
            }
-
 
1761
        }
-
 
1762
        i2++;
-
 
1763
        if (i2 >= IR_OREGON_DATASIZE)
1648
            {
1764
        {
-
 
1765
            return IR_NOT_CORRECT_DATA;
-
 
1766
        }
-
 
1767
    }  
-
 
1768
    i2--; //restore index
-
 
1769
    if (invert == 1) {
-
 
1770
        for (b_i = 0;b_i<=i2;b_i++) { //loop for each byte
-
 
1771
            data[b_i] ^= 0xFFu;
-
 
1772
        }
-
 
1773
    }
-
 
1774
    if (shift == 1) {
-
 
1775
        for (b_i = i2;b_i>0;b_i--) { //loop for each byte
-
 
1776
            data[b_i] = (data[b_i] << 4) + (data[(b_i - 1)] & 0x0Fu);
-
 
1777
        }
-
 
1778
        data[0] = data[0] << 4;
-
 
1779
        i2--; //remove sync byte
-
 
1780
    } else {
-
 
1781
        i2--; //remove sync byte
-
 
1782
        i2--; //remove sync byte
-
 
1783
    }
-
 
1784
   
-
 
1785
   
-
 
1786
    switch (data[i2]) {
-
 
1787
        case 0x19u:
-
 
1788
            if (data[i2-1] == 0x84 || data[i2-1] == 0x94 ) { //Anemometer
-
 
1789
                i2-=2; //Remove Sensor id
-
 
1790
                rawbitsTemp = 0x100000000000uL; //Anemometer id
-
 
1791
                rawbitsTemp |= ((uint64_t)(data[i2]&0xF0u)) << 36; //store channel as MSB
-
 
1792
                i2--;
-
 
1793
                if (data[i2] == 0x4u)
-
 
1794
                    rawbitsTemp |= 0x080000000000uL; //Bat Low flag
-
 
1795
                i2--;
-
 
1796
                rawbitsTemp |= ((uint64_t)(data[i2]&0xF0u)) << 28; //store wind direction 0x0->0xF
-
 
1797
                i2--;
-
 
1798
                rawbitsTemp |= ((uint64_t)(data[i2]&0x0Fu)) << 24; //store current wind speed
-
 
1799
                i2--;
-
 
1800
                rawbitsTemp |= ((uint64_t)(data[i2])) << 16; //store current wind speed
-
 
1801
                i2--;
-
 
1802
                rawbitsTemp |= ((uint64_t)(data[i2])) << 8; //store average wind speed
-
 
1803
                i2--;
-
 
1804
                rawbitsTemp |= ((uint64_t)(data[i2]&0xF0u)) << 0; //store current wind speed
-
 
1805
            } else {
-
 
1806
                return IR_NOT_CORRECT_DATA;
-
 
1807
            }
-
 
1808
            break;
-
 
1809
        case 0x1Du:
-
 
1810
        case 0xF8u:
-
 
1811
            if (data[i2-1] == 0x20 || data[i2-1] == 0x24 || data[i2-1] == 0xB4 ) { //Temperature/humidity
-
 
1812
                i2-=2; //Remove Sensor id
-
 
1813
                rawbitsTemp = 0x200000000000uL; //Temp/humidity id
-
 
1814
                rawbitsTemp |= ((uint64_t)(data[i2]&0xF0u)) << 36; //store channel as MSB
-
 
1815
                i2--;
-
 
1816
                if (data[i2] == 0x4u)
-
 
1817
                    rawbitsTemp |= 0x080000000000uL; //Bat Low flag
-
 
1818
                i2--;
-
 
1819
                rawbitsTemp |= ((uint64_t)(data[i2])) << 16; //store temp
-
 
1820
                i2--;
-
 
1821
                rawbitsTemp |= ((uint64_t)(data[i2])) << 8; //store temp and temp sign
-
 
1822
                i2--;
-
 
1823
                rawbitsTemp |= ((uint64_t)(data[i2])) << 0; //store humidity
-
 
1824
            } else {
1649
                return IR_NOT_CORRECT_DATA;
1825
                return IR_NOT_CORRECT_DATA;
1650
            }
1826
            }
-
 
1827
            break;
-
 
1828
        case 0x29u:
-
 
1829
            if (data[i2-1] == 0x14) { //Rain Gauge (inches)
-
 
1830
                i2-=2; //Remove Sensor id
-
 
1831
                rawbitsTemp = 0x300000000000uL; //Rain inches id
-
 
1832
                rawbitsTemp |= ((uint64_t)(data[i2]&0xF0u)) << 36; //store channel as MSB
-
 
1833
                i2--;
-
 
1834
                if (data[i2] == 0x4u)
-
 
1835
                    rawbitsTemp |= 0x080000000000uL; //Bat Low flag
-
 
1836
                i2--;
-
 
1837
                rawbitsTemp |= ((uint64_t)(data[i2])) << 32; //Rain per hour
-
 
1838
                i2--;
-
 
1839
                rawbitsTemp |= ((uint64_t)(data[i2])) << 24; //Rain per hour
-
 
1840
                i2--;
-
 
1841
                rawbitsTemp |= ((uint64_t)(data[i2])) << 16; //store total rain
-
 
1842
                i2--;
-
 
1843
                rawbitsTemp |= ((uint64_t)(data[i2])) << 8; //store total rain
-
 
1844
                i2--;
-
 
1845
                rawbitsTemp |= ((uint64_t)(data[i2])) << 0; //store total rain
-
 
1846
            } else {
-
 
1847
                return IR_NOT_CORRECT_DATA;
1651
        }
1848
            }
-
 
1849
            break;     
-
 
1850
        case 0x2Du:
-
 
1851
            if (data[i2-1] == 0x10) { //Rain Gauge (mm)
-
 
1852
                i2-=2; //Remove Sensor id
-
 
1853
                rawbitsTemp = 0x400000000000uL; //Rain mm id
-
 
1854
                rawbitsTemp |= ((uint64_t)(data[i2]&0xF0u)) << 36; //store channel as MSB
-
 
1855
                i2--;
-
 
1856
                if (data[i2] == 0x4u)
-
 
1857
                    rawbitsTemp |= 0x080000000000uL; //Bat Low flag
-
 
1858
                i2--;
-
 
1859
                rawbitsTemp |= ((uint64_t)(data[i2])) << 32; //Rain per hour
-
 
1860
                i2--;
-
 
1861
                rawbitsTemp |= ((uint64_t)(data[i2])) << 24; //Rain per hour
-
 
1862
                i2--;
-
 
1863
                rawbitsTemp |= ((uint64_t)(data[i2])) << 16; //store total rain
-
 
1864
                i2--;
-
 
1865
                rawbitsTemp |= ((uint64_t)(data[i2])) << 8; //store total rain
-
 
1866
                i2--;
-
 
1867
                rawbitsTemp |= ((uint64_t)(data[i2])) << 0; //store total rain
-
 
1868
            } else {
-
 
1869
                return IR_NOT_CORRECT_DATA;
-
 
1870
            }
-
 
1871
            break;     
-
 
1872
        default:
-
 
1873
            return IR_NOT_CORRECT_DATA;
-
 
1874
            break;
1652
    }
1875
    }
1653
   
1876
   
1654
    //rawbitsTemp = ~rawbitsTemp;
-
 
1655
    //rawbitsTemp = rawbitsTemp&0xFFFFFFFFFF;
-
 
1656
   
-
 
1657
    proto->protocol=CAN_MODULE_ENUM_PHYSICAL_IR_PROTOCOL_RUBICSON;
1877
    proto->protocol=CAN_MODULE_ENUM_PHYSICAL_IR_PROTOCOL_OREGON;
1658
    proto->timeout=IR_RUBICSON_TIMEOUT;
1878
    proto->timeout=IR_OREGON_TIMEOUT;
1659
    proto->data=rawbitsTemp;
1879
    proto->data=rawbitsTemp;
1660
 
1880
 
1661
    return IR_OK;
1881
    return IR_OK;
1662
#else
1882
#else
1663
    return IR_NOT_CORRECT_DATA;
1883
    return IR_NOT_CORRECT_DATA;
1664
#endif
1884
#endif
1665
}
1885
}
1666
#endif
1886
#endif
1667
 
-