Cosmetics
This commit is contained in:
@@ -57,8 +57,8 @@ inline void DSM2_EnableTXD(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void set_timer3_capture( void ) ;
|
void set_timer3_capture(void);
|
||||||
void set_timer3_ppm( void ) ;
|
void set_timer3_ppm(void);
|
||||||
|
|
||||||
void startPulses()
|
void startPulses()
|
||||||
{
|
{
|
||||||
@@ -188,7 +188,6 @@ void setupPulsesPPM(uint8_t proto)
|
|||||||
*ptr = 0;
|
*ptr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined(PXX)
|
#if defined(PXX)
|
||||||
const pm_uint16_t CRCTable[] PROGMEM =
|
const pm_uint16_t CRCTable[] PROGMEM =
|
||||||
{
|
{
|
||||||
@@ -226,66 +225,60 @@ const pm_uint16_t CRCTable[] PROGMEM =
|
|||||||
0x7bc7,0x6a4e,0x58d5,0x495c,0x3de3,0x2c6a,0x1ef1,0x0f78
|
0x7bc7,0x6a4e,0x58d5,0x495c,0x3de3,0x2c6a,0x1ef1,0x0f78
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t PcmByte ;
|
uint8_t PcmByte;
|
||||||
uint8_t PcmBitCount ;
|
uint8_t PcmBitCount;
|
||||||
uint16_t PcmCrc ;
|
uint16_t PcmCrc;
|
||||||
uint8_t PcmOnesCount ;
|
uint8_t PcmOnesCount;
|
||||||
|
|
||||||
void crc( uint8_t data )
|
void crc(uint8_t data)
|
||||||
{
|
{
|
||||||
PcmCrc=(PcmCrc<<8)^pgm_read_word(&CRCTable[((PcmCrc>>8)^data) & 0xFF]);
|
PcmCrc = (PcmCrc<<8)^pgm_read_word(&CRCTable[((PcmCrc>>8)^data) & 0xFF]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void putPcmPart( uint8_t value )
|
void putPcmPart(uint8_t value)
|
||||||
{
|
{
|
||||||
PcmByte >>= 2 ;
|
PcmByte >>= 2;
|
||||||
PcmByte |= value ;
|
PcmByte |= value;
|
||||||
if ( ++PcmBitCount >= 4 )
|
if (++PcmBitCount >= 4) {
|
||||||
{
|
*pulses2MHzWPtr++ = PcmByte;
|
||||||
*pulses2MHzWPtr++ = PcmByte ;
|
PcmBitCount = PcmByte = 0;
|
||||||
PcmBitCount = PcmByte = 0 ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void putPcmFlush()
|
void putPcmFlush()
|
||||||
{
|
{
|
||||||
while ( PcmBitCount != 0 )
|
while (PcmBitCount != 0) {
|
||||||
{
|
putPcmPart(0); // Empty
|
||||||
putPcmPart( 0 ) ; // Empty
|
|
||||||
}
|
}
|
||||||
*pulses2MHzWPtr = 0 ; // Mark end
|
*pulses2MHzWPtr = 0; // Mark end
|
||||||
}
|
}
|
||||||
|
|
||||||
void putPcmBit( uint8_t bit )
|
void putPcmBit(uint8_t bit)
|
||||||
{
|
{
|
||||||
if ( bit )
|
if (bit) {
|
||||||
{
|
PcmOnesCount += 1;
|
||||||
PcmOnesCount += 1 ;
|
putPcmPart(0x80);
|
||||||
putPcmPart( 0x80 ) ;
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
PcmOnesCount = 0;
|
||||||
PcmOnesCount = 0 ;
|
putPcmPart(0xC0);
|
||||||
putPcmPart( 0xC0 ) ;
|
|
||||||
}
|
}
|
||||||
if ( PcmOnesCount >= 5 )
|
if (PcmOnesCount >= 5) {
|
||||||
{
|
putPcmBit(0); // Stuff a 0 bit in
|
||||||
putPcmBit( 0 ) ; // Stuff a 0 bit in
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void putPcmByte( uint8_t byte )
|
void putPcmByte(uint8_t byte)
|
||||||
{
|
{
|
||||||
uint8_t i ;
|
uint8_t i;
|
||||||
|
|
||||||
crc( byte ) ;
|
crc(byte);
|
||||||
|
|
||||||
for (i=0; i<8; i++)
|
for (i=0; i<8; i++) {
|
||||||
{
|
putPcmBit(byte & 0x80);
|
||||||
putPcmBit( byte & 0x80 ) ;
|
byte <<= 1;
|
||||||
byte <<= 1 ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,56 +287,56 @@ void putPcmHead()
|
|||||||
{
|
{
|
||||||
// send 7E, do not CRC
|
// send 7E, do not CRC
|
||||||
// 01111110
|
// 01111110
|
||||||
putPcmPart( 0xC0 ) ;
|
putPcmPart(0xC0);
|
||||||
putPcmPart( 0x80 ) ;
|
putPcmPart(0x80);
|
||||||
putPcmPart( 0x80 ) ;
|
putPcmPart(0x80);
|
||||||
putPcmPart( 0x80 ) ;
|
putPcmPart(0x80);
|
||||||
putPcmPart( 0x80 ) ;
|
putPcmPart(0x80);
|
||||||
putPcmPart( 0x80 ) ;
|
putPcmPart(0x80);
|
||||||
putPcmPart( 0x80 ) ;
|
putPcmPart(0x80);
|
||||||
putPcmPart( 0xC0 ) ;
|
putPcmPart(0xC0);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t scaleForPXX( uint8_t i )
|
uint16_t scaleForPXX(uint8_t i)
|
||||||
{
|
{
|
||||||
int16_t value = ( ( i < 16 ) ? channelOutputs[i] * 3 / 4 : 0 ) + 1024;
|
int16_t value = ((i < 16) ? channelOutputs[i] * 3 / 4 : 0) + 1024;
|
||||||
return limit<uint16_t>(1, value, 2046);
|
return limit<uint16_t>(1, value, 2046);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupPulsesPXX()
|
void setupPulsesPXX()
|
||||||
{
|
{
|
||||||
uint16_t chan ;
|
uint16_t chan;
|
||||||
uint16_t chan_1 ;
|
uint16_t chan_1;
|
||||||
|
|
||||||
pulses2MHzWPtr = pulses2MHz;
|
pulses2MHzWPtr = pulses2MHz;
|
||||||
pulses2MHzRPtr = pulses2MHz;
|
pulses2MHzRPtr = pulses2MHz;
|
||||||
|
|
||||||
PcmCrc = 0 ;
|
PcmCrc = 0;
|
||||||
PcmBitCount = PcmByte = 0 ;
|
PcmBitCount = PcmByte = 0;
|
||||||
PcmOnesCount = 0 ;
|
PcmOnesCount = 0;
|
||||||
putPcmHead() ;
|
putPcmHead();
|
||||||
putPcmByte(g_model.header.modelId[0]);
|
putPcmByte(g_model.header.modelId[0]);
|
||||||
uint8_t flag1 = 0;
|
uint8_t flag1 = 0;
|
||||||
if (moduleFlag[0] == MODULE_BIND)
|
if (moduleFlag[0] == MODULE_BIND)
|
||||||
flag1 |= (g_eeGeneral.countryCode << 1) | PXX_SEND_BIND;
|
flag1 |= (g_eeGeneral.countryCode << 1) | PXX_SEND_BIND;
|
||||||
else if (moduleFlag[0] == MODULE_RANGECHECK)
|
else if (moduleFlag[0] == MODULE_RANGECHECK)
|
||||||
flag1 |= PXX_SEND_RANGECHECK;
|
flag1 |= PXX_SEND_RANGECHECK;
|
||||||
putPcmByte(flag1) ; // First byte of flags
|
putPcmByte(flag1); // First byte of flags
|
||||||
putPcmByte( 0 ) ; // Second byte of flags
|
putPcmByte(0); // Second byte of flags
|
||||||
for (uint8_t i=0; i<8; i+=2) { // First 8 channels only
|
for (uint8_t i=0; i<8; i+=2) { // First 8 channels only
|
||||||
chan = scaleForPXX(i);
|
chan = scaleForPXX(i);
|
||||||
chan_1 = scaleForPXX(i+1);
|
chan_1 = scaleForPXX(i+1);
|
||||||
putPcmByte( chan ) ; // Low byte of channel
|
putPcmByte(chan); // Low byte of channel
|
||||||
putPcmByte( ( ( chan >> 8 ) & 0x0F ) | ( chan_1 << 4) ) ; // 4 bits each from 2 channels
|
putPcmByte(((chan >> 8) & 0x0F) | (chan_1 << 4)); // 4 bits each from 2 channels
|
||||||
putPcmByte( chan_1 >> 4 ) ; // High byte of channel
|
putPcmByte(chan_1 >> 4); // High byte of channel
|
||||||
}
|
}
|
||||||
putPcmByte(0);
|
putPcmByte(0);
|
||||||
chan = PcmCrc ; // get the crc
|
chan = PcmCrc; // get the crc
|
||||||
putPcmByte( chan>>8 ) ; // Checksum lo
|
putPcmByte(chan>>8); // Checksum lo
|
||||||
putPcmByte( chan ) ; // Checksum hi
|
putPcmByte(chan); // Checksum hi
|
||||||
putPcmHead( ) ;
|
putPcmHead();
|
||||||
putPcmFlush() ;
|
putPcmFlush();
|
||||||
OCR1C += 40000 ; // 20mS on
|
OCR1C += 40000; // 20mS on
|
||||||
PORTB |= (1<<OUT_B_PPM);
|
PORTB |= (1<<OUT_B_PPM);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -353,7 +346,7 @@ void setupPulsesPXX()
|
|||||||
// DSM2 protocol pulled from th9x - Thanks thus!!!
|
// DSM2 protocol pulled from th9x - Thanks thus!!!
|
||||||
|
|
||||||
//http://www.rclineforum.de/forum/board49-zubeh-r-elektronik-usw/fernsteuerungen-sender-und-emp/neuer-9-kanal-sender-f-r-70-au/Beitrag_3897736#post3897736
|
//http://www.rclineforum.de/forum/board49-zubeh-r-elektronik-usw/fernsteuerungen-sender-und-emp/neuer-9-kanal-sender-f-r-70-au/Beitrag_3897736#post3897736
|
||||||
//(dsm2( LP4DSM aus den RTF ( Ready To Fly ) Sendern von Spektrum.
|
//(dsm2(LP4DSM aus den RTF (Ready To Fly) Sendern von Spektrum.
|
||||||
//http://www.rcgroups.com/forums/showpost.php?p=18554028&postcount=237
|
//http://www.rcgroups.com/forums/showpost.php?p=18554028&postcount=237
|
||||||
// /home/thus/txt/flieger/PPMtoDSM.c
|
// /home/thus/txt/flieger/PPMtoDSM.c
|
||||||
/*
|
/*
|
||||||
@@ -738,8 +731,9 @@ void setupPulses()
|
|||||||
PORTH |= 0x80; // PORTH:7 LOW->HIGH signals start of setupPulses()
|
PORTH |= 0x80; // PORTH:7 LOW->HIGH signals start of setupPulses()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (s_pulses_paused)
|
if (s_pulses_paused) {
|
||||||
required_protocol = PROTO_NONE;
|
required_protocol = PROTO_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(CPUM2560) && defined(DSM2_PPM) && defined(TX_CADDY)
|
#if defined(CPUM2560) && defined(DSM2_PPM) && defined(TX_CADDY)
|
||||||
// This should be here, executed on every loop, to ensure re-setting of the
|
// This should be here, executed on every loop, to ensure re-setting of the
|
||||||
@@ -770,10 +764,10 @@ void setupPulses()
|
|||||||
TIMSK1 &= ~(1<<OCIE1C); // COMPC1 off
|
TIMSK1 &= ~(1<<OCIE1C); // COMPC1 off
|
||||||
TIFR1 = 0x2F;
|
TIFR1 = 0x2F;
|
||||||
#else
|
#else
|
||||||
TIMSK &= ~0x3C ; // All interrupts off
|
TIMSK &= ~0x3C; // All interrupts off
|
||||||
ETIMSK &= ~(1<<OCIE1C) ; // COMPC1 off
|
ETIMSK &= ~(1<<OCIE1C); // COMPC1 off
|
||||||
TIFR = 0x3C ; // Clear all pending interrupts
|
TIFR = 0x3C; // Clear all pending interrupts
|
||||||
ETIFR = 0x3F ; // Clear all pending interrupts
|
ETIFR = 0x3F; // Clear all pending interrupts
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (required_protocol) {
|
switch (required_protocol) {
|
||||||
@@ -827,7 +821,7 @@ void setupPulses()
|
|||||||
TIMSK |= 0x10; // Enable COMPA
|
TIMSK |= 0x10; // Enable COMPA
|
||||||
TCCR1A = (0<<WGM10);
|
TCCR1A = (0<<WGM10);
|
||||||
#endif
|
#endif
|
||||||
TCCR1B = (1 << WGM12) | (2<<CS10) ; // CTC OCRA, 16MHz / 8
|
TCCR1B = (1 << WGM12) | (2<<CS10); // CTC OCRA, 16MHz / 8
|
||||||
setupPulsesPPM(PROTO_PPM16);
|
setupPulsesPPM(PROTO_PPM16);
|
||||||
OCR3A = 50000;
|
OCR3A = 50000;
|
||||||
OCR3B = 5000;
|
OCR3B = 5000;
|
||||||
@@ -843,7 +837,7 @@ void setupPulses()
|
|||||||
OCR3B = 5000;
|
OCR3B = 5000;
|
||||||
set_timer3_ppm();
|
set_timer3_ppm();
|
||||||
PORTB &= ~(1<<OUT_B_PPM); // Hold PPM output low
|
PORTB &= ~(1<<OUT_B_PPM); // Hold PPM output low
|
||||||
break ;
|
break;
|
||||||
|
|
||||||
#if defined(DSM2_SERIAL) && defined(FRSKY)
|
#if defined(DSM2_SERIAL) && defined(FRSKY)
|
||||||
case PROTO_DSM2_LP45:
|
case PROTO_DSM2_LP45:
|
||||||
@@ -941,7 +935,7 @@ ISR(TIMER1_CAPT_vect) // 2MHz pulse generation
|
|||||||
// OCR1B output pin (PPM_OUT) is pre-SET in setupPulses -- on every new
|
// OCR1B output pin (PPM_OUT) is pre-SET in setupPulses -- on every new
|
||||||
// frame, for safety -- and then configured to toggle on each OCR1B compare match.
|
// frame, for safety -- and then configured to toggle on each OCR1B compare match.
|
||||||
// Thus, all we need do here is update the compare regisiter(s) ...
|
// Thus, all we need do here is update the compare regisiter(s) ...
|
||||||
uint8_t x ;
|
uint8_t x;
|
||||||
x = *pulses2MHzRPtr++; // Byte size
|
x = *pulses2MHzRPtr++; // Byte size
|
||||||
ICR1 = x;
|
ICR1 = x;
|
||||||
OCR1B = (uint16_t)x; // Duplicate capture compare value for OCR1B, because Timer1 is in CTC mode
|
OCR1B = (uint16_t)x; // Duplicate capture compare value for OCR1B, because Timer1 is in CTC mode
|
||||||
@@ -950,10 +944,10 @@ ISR(TIMER1_CAPT_vect) // 2MHz pulse generation
|
|||||||
|
|
||||||
#else // manual bit-bang mode
|
#else // manual bit-bang mode
|
||||||
|
|
||||||
uint8_t x ;
|
uint8_t x;
|
||||||
PORTB ^= (1<<OUT_B_PPM); // Toggle PPM_OUT
|
PORTB ^= (1<<OUT_B_PPM); // Toggle PPM_OUT
|
||||||
x = *pulses2MHzRPtr++; // Byte size
|
x = *pulses2MHzRPtr++; // Byte size
|
||||||
ICR1 = x ;
|
ICR1 = x;
|
||||||
if (x > 200) PORTB |= (1<<OUT_B_PPM); // Make sure pulses are the correct way up.
|
if (x > 200) PORTB |= (1<<OUT_B_PPM); // Make sure pulses are the correct way up.
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -963,22 +957,22 @@ ISR(TIMER1_CAPT_vect) // 2MHz pulse generation
|
|||||||
#if defined(PXX)
|
#if defined(PXX)
|
||||||
ISR(TIMER1_COMPB_vect) // PXX main interrupt
|
ISR(TIMER1_COMPB_vect) // PXX main interrupt
|
||||||
{
|
{
|
||||||
uint8_t x ;
|
uint8_t x;
|
||||||
PORTB ^= (1<<OUT_B_PPM) ;
|
PORTB ^= (1<<OUT_B_PPM);
|
||||||
x = *pulses2MHzRPtr; // Byte size
|
x = *pulses2MHzRPtr; // Byte size
|
||||||
if ( ( x & 1 ) == 0 )
|
if ((x & 1) == 0)
|
||||||
{
|
{
|
||||||
OCR1B += 32 ;
|
OCR1B += 32;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OCR1B += 16 ;
|
OCR1B += 16;
|
||||||
}
|
}
|
||||||
if ( (x >>= 1) == 0 )
|
if ((x >>= 1) == 0)
|
||||||
{
|
{
|
||||||
if ( *(++pulses2MHzRPtr) == 0 )
|
if (*(++pulses2MHzRPtr) == 0)
|
||||||
{
|
{
|
||||||
OCR1B = OCR1C + 2000 ; // 1mS on from OCR1B
|
OCR1B = OCR1C + 2000; // 1mS on from OCR1B
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -997,7 +991,7 @@ ISR(TIMER1_COMPC_vect) // DSM2_PPM or PXX end of frame
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(DSM2_PPM)
|
#if defined(DSM2_PPM)
|
||||||
ICR1 = 41536 ; // next frame starts in 22ms 41536 = 2*(22000 - 14*11*8)
|
ICR1 = 41536; // next frame starts in 22ms 41536 = 2*(22000 - 14*11*8)
|
||||||
if (OCR1C < 255) {
|
if (OCR1C < 255) {
|
||||||
OCR1C = 39000; // delay setup pulses by 19.5ms to reduce system latency
|
OCR1C = 39000; // delay setup pulses by 19.5ms to reduce system latency
|
||||||
}
|
}
|
||||||
@@ -1018,7 +1012,7 @@ ISR(TIMER1_COMPC_vect) // DSM2_PPM or PXX end of frame
|
|||||||
|
|
||||||
#if defined(PXX)
|
#if defined(PXX)
|
||||||
// must be PXX
|
// must be PXX
|
||||||
setupPulses() ;
|
setupPulses();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(DSM2_PPM) && defined(PXX)
|
#if defined(DSM2_PPM) && defined(PXX)
|
||||||
@@ -1034,15 +1028,15 @@ void set_timer3_capture()
|
|||||||
{
|
{
|
||||||
#ifndef SIMU
|
#ifndef SIMU
|
||||||
#if defined (CPUM2560) || defined(CPUM2561) // TODO TIMSK3 in #define!
|
#if defined (CPUM2560) || defined(CPUM2561) // TODO TIMSK3 in #define!
|
||||||
TIMSK3 &= ~( (1<<OCIE3A) | (1<<OCIE3B) | (1<<OCIE3C) ) ; // Stop compare interrupts
|
TIMSK3 &= ~((1<<OCIE3A) | (1<<OCIE3B) | (1<<OCIE3C)); // Stop compare interrupts
|
||||||
#else
|
#else
|
||||||
ETIMSK &= ~( (1<<OCIE3A) | (1<<OCIE3B) | (1<<OCIE3C) ) ; // Stop compare interrupts
|
ETIMSK &= ~((1<<OCIE3A) | (1<<OCIE3B) | (1<<OCIE3C)); // Stop compare interrupts
|
||||||
#endif
|
#endif
|
||||||
// TODO G: This can't work with V3.2/4.x boards. Select and use a different pin
|
// TODO G: This can't work with V3.2/4.x boards. Select and use a different pin
|
||||||
// for secondary 8-ch PPM output (PORTH or Spare1 or Spare2 maybe?)
|
// for secondary 8-ch PPM output (PORTH or Spare1 or Spare2 maybe?)
|
||||||
DDRE &= ~0x80; PORTE |= 0x80 ; // Bit 7 input + pullup
|
DDRE &= ~0x80; PORTE |= 0x80; // Bit 7 input + pullup
|
||||||
|
|
||||||
TCCR3B = 0 ; // Stop counter
|
TCCR3B = 0; // Stop counter
|
||||||
TCCR3A = 0;
|
TCCR3A = 0;
|
||||||
// Noise Canceller enabled, neg. edge, clock at 16MHz / 8 (2MHz) (Correct for PCB V4.x+ also)
|
// Noise Canceller enabled, neg. edge, clock at 16MHz / 8 (2MHz) (Correct for PCB V4.x+ also)
|
||||||
TCCR3B = (1<<ICNC3) | (0b010 << CS30);
|
TCCR3B = (1<<ICNC3) | (0b010 << CS30);
|
||||||
@@ -1058,14 +1052,14 @@ void set_timer3_ppm()
|
|||||||
|
|
||||||
DDRE |= 0x80; // Bit 7 output
|
DDRE |= 0x80; // Bit 7 output
|
||||||
|
|
||||||
TCCR3B = 0 ; // Stop counter
|
TCCR3B = 0; // Stop counter
|
||||||
TCCR3A = (0<<WGM10);
|
TCCR3A = (0<<WGM10);
|
||||||
TCCR3B = (1 << WGM12) | (2<<CS10); // CTC OCR1A, 16MHz / 8
|
TCCR3B = (1 << WGM12) | (2<<CS10); // CTC OCR1A, 16MHz / 8
|
||||||
|
|
||||||
#if defined (CPUM2560) || defined(CPUM2561)
|
#if defined (CPUM2560) || defined(CPUM2561)
|
||||||
TIMSK3 |= ( (1<<OCIE3A) | (1<<OCIE3B) ); // enable immediately before mainloop
|
TIMSK3 |= ((1<<OCIE3A) | (1<<OCIE3B)); // enable immediately before mainloop
|
||||||
#else
|
#else
|
||||||
ETIMSK |= ( (1<<OCIE3A) | (1<<OCIE3B) ); // enable immediately before mainloop
|
ETIMSK |= ((1<<OCIE3A) | (1<<OCIE3B)); // enable immediately before mainloop
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1080,7 +1074,7 @@ ISR(TIMER3_COMPA_vect) //2MHz pulse generation
|
|||||||
static uint16_t *pulse2MHzPPM16RPtr = (uint16_t*) &pulses2MHz[PULSES_SIZE/2];
|
static uint16_t *pulse2MHzPPM16RPtr = (uint16_t*) &pulses2MHz[PULSES_SIZE/2];
|
||||||
|
|
||||||
if (pulsePol) {
|
if (pulsePol) {
|
||||||
PORTE |= 0x80 ; // (1<<OUT_B_PPM);
|
PORTE |= 0x80; // (1<<OUT_B_PPM);
|
||||||
pulsePol = 0;
|
pulsePol = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1089,7 +1083,7 @@ ISR(TIMER3_COMPA_vect) //2MHz pulse generation
|
|||||||
}
|
}
|
||||||
|
|
||||||
OCR3A = *pulse2MHzPPM16RPtr++;
|
OCR3A = *pulse2MHzPPM16RPtr++;
|
||||||
OCR3B = B3_comp_value ;
|
OCR3B = B3_comp_value;
|
||||||
|
|
||||||
if (*pulse2MHzPPM16RPtr == 0) {
|
if (*pulse2MHzPPM16RPtr == 0) {
|
||||||
pulse2MHzPPM16RPtr = (uint16_t*) &pulses2MHz[PULSES_SIZE/2];
|
pulse2MHzPPM16RPtr = (uint16_t*) &pulses2MHz[PULSES_SIZE/2];
|
||||||
@@ -1101,14 +1095,14 @@ ISR(TIMER3_COMPA_vect) //2MHz pulse generation
|
|||||||
|
|
||||||
ISR(TIMER3_COMPB_vect) //2MHz pulse generation
|
ISR(TIMER3_COMPB_vect) //2MHz pulse generation
|
||||||
{
|
{
|
||||||
sei() ;
|
sei();
|
||||||
if (s_current_protocol[0] != g_model.protocol) {
|
if (s_current_protocol[0] != g_model.protocol) {
|
||||||
if (s_current_protocol[0] == PROTO_PPMSIM) {
|
if (s_current_protocol[0] == PROTO_PPMSIM) {
|
||||||
setupPulses();
|
setupPulses();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setupPulsesPPM(g_model.protocol) ;
|
setupPulsesPPM(g_model.protocol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user