[Taranis] SWR implemented with popup when SWR > 0x33 (Tx antenna problem)

[Taranis] RSSI/A1/A2 alarms
[Taranis] Better code when no pulses sent (internal or external module). Thanks Mike!
[Taranis] Correction on DEBUG serial code
This commit is contained in:
bsongis@gmail.com
2013-05-15 07:57:21 +00:00
parent a4cfa395a8
commit 90be0bae10
19 changed files with 356 additions and 302 deletions
+2 -2
View File
@@ -758,8 +758,8 @@ void usbBootloader()
PWM->PWM_DIS = PWM_DIS_CHID0 | PWM_DIS_CHID1 | PWM_DIS_CHID2 | PWM_DIS_CHID3 ; // Disable all
NVIC_DisableIRQ(TC2_IRQn) ;
disable_main_ppm() ;
disable_ppm2();
disable_ppm(0);
disable_ppm(1);
// PWM->PWM_IDR1 = PWM_IDR1_CHID3 ;
// NVIC_DisableIRQ(PWM_IRQn) ;
+8 -4
View File
@@ -162,13 +162,17 @@ extern uint32_t readKeys();
#define DBLKEYS_PRESSED_LFT_DWN(i) ((in & (0x40 + 0x08)) == (0x40 + 0x08))
// Pulses driver
#define init_no_pulses(port) init_main_ppm(3000, 0)
#define disable_no_pulses(port) disable_ppm(0)
void init_main_ppm(uint32_t period, uint32_t out_enable);
void disable_main_ppm();
void disable_ppm2();
#define init_ppm(port) init_main_ppm(3000, 1)
void disable_ppm(uint32_t port);
void init_ssc();
void disable_ssc();
#define disable_pxx() disable_ssc()
void setupPulsesPPM(unsigned int port);
#define init_pxx(port) init_main_ppm(5000, 0); init_ssc()
#define disable_pxx(port) disable_ssc()
#define init_dsm2(port) init_main_ppm(5000, 0); init_ssc()
#define disable_dsm2(port) disable_ssc()
// SD driver
#if !defined(SIMU)
+13 -16
View File
@@ -44,7 +44,7 @@ extern uint8_t Bit_pulses[64] ; // Likely more than we
extern uint8_t Serial_byte_count ;
void init_main_ppm( uint32_t period, uint32_t out_enable )
void init_main_ppm(uint32_t period, uint32_t out_enable)
{
register Pio *pioptr ;
register Pwm *pwmptr ;
@@ -91,25 +91,22 @@ void init_main_ppm( uint32_t period, uint32_t out_enable )
NVIC_EnableIRQ(PWM_IRQn) ;
}
void disable_main_ppm()
void disable_ppm(uint32_t port)
{
register Pio *pioptr ;
pioptr = PIOA ;
pioptr->PIO_PER = PIO_PA17 ; // Assign A17 to PIO
if (port == 0) {
pioptr = PIOA ;
pioptr->PIO_PER = PIO_PA17 ; // Assign A17 to PIO
PWM->PWM_IDR1 = PWM_IDR1_CHID3 ;
}
else {
pioptr = PIOC ;
pioptr->PIO_PER = PIO_PC17 ; // Assign A17 to PIO
PWM->PWM_IDR1 = PWM_IDR1_CHID3 ;
}
void disable_ppm2()
{
register Pio *pioptr ;
pioptr = PIOC ;
pioptr->PIO_PER = PIO_PC17 ; // Assign A17 to PIO
PWM->PWM_IDR1 = PWM_IDR1_CHID1 ;
NVIC_DisableIRQ(PWM_IRQn) ;
PWM->PWM_IDR1 = PWM_IDR1_CHID1 ;
NVIC_DisableIRQ(PWM_IRQn) ;
}
}
// Initialise the SSC to allow PXX output.
+1 -1
View File
@@ -89,7 +89,7 @@ uint8_t usbPlugged(void);
void delaysInit();
#define DEBUG_UART_BAUDRATE 115200
#define DEBUG_UART_BAUDRATE 9600
#define SPORT_BAUDRATE 57600
void uartInit(uint32_t baudrate);
+6 -4
View File
@@ -110,7 +110,6 @@ static void init_pa10_none()
INTERNAL_RF_OFF();
// Timer1, channel 3
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIO_INTPPM, ENABLE);
@@ -121,7 +120,7 @@ static void init_pa10_none()
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIO_INTPPM, &GPIO_InitStructure);
GPIO_SetBits(GPIO_INTPPM,PIN_INTPPM_OUT) ; // Set high
GPIO_SetBits(GPIO_INTPPM, PIN_INTPPM_OUT) ; // Set high
RCC->APB2ENR |= RCC_APB2ENR_TIM1EN ; // Enable clock
@@ -170,7 +169,7 @@ static void init_pa7_none()
RCC->APB2ENR |= RCC_APB2ENR_TIM8EN ; // Enable clock
TIM1->CR1 &= ~TIM_CR1_CEN ;
TIM8->CR1 &= ~TIM_CR1_CEN ;
TIM8->ARR = 36000 ; // 18mS
TIM8->CCR2 = 32000 ; // Update time
TIM8->PSC = (PERI2_FREQUENCY * TIMER_MULT_APB2) / 2000000 - 1 ; // 0.5uS from 30MHz
@@ -326,12 +325,15 @@ extern "C" void TIM1_CC_IRQHandler()
TIM1->CCR3 = pxxStream[INTERNAL_MODULE][0];
TIM1->DIER |= TIM_DIER_CC2IE ; // Enable this interrupt
}
else {
else if (s_current_protocol[INTERNAL_MODULE] == PROTO_PPM) {
ppmStreamPtr[INTERNAL_MODULE] = ppmStream[INTERNAL_MODULE];
TIM1->DIER |= TIM_DIER_UDE ;
TIM1->SR &= ~TIM_SR_UIF ; // Clear this flag
TIM1->DIER |= TIM_DIER_UIE ; // Enable this interrupt
}
else {
TIM1->DIER |= TIM_DIER_CC2IE ; // Enable this interrupt
}
}
extern "C" void TIM1_UP_TIM10_IRQHandler()
+1 -1
View File
@@ -60,7 +60,7 @@ void uartInit(uint32_t baudrate)
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Tx;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_Init(UART3, &USART_InitStructure);
USART_Cmd(UART3, ENABLE);