[Taranis] Trainer driver fixed, thanks Mike!
This commit is contained in:
@@ -100,8 +100,8 @@ void configure_pins( uint32_t pins, uint16_t config )
|
|||||||
pgpio->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << ((uint16_t)pos * 2));
|
pgpio->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << ((uint16_t)pos * 2));
|
||||||
pgpio->PUPDR |= ((config & PIN_PULL_MASK) >> 2) << (pos * 2) ;
|
pgpio->PUPDR |= ((config & PIN_PULL_MASK) >> 2) << (pos * 2) ;
|
||||||
|
|
||||||
pgpio->AFR[pos >> 3] &= ~(0x000F << (pos & 7)) ;
|
pgpio->AFR[pos >> 3] &= ~(0x000F << ((pos & 7)*4)) ;
|
||||||
pgpio->AFR[pos >> 3] |= ((config & PIN_PERI_MASK) >> 4) << (pos & 7) ;
|
pgpio->AFR[pos >> 3] |= ((config & PIN_PERI_MASK) >> 4) << ((pos & 7)*4) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -213,18 +213,11 @@ void boardInit()
|
|||||||
|
|
||||||
// TODO init_ppm() ;
|
// TODO init_ppm() ;
|
||||||
|
|
||||||
init_trainer_ppm() ;
|
|
||||||
|
|
||||||
init_trainer_capture() ;
|
init_trainer_capture() ;
|
||||||
|
|
||||||
init5msTimer();
|
init5msTimer();
|
||||||
|
|
||||||
__enable_irq() ;
|
__enable_irq() ;
|
||||||
|
|
||||||
eepromInit();
|
eepromInit();
|
||||||
|
|
||||||
sportInit();
|
sportInit();
|
||||||
|
|
||||||
usbInit();
|
usbInit();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ void disable_pxx();
|
|||||||
|
|
||||||
// Trainer driver
|
// Trainer driver
|
||||||
void init_trainer_ppm();
|
void init_trainer_ppm();
|
||||||
|
void stop_trainer_ppm();
|
||||||
void init_trainer_capture();
|
void init_trainer_capture();
|
||||||
|
|
||||||
// Keys driver
|
// Keys driver
|
||||||
|
|||||||
@@ -167,6 +167,7 @@
|
|||||||
|
|
||||||
// TODO merge these constants
|
// TODO merge these constants
|
||||||
#define PIN_PER_1 0x0010
|
#define PIN_PER_1 0x0010
|
||||||
|
#define PIN_PER_2 0x0020
|
||||||
#define PIN_PORTA 0x0000
|
#define PIN_PORTA 0x0000
|
||||||
#define PIN_PER_3 0x0030
|
#define PIN_PER_3 0x0030
|
||||||
#define PIN_PER_5 0x0050
|
#define PIN_PER_5 0x0050
|
||||||
|
|||||||
@@ -143,9 +143,9 @@ extern "C" void TIM8_UP_TIM13_IRQHandler()
|
|||||||
// Trainer capture, PC8, Timer 3 channel 3
|
// Trainer capture, PC8, Timer 3 channel 3
|
||||||
void init_trainer_capture()
|
void init_trainer_capture()
|
||||||
{
|
{
|
||||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOCEN ; // Enable portC clock
|
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOCEN ; // Enable portC clock
|
||||||
configure_pins( 0x0100, PIN_PERIPHERAL | PIN_PORTC | PIN_TR_PPM_IN ) ;
|
configure_pins (PIN_TR_PPM_IN, PIN_PERIPHERAL | PIN_PORTC | PIN_PER_2) ;
|
||||||
RCC->APB1ENR |= RCC_APB1ENR_TIM3EN ; // Enable clock
|
RCC->APB1ENR |= RCC_APB1ENR_TIM3EN ; // Enable clock
|
||||||
|
|
||||||
TIM3->ARR = 0xFFFF ;
|
TIM3->ARR = 0xFFFF ;
|
||||||
TIM3->PSC = (PERI1_FREQUENCY * TIMER_MULT_APB1) / 2000000 - 1 ; // 0.5uS
|
TIM3->PSC = (PERI1_FREQUENCY * TIMER_MULT_APB1) / 2000000 - 1 ; // 0.5uS
|
||||||
|
|||||||
Reference in New Issue
Block a user