MindPX: Use TIM14 CH1 for tone alarm output.

This commit is contained in:
Henry Zhang 2016-10-21 15:54:56 +08:00 committed by Lorenz Meier
parent b76c8cd80c
commit 53b4996379
2 changed files with 28 additions and 4 deletions

View File

@ -229,10 +229,10 @@
//#define GPIO_VDD_5V_PERIPH_OC (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTE|GPIO_PIN15)
/* Tone alarm output */
#define TONE_ALARM_TIMER 2 /* timer 2 */
#define TONE_ALARM_TIMER 14 /* timer 14 */
#define TONE_ALARM_CHANNEL 1 /* channel 1 */
#define GPIO_TONE_ALARM_IDLE (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN15)
#define GPIO_TONE_ALARM (GPIO_ALT|GPIO_AF1|GPIO_SPEED_2MHz|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN15)
#define GPIO_TONE_ALARM_IDLE (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN7)
#define GPIO_TONE_ALARM (GPIO_ALT|GPIO_AF9|GPIO_SPEED_2MHz|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN7)
/* PWM
*

View File

@ -198,8 +198,32 @@
# ifdef CONFIG_STM32_TIM11
# error Must not set CONFIG_STM32_TIM11 when TONE_ALARM_TIMER is 11
# endif
#elif TONE_ALARM_TIMER == 12
# define TONE_ALARM_BASE STM32_TIM12_BASE
# define TONE_ALARM_CLOCK STM32_APB1_TIM12_CLKIN
# define TONE_ALARM_CLOCK_POWER_REG STM32_RCC_APB1ENR
# define TONE_ALARM_CLOCK_ENABLE RCC_APB1ENR_TIM12EN
# ifdef CONFIG_STM32_TIM12
# error Must not set CONFIG_STM32_TIM12 when TONE_ALARM_TIMER is 12
# endif
#elif TONE_ALARM_TIMER == 13
# define TONE_ALARM_BASE STM32_TIM13_BASE
# define TONE_ALARM_CLOCK STM32_APB1_TIM12_CLKIN
# define TONE_ALARM_CLOCK_POWER_REG STM32_RCC_APB1ENR
# define TONE_ALARM_CLOCK_ENABLE RCC_APB1ENR_TIM13EN
# ifdef CONFIG_STM32_TIM13
# error Must not set CONFIG_STM32_TIM13 when TONE_ALARM_TIMER is 13
# endif
#elif TONE_ALARM_TIMER == 14
# define TONE_ALARM_BASE STM32_TIM14_BASE
# define TONE_ALARM_CLOCK STM32_APB1_TIM12_CLKIN
# define TONE_ALARM_CLOCK_POWER_REG STM32_RCC_APB1ENR
# define TONE_ALARM_CLOCK_ENABLE RCC_APB1ENR_TIM14EN
# ifdef CONFIG_STM32_TIM14
# error Must not set CONFIG_STM32_TIM14 when TONE_ALARM_TIMER is 14
# endif
#else
# error Must set TONE_ALARM_TIMER to one of the timers between 1 and 11 (inclusive) to use this driver.
# error Must set TONE_ALARM_TIMER to one of the timers between 1 and 14 (inclusive) to use this driver.
#endif
#if TONE_ALARM_CHANNEL == 1