From fb20b2115193927ddde7a38d9cc1dc86038d2c70 Mon Sep 17 00:00:00 2001 From: bsongis Date: Sun, 11 May 2014 16:00:51 +0200 Subject: [PATCH] Compilation failure on Taranis (not plus) --- radio/src/targets/taranis/haptic_driver.cpp | 43 +++++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/radio/src/targets/taranis/haptic_driver.cpp b/radio/src/targets/taranis/haptic_driver.cpp index c6df245cd..062833fbd 100644 --- a/radio/src/targets/taranis/haptic_driver.cpp +++ b/radio/src/targets/taranis/haptic_driver.cpp @@ -36,16 +36,12 @@ #include "../../opentx.h" +#if defined(REVPLUS) void hapticOff(void) { -#if defined(REVPLUS) TIM10->CCR1 = 0; -#else - GPIO_ResetBits(GPIO_HAPTIC, PIN_HAPTIC); -#endif } -#if defined(REVPLUS) void hapticOn(uint32_t pwmPercent) { if (pwmPercent > 100) { @@ -53,13 +49,6 @@ void hapticOn(uint32_t pwmPercent) } TIM10->CCR1 = pwmPercent; } -#else -void hapticOn() -{ - // No PWM before REVPLUS - GPIO_SetBits(GPIO_HAPTIC, PIN_HAPTIC); -} -#endif void hapticInit(void) { @@ -84,3 +73,33 @@ void hapticInit(void) TIM10->EGR = 0 ; TIM10->CR1 = TIM_CR1_CEN ; // Counter enable } + +#else + +// No PWM before REVPLUS +void hapticInit(void) +{ + GPIO_InitTypeDef GPIO_InitStructure; + RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOHAPTIC, ENABLE); + + /* GPIO Configuration*/ + GPIO_InitStructure.GPIO_Pin = PIN_HAPTIC; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; + GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; + GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; + GPIO_Init(GPIO_HAPTIC, &GPIO_InitStructure); +} + +void hapticOff(void) +{ + GPIO_ResetBits(GPIO_HAPTIC, PIN_HAPTIC); +} + +void hapticOn() +{ + GPIO_SetBits(GPIO_HAPTIC, PIN_HAPTIC); +} + +#endif +