Subversion Repositories HomeAutomation

Rev

Rev 919 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 919 Rev 922
Line 246... Line 246...
246
            state_receive = STATE_RECEIVING;
246
            state_receive = STATE_RECEIVING;
247
        } else if (state_receive == STATE_RECEIVING) {
247
        } else if (state_receive == STATE_RECEIVING) {
248
            uint8_t res = IrTransceiver_Receive_Poll(&len_receive);
248
            uint8_t res = IrTransceiver_Receive_Poll(&len_receive);
249
            if ((res == IR_OK) && (len_receive > 0)) {
249
            if ((res == IR_OK) && (len_receive > 0)) {
250
                //låt protocols parsa och skicka på can
250
                //låt protocols parsa och skicka på can
-
 
251
#if !(SEND_DEBUG)
251
                uint8_t res2 = parseProtocol(rxbuffer, len_receive, &proto_receive);
252
                uint8_t res2 = parseProtocol(rxbuffer, len_receive, &proto_receive);
252
                if (res2 == IR_OK && proto_receive.protocol != IR_PROTO_UNKNOWN) {
253
                if (res2 == IR_OK && proto_receive.protocol != IR_PROTO_UNKNOWN) {
253
                    txMsg_receive.Data.bytes[0] = IR_BUTTON_DOWN;
254
                    txMsg_receive.Data.bytes[0] = IR_BUTTON_DOWN;
254
                    txMsg_receive.Data.bytes[1] = proto_receive.protocol;
255
                    txMsg_receive.Data.bytes[1] = proto_receive.protocol;
255
                    txMsg_receive.Data.bytes[2] = (proto_receive.data>>24)&0xff;
256
                    txMsg_receive.Data.bytes[2] = (proto_receive.data>>24)&0xff;
Line 258... Line 259...
258
                    txMsg_receive.Data.bytes[5] = proto_receive.data&0xff;
259
                    txMsg_receive.Data.bytes[5] = proto_receive.data&0xff;
259
                    txMsg_receive.Id = ((CAN_SNS << CAN_SHIFT_CLASS) | (SNS_TYPE_IR << CAN_SHIFT_SNS_TYPE) | (IR_ID_DATA<<CAN_SHIFT_SNS_ID) | (NODE_ID << CAN_SHIFT_SNS_SID));
260
                    txMsg_receive.Id = ((CAN_SNS << CAN_SHIFT_CLASS) | (SNS_TYPE_IR << CAN_SHIFT_SNS_TYPE) | (IR_ID_DATA<<CAN_SHIFT_SNS_ID) | (NODE_ID << CAN_SHIFT_SNS_SID));
260
                    txMsg_receive.DataLength = 6;
261
                    txMsg_receive.DataLength = 6;
261
                    BIOS_CanSend(&txMsg_receive);
262
                    BIOS_CanSend(&txMsg_receive);
262
                } else if (proto_receive.protocol == IR_PROTO_UNKNOWN) {
263
                } else if (proto_receive.protocol == IR_PROTO_UNKNOWN) {
-
 
264
                }
-
 
265
#endif
263
#if (SEND_DEBUG)
266
#if (SEND_DEBUG)
264
                    send_debug(rxbuffer, len_receiver);
267
                send_debug(rxbuffer, len_receive);
265
                    proto_receiver.timeout=300;
268
                proto_receive.timeout=300;
266
#endif
269
#endif
267
                }
270
               
268
                state_receive = STATE_START_PAUSE_RECEIVE;
271
                state_receive = STATE_START_PAUSE_RECEIVE;
269
            }
272
            }
270
        } else if (state_receive == STATE_START_PAUSE_RECEIVE) {
273
        } else if (state_receive == STATE_START_PAUSE_RECEIVE) {
271
            IrTransceiver_Receive_Start(rxbuffer);
274
            IrTransceiver_Receive_Start(rxbuffer);
272
            timePauseStarted_receive = Timebase_CurrentTime();
275
            timePauseStarted_receive = Timebase_CurrentTime();
273
            state_receive = STATE_PAUSING_RECEIVE;
276
            state_receive = STATE_PAUSING_RECEIVE;
274
        } else if (state_receive == STATE_PAUSING_RECEIVE) {
277
        } else if (state_receive == STATE_PAUSING_RECEIVE) {
Line 292... Line 295...
292
                txMsg_receive.Data.bytes[0] = IR_BUTTON_UP;
295
                txMsg_receive.Data.bytes[0] = IR_BUTTON_UP;
293
                BIOS_CanSend(&txMsg_receive);
296
                BIOS_CanSend(&txMsg_receive);
294
            }
297
            }
295
            state_receive = STATE_IDLE_RECEIVE;
298
            state_receive = STATE_IDLE_RECEIVE;
296
        }
299
        }
297
       
-
 
298
    //  if (rxMsgFull) {
-
 
299
            /* No message reception functionality implemented */
-
 
300
            /* Flush the received message */
-
 
301
    //      rxMsgFull = 0; //  
-
 
302
    //  }
-
 
303
    }
300
    }
304
   
301
   
305
    return 0;
302
    return 0;
306
}
303
}
307
 
304