Rev 610 | Rev 727 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 610 | Rev 617 | ||
|---|---|---|---|
| Line 342... | Line 342... | ||
| 342 | * IR_OK if data expanded successfully, one of several errormessages if not |
342 | * IR_OK if data expanded successfully, one of several errormessages if not |
| 343 | */ |
343 | */ |
| 344 | int8_t expandNEC(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto) { |
344 | int8_t expandNEC(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto) { |
| 345 | /* Set up startbit */ |
345 | /* Set up startbit */ |
| 346 | buf[0] = IR_NEC_ST_BIT; |
346 | buf[0] = IR_NEC_ST_BIT; |
| - | 347 | ||
| - | 348 | if (proto->framecnt == 0) { |
|
| 347 | buf[1] = IR_NEC_ST_PAUSE; |
349 | buf[1] = IR_NEC_ST_PAUSE; |
| 348 | 350 | ||
| 349 | *len = 67; |
351 | *len = 67; |
| 350 | for (uint8_t i = 0; i < 65; i++) { |
352 | for (uint8_t i = 0; i < 65; i++) { |
| 351 | if ((i&1) == 1) { /* if odd, ir-pause */ |
353 | if ((i&1) == 1) { /* if odd, ir-pause */ |
| Line 355... | Line 357... | ||
| 355 | buf[i+2] = IR_NEC_LOW_ZERO; |
357 | buf[i+2] = IR_NEC_LOW_ZERO; |
| 356 | } |
358 | } |
| 357 | } else { /* if even, ir-bit */ |
359 | } else { /* if even, ir-bit */ |
| 358 | buf[i+2] = IR_NEC_HIGH; |
360 | buf[i+2] = IR_NEC_HIGH; |
| 359 | } |
361 | } |
| 360 | } |
362 | } |
| 361 | - | ||
| 362 | proto->modfreq=(((F_CPU/2000)/IR_NEC_F_MOD) -1); |
- | |
| 363 | proto->timeout=IR_NEC_TIMEOUT; |
363 | proto->timeout=IR_NEC_TIMEOUT; |
| - | 364 | } else { |
|
| - | 365 | buf[1] = IR_NEC_ST_PAUSE/2; |
|
| - | 366 | buf[2] = IR_NEC_HIGH; |
|
| - | 367 | proto->timeout=IR_NEC_ST_TIMEOUT; |
|
| - | 368 | *len = 3; |
|
| - | 369 | } |
|
| - | 370 | proto->modfreq=(((F_CPU/2000)/IR_NEC_F_MOD) -1); |
|
| 364 | proto->repeats=IR_NEC_REPS; |
371 | proto->repeats=IR_NEC_REPS; |
| 365 | return IR_OK; |
372 | return IR_OK; |
| 366 | } |
373 | } |
| 367 | 374 | ||
| 368 | 375 | ||