Subversion Repositories HomeAutomation

Rev

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

Rev 1730 Rev 1737
Line 2... Line 2...
2
#include "sns_irTransceive.h"
2
#include "sns_irTransceive.h"
3
 
3
 
4
#if IR_RX_ENABLE==1
4
#if IR_RX_ENABLE==1
5
struct {
5
struct {
6
    uint8_t             state;
6
    uint8_t             state;
7
    uint8_t             newData;
-
 
8
    uint16_t            *rxbuf;
7
    uint16_t            *rxbuf;
9
    uint8_t             rxlen;
8
    uint8_t             rxlen;
10
    uint8_t             timerNum;
9
    uint8_t             timerNum;
11
    Ir_Protocol_Data_t  proto;
10
    Ir_Protocol_Data_t  proto;
-
 
11
    uint8_t             newData;
12
} irRxChannel[IR_SUPPORTED_NUM_CHANNELS];
12
} irRxChannel[IR_SUPPORTED_NUM_CHANNELS];
13
#endif
13
#endif
14
 
14
 
15
#if IR_TX_ENABLE==1
15
#if IR_TX_ENABLE==1
16
struct {
16
struct {
17
    uint8_t             state;
17
    uint8_t             state;
18
    uint8_t             sendComplete;
-
 
19
    uint16_t            *txbuf;
18
    uint16_t            *txbuf;
20
    uint8_t             txlen;
19
    uint8_t             txlen;
21
    uint8_t             timerNum;
20
    uint8_t             timerNum;
22
    uint8_t             repeatCount;
21
    uint8_t             repeatCount;
-
 
22
    Ir_Protocol_Data_t  proto;
23
    uint8_t             stopSend;
23
    uint8_t             stopSend;
24
    Ir_Protocol_Data_t  proto;
24
    uint8_t             sendComplete;
25
} irTxChannel[IR_SUPPORTED_NUM_CHANNELS];
25
} irTxChannel[IR_SUPPORTED_NUM_CHANNELS];
26
#endif
26
#endif
27
 
27
 
28
uint16_t    buf[3][MAX_NR_TIMES];
28
uint16_t    buf[3][MAX_NR_TIMES];
29
 
29
 
Line 31... Line 31...
31
 
31
 
32
#if (sns_irTransceive_SEND_DEBUG==1)
32
#if (sns_irTransceive_SEND_DEBUG==1)
33
void send_debug(uint16_t *buffer, uint8_t len) {
33
void send_debug(uint16_t *buffer, uint8_t len) {
34
    StdCan_Msg_t dbgIrTxMsg;
34
    StdCan_Msg_t dbgIrTxMsg;
35
    /* the protocol is unknown so the raw ir-data is sent, makes it easier to develop a new protocol */
35
    /* the protocol is unknown so the raw ir-data is sent, makes it easier to develop a new protocol */
36
 
36
 
37
    StdCan_Set_class(dbgIrTxMsg.Header, CAN_MODULE_CLASS_SNS);
37
    StdCan_Set_class(dbgIrTxMsg.Header, CAN_MODULE_CLASS_SNS);
38
    StdCan_Set_direction(dbgIrTxMsg.Header, DIRECTIONFLAG_FROM_OWNER);
38
    StdCan_Set_direction(dbgIrTxMsg.Header, DIRECTIONFLAG_FROM_OWNER);
39
    dbgIrTxMsg.Length = 8;
39
    dbgIrTxMsg.Length = 8;
40
    dbgIrTxMsg.Header.ModuleType = CAN_MODULE_TYPE_SNS_IRTRANSCEIVE;
40
    dbgIrTxMsg.Header.ModuleType = CAN_MODULE_TYPE_SNS_IRTRANSCEIVE;
41
    dbgIrTxMsg.Header.ModuleId = sns_irTransceive_ID;
41
    dbgIrTxMsg.Header.ModuleId = sns_irTransceive_ID;
Line 49... Line 49...
49
        dbgIrTxMsg.Data[3] = (buffer[index+1]>>0)&0xff;
49
        dbgIrTxMsg.Data[3] = (buffer[index+1]>>0)&0xff;
50
        dbgIrTxMsg.Data[4] = (buffer[index+2]>>8)&0xff;
50
        dbgIrTxMsg.Data[4] = (buffer[index+2]>>8)&0xff;
51
        dbgIrTxMsg.Data[5] = (buffer[index+2]>>0)&0xff;
51
        dbgIrTxMsg.Data[5] = (buffer[index+2]>>0)&0xff;
52
        dbgIrTxMsg.Data[6] = (buffer[index+3]>>8)&0xff;
52
        dbgIrTxMsg.Data[6] = (buffer[index+3]>>8)&0xff;
53
        dbgIrTxMsg.Data[7] = (buffer[index+3]>>0)&0xff;
53
        dbgIrTxMsg.Data[7] = (buffer[index+3]>>0)&0xff;
54
               
54
               
55
        /* buffers will be filled when sending more than 2-3 messages, so retry until sent */
55
        /* buffers will be filled when sending more than 2-3 messages, so retry until sent */
56
        while (StdCan_Put(&dbgIrTxMsg) != StdCan_Ret_OK) {}
56
        while (StdCan_Put(&dbgIrTxMsg) != StdCan_Ret_OK) {}
57
        _delay_ms(1);
57
        _delay_ms(1);
58
    }
58
    }
