mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 09:45:21 +03:00
[Horus] Haptic now OK
This commit is contained in:
parent
c51a85f376
commit
c9ae964428
8 changed files with 22 additions and 15 deletions
|
@ -83,7 +83,7 @@ if(PCB STREQUAL HORUS)
|
|||
lcd_driver.cpp
|
||||
delays.c
|
||||
usb_driver.c
|
||||
pwr_driver.c
|
||||
pwr_driver.cpp
|
||||
sdram_driver.c
|
||||
led_driver.cpp
|
||||
)
|
||||
|
|
|
@ -55,7 +55,7 @@ enum AudioBufferState
|
|||
typedef uint16_t audio_data_t;
|
||||
#define AUDIO_DATA_SILENCE 0x8000
|
||||
#define AUDIO_DATA_MIN 0
|
||||
#define AUDIO_DATA_MAX UINT16_MAX
|
||||
#define AUDIO_DATA_MAX 0xffff
|
||||
#define AUDIO_BITS_PER_SAMPLE 16
|
||||
#elif defined(PCBHORUS)
|
||||
typedef int16_t audio_data_t;
|
||||
|
|
|
@ -1996,7 +1996,7 @@ void opentxClose()
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !defined(PCBTARANIS)
|
||||
#if !defined(PCBTARANIS) && !defined(COLORLCD)
|
||||
if (storageDirtyMsk & EE_MODEL) {
|
||||
displayPopup(STR_SAVEMODEL);
|
||||
}
|
||||
|
@ -2021,8 +2021,6 @@ void opentxClose()
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(NAVIGATION_STICKS)
|
||||
uint8_t getSticksNavigationEvent()
|
||||
{
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(SIMU)
|
||||
#define SWITCH_SIMU(a, b) (a)
|
||||
|
|
|
@ -291,6 +291,7 @@ void sportSendBuffer(uint8_t *buffer, uint32_t count);
|
|||
|
||||
// Haptic driver
|
||||
void hapticInit(void);
|
||||
void hapticDone(void);
|
||||
void hapticOff(void);
|
||||
#define HAPTIC_OFF() hapticOff()
|
||||
void hapticOn(uint32_t pwmPercent);
|
||||
|
|
|
@ -245,11 +245,11 @@
|
|||
|
||||
// Haptic
|
||||
#define HAPTIC_RCC_AHB1Periph RCC_AHB1Periph_GPIOA
|
||||
#define HAPTIC_RCC_APB2Periph RCC_APB2ENR_TIM11EN
|
||||
#define HAPTIC_RCC_APB2Periph RCC_APB2ENR_TIM9EN
|
||||
#define HAPTIC_GPIO GPIOA
|
||||
#define HAPTIC_GPIO_PIN GPIO_Pin_2
|
||||
#define HAPTIC_GPIO_TIMER TIM11
|
||||
#define HAPTIC_GPIO_AF GPIO_AF_TIM11
|
||||
#define HAPTIC_GPIO_TIMER TIM9
|
||||
#define HAPTIC_GPIO_AF GPIO_AF_TIM9
|
||||
#define HAPTIC_GPIO_PinSource GPIO_PinSource2
|
||||
|
||||
// Internal Module
|
||||
|
|
|
@ -45,12 +45,18 @@ void hapticInit(void)
|
|||
|
||||
GPIO_PinAFConfig(HAPTIC_GPIO, HAPTIC_GPIO_PinSource, HAPTIC_GPIO_AF);
|
||||
|
||||
HAPTIC_GPIO_TIMER->ARR = 100 ;
|
||||
HAPTIC_GPIO_TIMER->ARR = 100;
|
||||
HAPTIC_GPIO_TIMER->PSC = (PERI2_FREQUENCY * TIMER_MULT_APB2) / 10000 - 1;
|
||||
HAPTIC_GPIO_TIMER->CCMR1 = TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2 ; // PWM
|
||||
HAPTIC_GPIO_TIMER->CCER = TIM_CCER_CC1E ;
|
||||
HAPTIC_GPIO_TIMER->CCMR1 = TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2; // PWM
|
||||
HAPTIC_GPIO_TIMER->CCER = TIM_CCER_CC1E;
|
||||
|
||||
HAPTIC_GPIO_TIMER->CCR1 = 0 ;
|
||||
HAPTIC_GPIO_TIMER->EGR = 0 ;
|
||||
HAPTIC_GPIO_TIMER->CR1 = TIM_CR1_CEN ; // Counter enable
|
||||
HAPTIC_GPIO_TIMER->CCR1 = 0;
|
||||
HAPTIC_GPIO_TIMER->EGR = 0;
|
||||
HAPTIC_GPIO_TIMER->CR1 = TIM_CR1_CEN; // counter enable
|
||||
}
|
||||
|
||||
void hapticDone(void)
|
||||
{
|
||||
hapticOff();
|
||||
RCC_AHB1PeriphClockCmd(HAPTIC_RCC_AHB1Periph, DISABLE);
|
||||
}
|
||||
|
|
|
@ -64,6 +64,9 @@ void pwrOff()
|
|||
GPIO_Init(AUDIO_SHUTDOWN_GPIO, &GPIO_InitStructure);
|
||||
GPIO_ResetBits(AUDIO_SHUTDOWN_GPIO, AUDIO_SHUTDOWN_GPIO_PIN);
|
||||
|
||||
// Shutdown the Haptic
|
||||
hapticDone();
|
||||
|
||||
GPIO_ResetBits(PWR_GPIO, PWR_GPIO_PIN_ON);
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue