diff --git a/Multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino index 3ea6954..e07fa13 100644 --- a/Multiprotocol/Multiprotocol.ino +++ b/Multiprotocol/Multiprotocol.ino @@ -40,6 +40,10 @@ HardwareTimer timer(2); #include #include "_Config.h" #include "TX_Def.h" + +#ifdef XMEGA + #undef ENABLE_PPM // Disable PPM for orange module +#endif //Multiprotocol module configuration file //Global constants/variables @@ -169,6 +173,13 @@ void setup() for ( uint8_t count = 0 ; count < 20 ; count += 1 ) asm("nop") ; PORTE.OUTCLR = 0x01 ; + // TCC1 16-bit timer, clocked at 0.5uS + EVSYS.CH3MUX = 0x80 + 0x04 ; // Prescaler of 16 + TCC1.CTRLB = 0; TCC1.CTRLC = 0; TCC1.CTRLD = 0; TCC1.CTRLE = 0; + TCC1.INTCTRLA = 0; TCC1.INTCTRLB = 0; + TCC1.PER = 0xFFFF ; + TCC1.CNT = 0 ; + TCC1.CTRLA = 0x0B ; // Event3 (prescale of 16) #else // General pinout #if defined STM32_board @@ -198,7 +209,9 @@ void setup() pinMode(S1_pin,INPUT_PULLUP);//dial switch pinMode(S2_pin,INPUT_PULLUP); pinMode(S3_pin,INPUT_PULLUP); - pinMode(S4_pin,INPUT_PULLUP); + pinMode(S4_pin,INPUT_PULLUP); + //select the counter clock. + start_timer2();//0.5us #else DDRD = (1<