59
   
59
   
60
    uint8_t lastpacketcnt = len&0x03;
60
    uint8_t lastpacketcnt = len&0x03;
61
    if (lastpacketcnt > 0) {
61
    if (lastpacketcnt > 0) {
62
        dbgIrTxMsg.Length = lastpacketcnt<<1;
62
        dbgIrTxMsg.Length = lastpacketcnt<<1;
63
        for (uint8_t i = 0; i < lastpacketcnt; i++) {
63
        for (uint8_t i = 0; i < lastpacketcnt; i++) {
64
            dbgIrTxMsg.Data[i<<1] = (buffer[(len&0xfc)|i]>>8)&0xff;
64
            dbgIrTxMsg.Data[i<<1] = (buffer[(len&0xfc)|i]>>8)&0xff;
65
            dbgIrTxMsg.Data[(i<<1)+1] = (buffer[(len&0xfc)|i]>>0)&0xff;
65
            dbgIrTxMsg.Data[(i<<1)+1] = (buffer[(len&0xfc)|i]>>0)&0xff;
66
        }
66
        }
67
        /* buffers will be filled when sending more than 2-3 messages, so retry until sent */
67
        /* buffers will be filled when sending more than 2-3 messages, so retry until sent */
68
        while (StdCan_Put(&dbgIrTxMsg) != StdCan_Ret_OK) {}
68
        while (StdCan_Put(&dbgIrTxMsg) != StdCan_Ret_OK) {}
69
        _delay_ms(1);
69
        _delay_ms(1);
70
    }
70
    }
71
 
71
 
72
}
72
}
73
#endif
73
#endif
74
 
74
 
75
#if IR_RX_ENABLE==1
75
#if IR_RX_ENABLE==1
76
void sns_irTransceive_RX_done_callback(uint8_t channel, uint16_t *buffer, uint8_t len)
76
void sns_irTransceive_RX_done_callback(uint8_t channel, uint16_t *buffer, uint8_t len)
77
{
77
{
78
    if (channel < IR_SUPPORTED_NUM_CHANNELS)
78
    if (channel < IR_SUPPORTED_NUM_CHANNELS)
79
    {
79
    {
80
        irRxChannel[channel].newData = TRUE;
80
        irRxChannel[channel].newData = TRUE;
81
        irRxChannel[channel].rxlen = len;
81
        irRxChannel[channel].rxlen = len;
82
    }
82
    }
83
}
83
}
84
#endif
84
#endif
85
 
