17 * WITHOUT ANY WARRANTY; without even the implied warranty of |
17 * WITHOUT ANY WARRANTY; without even the implied warranty of |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
19 * General Public License for more details. |
19 * General Public License for more details. |
20 * |
20 * |
21 * You should have received a copy of the GNU General Public License |
21 * You should have received a copy of the GNU General Public License |
22 * along with EC-65K; see the file COPYING. If not, write to the Free |
22 * along with ThermFerm; see the file COPYING. If not, write to the Free |
23 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
23 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
24 *****************************************************************************/ |
24 *****************************************************************************/ |
25 |
25 |
26 #include "thermferm.h" |
26 #include "thermferm.h" |
27 #include "xutil.h" |
27 #include "xutil.h" |
581 } |
581 } |
582 } |
582 } |
583 |
583 |
584 |
584 |
585 |
585 |
586 /* |
|
587 void RCSwitch::send(unsigned long Code, unsigned int length) { |
|
588 this->send( this->dec2binWzerofill(Code, length) ); |
|
589 } |
|
590 |
|
591 void RCSwitch::send(char* sCodeWord) { |
|
592 for (int nRepeat=0; nRepeat<nRepeatTransmit; nRepeat++) { |
|
593 int i = 0; |
|
594 while (sCodeWord[i] != '\0') { |
|
595 switch(sCodeWord[i]) { |
|
596 case '0': |
|
597 this->send0(); |
|
598 break; |
|
599 case '1': |
|
600 this->send1(); |
|
601 break; |
|
602 } |
|
603 i++; |
|
604 } |
|
605 this->sendSync(); |
|
606 } |
|
607 } |
|
608 */ |
|
609 |
|
610 |
|
611 void transmit(int nFirstPulses, int nSecondPulses, int bHighFirst) |
586 void transmit(int nFirstPulses, int nSecondPulses, int bHighFirst) |
612 { |
587 { |
613 int disabled_Receive = FALSE; |
588 int disabled_Receive = FALSE; |
614 int nReceiverInterrupt_backup = rcReceiverInterruptPin; |
589 int nReceiverInterrupt_backup = rcReceiverInterruptPin; |
615 |
590 |
630 } |
605 } |
631 |
606 |
632 |
607 |
633 |
608 |
634 /* |
609 /* |
635 * Sends a "0" Bit |
|
636 * _ |
|
637 * Waveform Protocol 1: | |___ |
|
638 * _ |
|
639 * Waveform Protocol 2: | |__ |
|
640 * ____ |
|
641 * Waveform Protocol 3: | |___________ |
|
642 */ |
|
643 //void send0(void) { |
|
644 // if (rcProtocol == 1){ |
|
645 // transmit(1,3); |
|
646 // } |
|
647 // else if (rcProtocol == 2) { |
|
648 // transmit(1,2); |
|
649 // } |
|
650 // else if (rcProtocol == 3) { |
|
651 // transmit(4,11); |
|
652 // } |
|
653 //} |
|
654 |
|
655 |
|
656 |
|
657 /* |
|
658 * Sends a "1" Bit |
|
659 * ___ |
|
660 * Waveform Protocol 1: | |_ |
|
661 * __ |
|
662 * Waveform Protocol 2: | |_ |
|
663 * _________ |
|
664 * Waveform Protocol 3: | |______ |
|
665 */ |
|
666 //void send1(void) { |
|
667 // if (rcProtocol == 1){ |
|
668 // transmit(3,1); |
|
669 // } |
|
670 // else if (rcProtocol == 2) { |
|
671 // transmit(2,1); |
|
672 // } |
|
673 // else if (rcProtocol == 3) { |
|
674 // transmit(9,6); |
|
675 // } |
|
676 //} |
|
677 |
|
678 |
|
679 |
|
680 /* |
|
681 * Sends a Tri-State "0" Bit |
610 * Sends a Tri-State "0" Bit |
682 * _ _ |
611 * _ _ |
683 * Waveform: | |___| |___ |
612 * Waveform: | |___| |___ |
684 */ |
613 */ |
685 void sendT0(void) { |
614 void sendT0(void) { |
686 transmit(ZERO_FIRST_CYCLES[rcProtocol], ZERO_SECOND_CYCLES[rcProtocol], HIGH_FIRST[rcProtocol]); |
615 transmit(ZERO_FIRST_CYCLES[rcProtocol], ZERO_SECOND_CYCLES[rcProtocol], HIGH_FIRST[rcProtocol]); |
687 transmit(ZERO_FIRST_CYCLES[rcProtocol], ZERO_SECOND_CYCLES[rcProtocol], HIGH_FIRST[rcProtocol]); |
616 transmit(ZERO_FIRST_CYCLES[rcProtocol], ZERO_SECOND_CYCLES[rcProtocol], HIGH_FIRST[rcProtocol]); |
688 // transmit(1,3,true); |
|
689 // transmit(1,3,true); |
|
690 } |
617 } |
691 |
618 |
692 |
619 |
693 |
620 |
694 /* |
621 /* |
697 * Waveform: | |_| |_ |
624 * Waveform: | |_| |_ |
698 */ |
625 */ |
699 void sendT1(void) { |
626 void sendT1(void) { |
700 transmit(ONE_FIRST_CYCLES[rcProtocol], ONE_SECOND_CYCLES[rcProtocol], HIGH_FIRST[rcProtocol]); |
627 transmit(ONE_FIRST_CYCLES[rcProtocol], ONE_SECOND_CYCLES[rcProtocol], HIGH_FIRST[rcProtocol]); |
701 transmit(ONE_FIRST_CYCLES[rcProtocol], ONE_SECOND_CYCLES[rcProtocol], HIGH_FIRST[rcProtocol]); |
628 transmit(ONE_FIRST_CYCLES[rcProtocol], ONE_SECOND_CYCLES[rcProtocol], HIGH_FIRST[rcProtocol]); |
702 // transmit(3,1,true); |
|
703 // transmit(3,1,true); |
|
704 } |
629 } |
705 |
630 |
706 |
631 |
707 |
632 |
708 /* |
633 /* |
711 * Waveform: | |___| |_ |
636 * Waveform: | |___| |_ |
712 */ |
637 */ |
713 void sendTF(void) { |
638 void sendTF(void) { |
714 transmit(ZERO_FIRST_CYCLES[rcProtocol], ZERO_SECOND_CYCLES[rcProtocol], HIGH_FIRST[rcProtocol]); |
639 transmit(ZERO_FIRST_CYCLES[rcProtocol], ZERO_SECOND_CYCLES[rcProtocol], HIGH_FIRST[rcProtocol]); |
715 transmit(ONE_FIRST_CYCLES[rcProtocol], ONE_SECOND_CYCLES[rcProtocol], HIGH_FIRST[rcProtocol]); |
640 transmit(ONE_FIRST_CYCLES[rcProtocol], ONE_SECOND_CYCLES[rcProtocol], HIGH_FIRST[rcProtocol]); |
716 // transmit(1,3,true); |
|
717 // transmit(3,1,true); |
|
718 } |
641 } |
719 |
642 |
720 |
643 |
721 |
644 |
722 /* |
645 /* |