Rev 1830 | Rev 1833 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1830 | Rev 1832 | ||
|---|---|---|---|
| Line 98... | Line 98... | ||
| 98 | #endif |
98 | #endif |
| 99 | 99 | ||
| 100 | #define sns_irTransceive_BaseFrq (4145146ULL) |
100 | #define sns_irTransceive_BaseFrq (4145146ULL) |
| 101 | 101 | ||
| 102 | #ifndef sns_irTransceive_PRONTO_SUPPORT |
102 | #ifndef sns_irTransceive_PRONTO_SUPPORT |
| 103 | #define sns_irTransceive_PRONTO_SUPPORT |
103 | #define sns_irTransceive_PRONTO_SUPPORT 0 |
| 104 | #endif |
104 | #endif |
| 105 | 105 | ||
| 106 | #if sns_irTransceive_PRONTO_SUPPORT==1 |
106 | #if sns_irTransceive_PRONTO_SUPPORT==1 |
| 107 | volatile uint32_t sns_irTransceive_LastPronto=0; |
107 | volatile uint32_t sns_irTransceive_LastPronto=0; |
| 108 | static uint8_t activeChannel = 0; |
108 | static uint8_t activeChannel = 0; |
| Line 605... | Line 605... | ||
| 605 | } |
605 | } |
| 606 | else |
606 | else |
| 607 | { |
607 | { |
| 608 | irTxChannel[channel].state = sns_irTransceive_STATE_IDLE; |
608 | irTxChannel[channel].state = sns_irTransceive_STATE_IDLE; |
| 609 | } |
609 | } |
| - | 610 | break; |
|
| - | 611 | ||
| - | 612 | case sns_irTransceive_STATE_TRANSMIT_START_TRANSMIT_PRONTO: |
|
| - | 613 | IrTransceiver_Transmit(channel, irTxChannel[channel].txbuf, 0, irTxChannel[channel].txlen); |
|
| - | 614 | irTxChannel[channel].state = sns_irTransceive_STATE_TRANSMITTING; |
|
| 610 | break; |
615 | break; |
| 611 | 616 | ||
| 612 | case sns_irTransceive_STATE_TRANSMITTING: |
617 | case sns_irTransceive_STATE_TRANSMITTING: |
| 613 | if (irTxChannel[channel].sendComplete == TRUE) |
618 | if (irTxChannel[channel].sendComplete == TRUE) |
| 614 | { |
619 | { |
| Line 672... | Line 677... | ||
| 672 | if ( StdCan_Ret_class(rxMsg->Header) == CAN_MODULE_CLASS_SNS && |
677 | if ( StdCan_Ret_class(rxMsg->Header) == CAN_MODULE_CLASS_SNS && |
| 673 | StdCan_Ret_direction(rxMsg->Header) == DIRECTIONFLAG_TO_OWNER && |
678 | StdCan_Ret_direction(rxMsg->Header) == DIRECTIONFLAG_TO_OWNER && |
| 674 | rxMsg->Header.ModuleType == CAN_MODULE_TYPE_SNS_IRTRANSCEIVE && |
679 | rxMsg->Header.ModuleType == CAN_MODULE_TYPE_SNS_IRTRANSCEIVE && |
| 675 | rxMsg->Header.ModuleId == sns_irTransceive_ID) |
680 | rxMsg->Header.ModuleId == sns_irTransceive_ID) |
| 676 | { |
681 | { |
| 677 | //printf("CMD= |
682 | //printf("CMD= %u\n", rxMsg->Header.Command); |
| 678 | switch (rxMsg->Header.Command) |
683 | switch (rxMsg->Header.Command) |
| 679 | { |
684 | { |
| 680 | #if IR_TX_ENABLE==1 |
685 | #if IR_TX_ENABLE==1 |
| 681 | case CAN_MODULE_CMD_PHYSICAL_IR: { |
686 | case CAN_MODULE_CMD_PHYSICAL_IR: { |
| 682 | uint8_t channel = rxMsg->Data[0]>>4; |
687 | uint8_t channel = rxMsg->Data[0]>>4; |
| Line 728... | Line 733... | ||
| 728 | // unsupported format |
733 | // unsupported format |
| 729 | break; |
734 | break; |
| 730 | } |
735 | } |
| 731 | 736 | ||
| 732 | irTxChannel[channel].state = sns_irTransceive_STATE_TRANSMIT_PREPARING_PRONTO; |
737 | irTxChannel[channel].state = sns_irTransceive_STATE_TRANSMIT_PREPARING_PRONTO; |
| - | 738 | irTxChannel[channel].txlen = 0; |
|
| 733 | 739 | ||
| 734 | //irTxChannel[channel].modfreq = rxMsg->Data[2]; |
740 | //irTxChannel[channel].modfreq = rxMsg->Data[2]; |
| 735 | irTxChannel[channel].modfreq = (((F_CPU/2000)/IR_NEC_F_MOD) -1); // for testing |
741 | irTxChannel[channel].modfreq = (((F_CPU/2000)/IR_NEC_F_MOD) -1); // for testing |
| 736 | irTxChannel[channel].proto.modfreq = (((F_CPU/2000)/IR_NEC_F_MOD) -1); |
742 | irTxChannel[channel].proto.modfreq = (((F_CPU/2000)/IR_NEC_F_MOD) -1); |
| 737 | irTxChannel[channel].proto.timeout = 40; |
743 | irTxChannel[channel].proto.timeout = 40; |
| Line 826... | Line 832... | ||
| 826 | } |
832 | } |
| 827 | // last byte tells what to do with IR data (nr of repeats) |
833 | // last byte tells what to do with IR data (nr of repeats) |
| 828 | irTxChannel[activeChannel].numberOfRepeats = rxMsg->Data[rxMsg->Length-1]; |
834 | irTxChannel[activeChannel].numberOfRepeats = rxMsg->Data[rxMsg->Length-1]; |
| 829 | 835 | ||
| 830 | // send |
836 | // send |
| 831 | IrTransceiver_Transmit |
837 | //IrTransceiver_Transmit(activeChannel, irTxChannel[activeChannel].txbuf, 0, irTxChannel[activeChannel].txlen); |
| 832 | irTxChannel[activeChannel].state = |
838 | irTxChannel[activeChannel].state = sns_irTransceive_STATE_TRANSMIT_START_TRANSMIT_PRONTO; |
| 833 | 839 | ||
| 834 |
|
840 | //printf("SEND:%03u\n", irTxChannel[activeChannel].txlen); |
| 835 | 841 | ||
| 836 | /* TODO: Send response frame */ |
842 | /* TODO: Send response frame */ |
| 837 | 843 | ||
| 838 | break; |
844 | break; |
| 839 | } |
845 | } |