85
 
-
 
86
#if IR_TX_ENABLE==1
86
void sns_irTransceive_TX_done_callback(uint8_t channel)
87
void sns_irTransceive_TX_done_callback(uint8_t channel)
87
{
88
{
88
    if (channel < IR_SUPPORTED_NUM_CHANNELS)
89
    if (channel < IR_SUPPORTED_NUM_CHANNELS)
89
    {
90
    {
90
        irTxChannel[channel].sendComplete = TRUE;
91
        irTxChannel[channel].sendComplete = TRUE;
91
    }
92
    }
92
}
93
}
-
 
94
#endif
93
 
95
 
94
void sns_irTransceive_Init(void)
96
void sns_irTransceive_Init(void)
95
{
97
{
96
/* Debug IO, PB7 */
98
/* Debug IO, PB7 */
97
gpio_set_out(EXP_A);
99
gpio_set_out(EXP_A);
Line 105... Line 107...
105
    irTxMsg.Length = 6;
107
    irTxMsg.Length = 6;
106
 
108
 
107
    for (uint8_t i = 0; i < IR_SUPPORTED_NUM_CHANNELS; i++)
109
    for (uint8_t i = 0; i < IR_SUPPORTED_NUM_CHANNELS; i++)
108
    {
110
    {
109
#if IR_RX_ENABLE==1
111
#if IR_RX_ENABLE==1
110
        irRxChannel[i].state = sns_irTransceive_STATE_RECEIVING;
112
        irRxChannel[i].state = sns_irTransceive_STATE_DISABLED;
111
        irRxChannel[i].newData = FALSE;
113
        irRxChannel[i].newData = FALSE;
112
        irRxChannel[i].rxlen = 0;
114
        irRxChannel[i].rxlen = 0;
113
        irRxChannel[i].proto.timeout=0;
115
        irRxChannel[i].proto.timeout=0;
114
        irRxChannel[i].proto.data=0;
116
        irRxChannel[i].proto.data=0;
115
        irRxChannel[i].proto.repeats=0;
117
        irRxChannel[i].proto.repeats=0;
116
        irRxChannel[i].proto.protocol=0;
118
        irRxChannel[i].proto.protocol=0;
117
#endif
119
#endif
118
 
120
 
119
#if IR_TX_ENABLE==1
121
#if IR_TX_ENABLE==1
120
        irTxChannel[i].state = sns_irTransceive_STATE_IDLE;
122
        irTxChannel[i].state = sns_irTransceive_STATE_DISABLED;
121
        irTxChannel[i].sendComplete = FALSE;
123
        irTxChannel[i].sendComplete = FALSE;
122
        irTxChannel[i].repeatCount = 0;
124
        irTxChannel[i].repeatCount = 0;
123
        irTxChannel[i].txlen = 0;
125
        irTxChannel[i].txlen = 0;
124
        irTxChannel[i].proto.data=0;
126
        irTxChannel[i].proto.data=0;
125
        irTxChannel[i].proto.repeats=0;
127
        irTxChannel[i].proto.repeats=0;
Line 212... Line 214...
212
                    irRxChannel[channel].proto.timeout=300;
214
                    irRxChannel[channel].proto.timeout=300;
213
#endif
215
#endif
214
                }
216
                }
215
               
217
               
216
                /* Enable the receiver again */
218
                /* Enable the receiver again */
217
                IrTransceiver_EnableRx(channel);
219
                IrTransceiver_EnableRx(channel);
218
               
220
               
219
                irRxChannel[channel].state = sns_irTransceive_STATE_START_PAUSE;
221
                irRxChannel[channel].state = sns_irTransceive_STATE_START_PAUSE;
220
            }
222
            }
221
            break;
223
            break;
222
 
224
 
223
        case sns_irTransceive_STATE_START_PAUSE:
225
        case sns_irTransceive_STATE_START_PAUSE:
224
            /* set a timer so we can send release button event when no new IR is arriving */
226
            /* set a timer so we can send release button event when no new IR is arriving */
225
            Timer_SetTimeout(irRxChannel[channel].timerNum, irRxChannel[channel].proto.timeout, TimerTypeOneShot, 0);
227
            Timer_SetTimeout(irRxChannel[channel].timerNum, irRxChannel[channel].proto.timeout, TimerTypeOneShot, 0);
226
            irRxChannel[channel].state = sns_irTransceive_STATE_PAUSING;
228
            irRxChannel[channel].state = sns_irTransceive_STATE_PAUSING;
227
            break;
229
            break;
228
 
230
 
229
        case sns_irTransceive_STATE_PAUSING:
231
        case sns_irTransceive_STATE_PAUSING:
230
            /* reset timer if new IR arrived */
232
            /* reset timer if new IR arrived */
231
            if (irRxChannel[channel].newData == TRUE || IrTransceiver_GetStoreEnableRx(channel) == TRUE) {
233
            if (irRxChannel[channel].newData == TRUE || IrTransceiver_GetStoreEnableRx(channel) == TRUE) {
232
                cli();
234
                cli();
233
                irRxChannel[channel].newData = FALSE;
235
                irRxChannel[channel].newData = FALSE;
234
                sei();
236
                sei();
235
                Timer_SetTimeout(irRxChannel[channel].timerNum, irRxChannel[channel].proto.timeout, TimerTypeOneShot, 0);
237
                Timer_SetTimeout(irRxChannel[channel].timerNum, irRxChannel[channel].proto.timeout, TimerTypeOneShot, 0);
236
            }
238
            }
237
       
239
       
238
            if (Timer_Expired(irRxChannel[channel].timerNum)) {
240
            if (Timer_Expired(irRxChannel[channel].timerNum)) {
239
                irRxChannel[channel].state = sns_irTransceive_STATE_START_IDLE;
241
                irRxChannel[channel].state = sns_irTransceive_STATE_START_IDLE;
240
            }
242
            }
241
            break;
243
            break;
242
 
244
 
243
        case sns_irTransceive_STATE_START_IDLE:
245
        case sns_irTransceive_STATE_START_IDLE:
244
            if (irRxChannel[channel].proto.protocol != IR_PROTO_UNKNOWN) {
246
            if (irRxChannel[channel].proto.protocol != IR_PROTO_UNKNOWN) {
245
                /* Send button release command on CAN */
247
                /* Send button release command on CAN */
246
                irTxMsg.Data[0] = 0xf&CAN_MODULE_ENUM_PHYSICAL_IR_STATUS_RELEASED;
248
                irTxMsg.Data[0] = 0xf&CAN_MODULE_ENUM_PHYSICAL_IR_STATUS_RELEASED;
247
                irTxMsg.Data[0] |= channel<<4;
249
                irTxMsg.Data[0] |= channel<<4;
Line 252... Line 254...
252
                irTxMsg.Data[5] = irRxChannel[channel].proto.data&0xff;
254
                irTxMsg.Data[5] = irRxChannel[channel].proto.data&0xff;
253
 
255
 
254
                StdCan_Put(&irTxMsg);
256
                StdCan_Put(&irTxMsg);
255
            }
257
            }
256
            irRxChannel[channel].state = sns_irTransceive_STATE_IDLE;
258
            irRxChannel[channel].state = sns_irTransceive_STATE_IDLE;
-
 
259
            break;
-
 
260
 
-
 
261
        default:
257
            break;
262
            break;
258
        }
263
        }
259
#endif
264
#endif
260
 
265
 
261
#if IR_TX_ENABLE==1
266
#if IR_TX_ENABLE==1
Line 321... Line 326...
321
            irTxChannel[channel].stopSend = FALSE;
326
            irTxChannel[channel].stopSend = FALSE;
322
            irTxChannel[channel].repeatCount = 0;
327
            irTxChannel[channel].repeatCount = 0;
323
            irTxChannel[channel].proto.framecnt = 0;
328
            irTxChannel[channel].proto.framecnt = 0;
324
           
329
           
325
            irTxChannel[channel].state = sns_irTransceive_STATE_IDLE;
330
            irTxChannel[channel].state = sns_irTransceive_STATE_IDLE;
-
 
331
            break;
-
 
332
 
-
 
333
        default:
326
            break;
334
            break;
327
        }
335
        }
328
#endif
336
#endif
329
 
337
 
330
    }
338
    }
Line 340... Line 348...
340
    {
348
    {
341
        uint8_t channel;
349
        uint8_t channel;
342
        switch (rxMsg->Header.Command)
350
        switch (rxMsg->Header.Command)
343
        {
351
        {
344
        case CAN_MODULE_CMD_PHYSICAL_IR:
352
        case CAN_MODULE_CMD_PHYSICAL_IR:
345
            channel = rxMsg->Data[0]>>4;
353
            channel = rxMsg->Data[0]>>4;
346
            if ((0xf&rxMsg->Data[0]) == CAN_MODULE_ENUM_PHYSICAL_IR_STATUS_PRESSED && channel < IR_SUPPORTED_NUM_CHANNELS)
354
            if ((0xf&rxMsg->Data[0]) == CAN_MODULE_ENUM_PHYSICAL_IR_STATUS_PRESSED && channel < IR_SUPPORTED_NUM_CHANNELS)
347
            {
355
            {
348
                if (irTxChannel[channel].state == sns_irTransceive_STATE_IDLE)
356
                if (irTxChannel[channel].state == sns_irTransceive_STATE_IDLE)
349
                {
357
                {
350
                    irTxChannel[channel].proto.protocol = rxMsg->Data[1];
358
                    irTxChannel[channel].proto.protocol = rxMsg->Data[1];
351
 
359
 
352
                    irTxChannel[channel].proto.data = rxMsg->Data[2];
360
                    irTxChannel[channel].proto.data = rxMsg->Data[2];
353
                    irTxChannel[channel].proto.data = irTxChannel[channel].proto.data<<8;
361
                    irTxChannel[channel].proto.data = irTxChannel[channel].proto.data<<8;
354
                    irTxChannel[channel].proto.data |= rxMsg->Data[3];
362
                    irTxChannel[channel].proto.data |= rxMsg->Data[3];
355
                    irTxChannel[channel].proto.data = irTxChannel[channel].proto.data<<8;
363
                    irTxChannel[channel].proto.data = irTxChannel[channel].proto.data<<8;
356
                    irTxChannel[channel].proto.data |= rxMsg->Data[4];
364
                    irTxChannel[channel].proto.data |= rxMsg->Data[4];
Line 359... Line 367...
359
 
367
 
360
                    irTxChannel[channel].state = sns_irTransceive_STATE_START_TRANSMIT;
368
                    irTxChannel[channel].state = sns_irTransceive_STATE_START_TRANSMIT;
361
                }
369
                }
362
            }
370
            }
363
            else if ((0xf&rxMsg->Data[0]) == CAN_MODULE_ENUM_PHYSICAL_IR_STATUS_RELEASED && channel < IR_SUPPORTED_NUM_CHANNELS)
371
            else if ((0xf&rxMsg->Data[0]) == CAN_MODULE_ENUM_PHYSICAL_IR_STATUS_RELEASED && channel < IR_SUPPORTED_NUM_CHANNELS)
364
            {
372
            {
365
                if (irTxChannel[channel].state != sns_irTransceive_STATE_IDLE)
373
                if (irTxChannel[channel].state != sns_irTransceive_STATE_IDLE)
366
                {
374
                {
367
                    irTxChannel[channel].stopSend = TRUE;
375
                    irTxChannel[channel].stopSend = TRUE;
368
                }
376
                }
369
            }
377
            }
Line 371... Line 379...
371
       
379
       
372
        case CAN_MODULE_CMD_IRTRANSCEIVE_IRCONFIG:
380
        case CAN_MODULE_CMD_IRTRANSCEIVE_IRCONFIG:
373
            channel = rxMsg->Data[0]>>4;
381
            channel = rxMsg->Data[0]>>4;
374
            uint8_t config = rxMsg->Data[0] & 0x0f;
382
            uint8_t config = rxMsg->Data[0] & 0x0f;
375
            uint8_t power = rxMsg->Data[1]>>6;
383
            uint8_t power = rxMsg->Data[1]>>6;
376
 
384
 
377
            if (channel < IR_SUPPORTED_NUM_CHANNELS && config <= CAN_MODULE_ENUM_IRTRANSCEIVE_IRCONFIG_DIRECTION_RECEIVE && power < 4)
385
            if (channel < IR_SUPPORTED_NUM_CHANNELS && config <= CAN_MODULE_ENUM_IRTRANSCEIVE_IRCONFIG_DIRECTION_RECEIVE && power < 4)
378
            {
386
            {
379
#if IR_RX_ENABLE==1
387
#if IR_RX_ENABLE==1
380
                if (config == CAN_MODULE_ENUM_IRTRANSCEIVE_IRCONFIG_DIRECTION_RECEIVE)
388
                if (config == CAN_MODULE_ENUM_IRTRANSCEIVE_IRCONFIG_DIRECTION_RECEIVE)
381
                {
389
                {
-
 
390
#if IR_TX_ENABLE==1
-
 
391
                    irTxChannel[channel].state = sns_irTransceive_STATE_DISABLED;
-
 
392
#endif
382
                    irRxChannel[channel].rxbuf = buf[channel];
393
                    irRxChannel[channel].rxbuf = buf[channel];
383
                    switch (channel)
394
                    switch (channel)
384
                    {
395
                    {
385
                        case 0:
396
                        case 0:
386
                            gpio_clr_pin(sns_irTransceive_VCC_EN0_PIN);
397
                            gpio_clr_pin(sns_irTransceive_VCC_EN0_PIN);
387
                            IrTransceiver_InitRxChannel(channel, irRxChannel[channel].rxbuf, sns_irTransceive_RX_done_callback, sns_irTransceive_RX0_PCINT, sns_irTransceive_RX0_PIN);
398
                            IrTransceiver_InitRxChannel(channel, irRxChannel[channel].rxbuf, sns_irTransceive_RX_done_callback, sns_irTransceive_RX0_PCINT, sns_irTransceive_RX0_PIN);
388
                            break;
399
                            break;
389
                        case 1:
400
                        case 1:
390
                            gpio_clr_pin(sns_irTransceive_VCC_EN1_PIN);
401
                            gpio_clr_pin(sns_irTransceive_VCC_EN1_PIN);
391
                            IrTransceiver_InitRxChannel(channel, irRxChannel[channel].rxbuf, sns_irTransceive_RX_done_callback, sns_irTransceive_RX1_PCINT, sns_irTransceive_RX1_PIN);
402
                            IrTransceiver_InitRxChannel(channel, irRxChannel[channel].rxbuf, sns_irTransceive_RX_done_callback, sns_irTransceive_RX1_PCINT, sns_irTransceive_RX1_PIN);
392
                            break;
403
                            break;
393
                        case 2:
404
                        case 2:
394
                            gpio_clr_pin(sns_irTransceive_VCC_EN2_PIN);
405
                            gpio_clr_pin(sns_irTransceive_VCC_EN2_PIN);
395
                            IrTransceiver_InitRxChannel(channel, irRxChannel[channel].rxbuf, sns_irTransceive_RX_done_callback, sns_irTransceive_RX2_PCINT, sns_irTransceive_RX2_PIN);
406
                            IrTransceiver_InitRxChannel(channel, irRxChannel[channel].rxbuf, sns_irTransceive_RX_done_callback, sns_irTransceive_RX2_PCINT, sns_irTransceive_RX2_PIN);
396
                            break;
407
                            break;
397
                    }
408
                    }
-
 
409
                    irRxChannel[channel].state = sns_irTransceive_STATE_RECEIVING;
398
                }
410
                }
399
#endif
411
#endif
400
 
412
 
401
#if IR_TX_ENABLE==1
413
#if IR_TX_ENABLE==1
402
                if (config == CAN_MODULE_ENUM_IRTRANSCEIVE_IRCONFIG_DIRECTION_TRANSMIT)
414
                if (config == CAN_MODULE_ENUM_IRTRANSCEIVE_IRCONFIG_DIRECTION_TRANSMIT)
403
                {
415
                {
-
 
416
#if IR_RX_ENABLE==1
-
 
417
                    irRxChannel[channel].state = sns_irTransceive_STATE_DISABLED;
-
 
418
#endif
404
                    irTxChannel[channel].txbuf = buf[channel];
419
                    irTxChannel[channel].txbuf = buf[channel];
405
                    switch (channel)
420
                    switch (channel)
406
                    {
421
                    {
407
                        case 0:
422
                        case 0:
408
#if IR_RX_ENABLE==1
423
#if IR_RX_ENABLE==1
Line 410... Line 425...
410
                            IrTransceiver_DeInitRxChannel(channel, sns_irTransceive_RX0_PCINT, sns_irTransceive_RX0_PIN);
425
                            IrTransceiver_DeInitRxChannel(channel, sns_irTransceive_RX0_PCINT, sns_irTransceive_RX0_PIN);
411
#endif
426
#endif
412
                            IrTransceiver_InitTxChannel(channel, sns_irTransceive_TX_done_callback, sns_irTransceive_TX0_PIN);
427
                            IrTransceiver_InitTxChannel(channel, sns_irTransceive_TX_done_callback, sns_irTransceive_TX0_PIN);
413
                            break;
428
                            break;
414
                        case 1:
429
                        case 1:
415
#if IR_RX_ENABLE==1
430
#if IR_RX_ENABLE==1
416
                            gpio_set_pin(sns_irTransceive_VCC_EN1_PIN);
431
                            gpio_set_pin(sns_irTransceive_VCC_EN1_PIN);
417
                            IrTransceiver_DeInitRxChannel(channel, sns_irTransceive_RX1_PCINT, sns_irTransceive_RX1_PIN);
432
                            IrTransceiver_DeInitRxChannel(channel, sns_irTransceive_RX1_PCINT, sns_irTransceive_RX1_PIN);
418
#endif
433
#endif
419
                            IrTransceiver_InitTxChannel(channel, sns_irTransceive_TX_done_callback, sns_irTransceive_TX1_PIN);
434
                            IrTransceiver_InitTxChannel(channel, sns_irTransceive_TX_done_callback, sns_irTransceive_TX1_PIN);
420
                            break;
435
                            break;
Line 424... Line 439...
424
                            IrTransceiver_DeInitRxChannel(channel, sns_irTransceive_RX2_PCINT, sns_irTransceive_RX2_PIN);
439
                            IrTransceiver_DeInitRxChannel(channel, sns_irTransceive_RX2_PCINT, sns_irTransceive_RX2_PIN);
425
#endif
440
#endif
426
                            IrTransceiver_InitTxChannel(channel, sns_irTransceive_TX_done_callback, sns_irTransceive_TX2_PIN);
441
                            IrTransceiver_InitTxChannel(channel, sns_irTransceive_TX_done_callback, sns_irTransceive_TX2_PIN);
427
                            break;
442
                            break;
428
                    }
443
                    }
-
 
444
                    irTxChannel[channel].state = sns_irTransceive_STATE_START_IDLE;
429
                }
445
                }
430
#endif
446
#endif
431
            }
447
            }
432
            break;
448
            break;
433
        }
449
        }