2011-12-16 20:29:41 +01:00
|
|
|
/************************************************************************************
|
|
|
|
* arch/arm/src/stm32/stm32_pwm.h
|
|
|
|
*
|
2015-06-13 03:00:52 +02:00
|
|
|
* Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved.
|
2015-11-01 23:09:11 +01:00
|
|
|
* Copyright (C) 2015 Omni Hoverboards Inc. All rights reserved.
|
|
|
|
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
|
|
|
* Paul Alexander Patience <paul-a.patience@polymtl.ca>
|
2011-12-16 20:29:41 +01:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
|
|
* used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
************************************************************************************/
|
|
|
|
|
2011-12-20 00:06:41 +01:00
|
|
|
#ifndef __ARCH_ARM_SRC_STM32_STM32_PWM_H
|
|
|
|
#define __ARCH_ARM_SRC_STM32_STM32_PWM_H
|
2011-12-16 20:29:41 +01:00
|
|
|
|
|
|
|
/* The STM32 does not have dedicated PWM hardware. Rather, pulsed output control
|
|
|
|
* is a capabilitiy of the STM32 timers. The logic in this file implements the
|
|
|
|
* lower half of the standard, NuttX PWM interface using the STM32 timers. That
|
2016-07-20 21:48:24 +02:00
|
|
|
* interface is described in include/nuttx/drivers/pwm.h.
|
2011-12-16 20:29:41 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/************************************************************************************
|
|
|
|
* Included Files
|
|
|
|
************************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include "chip.h"
|
|
|
|
|
|
|
|
/************************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
************************************************************************************/
|
|
|
|
/* Configuration ********************************************************************/
|
|
|
|
/* Timer devices may be used for different purposes. One special purpose is
|
|
|
|
* to generate modulated outputs for such things as motor control. If CONFIG_STM32_TIMn
|
|
|
|
* is defined then the CONFIG_STM32_TIMn_PWM must also be defined to indicate that
|
|
|
|
* timer "n" is intended to be used for pulsed output signal generation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CONFIG_STM32_TIM1
|
|
|
|
# undef CONFIG_STM32_TIM1_PWM
|
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_STM32_TIM2
|
|
|
|
# undef CONFIG_STM32_TIM2_PWM
|
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_STM32_TIM3
|
|
|
|
# undef CONFIG_STM32_TIM3_PWM
|
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_STM32_TIM4
|
|
|
|
# undef CONFIG_STM32_TIM4_PWM
|
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_STM32_TIM5
|
|
|
|
# undef CONFIG_STM32_TIM5_PWM
|
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_STM32_TIM8
|
|
|
|
# undef CONFIG_STM32_TIM8_PWM
|
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_STM32_TIM9
|
|
|
|
# undef CONFIG_STM32_TIM9_PWM
|
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_STM32_TIM10
|
|
|
|
# undef CONFIG_STM32_TIM10_PWM
|
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_STM32_TIM11
|
|
|
|
# undef CONFIG_STM32_TIM11_PWM
|
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_STM32_TIM12
|
|
|
|
# undef CONFIG_STM32_TIM12_PWM
|
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_STM32_TIM13
|
|
|
|
# undef CONFIG_STM32_TIM13_PWM
|
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_STM32_TIM14
|
|
|
|
# undef CONFIG_STM32_TIM14_PWM
|
|
|
|
#endif
|
2015-11-01 23:09:11 +01:00
|
|
|
#ifndef CONFIG_STM32_TIM15
|
|
|
|
# undef CONFIG_STM32_TIM15_PWM
|
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_STM32_TIM16
|
|
|
|
# undef CONFIG_STM32_TIM16_PWM
|
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_STM32_TIM17
|
|
|
|
# undef CONFIG_STM32_TIM17_PWM
|
|
|
|
#endif
|
2011-12-16 20:29:41 +01:00
|
|
|
|
2011-12-19 20:24:09 +01:00
|
|
|
/* The basic timers (timer 6 and 7) are not capable of generating output pulses */
|
|
|
|
|
|
|
|
#undef CONFIG_STM32_TIM6_PWM
|
|
|
|
#undef CONFIG_STM32_TIM7_PWM
|
|
|
|
|
|
|
|
/* Check if PWM support for any channel is enabled. */
|
|
|
|
|
|
|
|
#if defined(CONFIG_STM32_TIM1_PWM) || defined(CONFIG_STM32_TIM2_PWM) || \
|
|
|
|
defined(CONFIG_STM32_TIM3_PWM) || defined(CONFIG_STM32_TIM4_PWM) || \
|
|
|
|
defined(CONFIG_STM32_TIM5_PWM) || defined(CONFIG_STM32_TIM8_PWM) || \
|
|
|
|
defined(CONFIG_STM32_TIM9_PWM) || defined(CONFIG_STM32_TIM10_PWM) || \
|
|
|
|
defined(CONFIG_STM32_TIM11_PWM) || defined(CONFIG_STM32_TIM12_PWM) || \
|
2015-11-01 23:09:11 +01:00
|
|
|
defined(CONFIG_STM32_TIM13_PWM) || defined(CONFIG_STM32_TIM14_PWM) || \
|
|
|
|
defined(CONFIG_STM32_TIM15_PWM) || defined(CONFIG_STM32_TIM16_PWM) || \
|
|
|
|
defined(CONFIG_STM32_TIM17_PWM)
|
2011-12-19 20:24:09 +01:00
|
|
|
|
|
|
|
#include <arch/board/board.h>
|
|
|
|
#include "chip/stm32_tim.h"
|
|
|
|
|
2015-11-01 23:09:11 +01:00
|
|
|
#ifdef CONFIG_PWM_MULTICHAN
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM1_CHANNEL1
|
|
|
|
# ifdef CONFIG_STM32_TIM1_CH1OUT
|
|
|
|
# define PWM_TIM1_CH1CFG GPIO_TIM1_CH1OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM1_CH1CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM1_CHANNEL1 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM1_CHANNEL1 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM1_CHANNEL2
|
|
|
|
# ifdef CONFIG_STM32_TIM1_CH2OUT
|
|
|
|
# define PWM_TIM1_CH2CFG GPIO_TIM1_CH2OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM1_CH2CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM1_CHANNEL2 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM1_CHANNEL2 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM1_CHANNEL3
|
|
|
|
# ifdef CONFIG_STM32_TIM1_CH3OUT
|
|
|
|
# define PWM_TIM1_CH3CFG GPIO_TIM1_CH3OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM1_CH3CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM1_CHANNEL3 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM1_CHANNEL3 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM1_CHANNEL4
|
|
|
|
# ifdef CONFIG_STM32_TIM1_CH4OUT
|
|
|
|
# define PWM_TIM1_CH4CFG GPIO_TIM1_CH4OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM1_CH4CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM1_CHANNEL4 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM1_CHANNEL4 0
|
|
|
|
#endif
|
|
|
|
#define PWM_TIM1_NCHANNELS (PWM_TIM1_CHANNEL1 + PWM_TIM1_CHANNEL2 + \
|
|
|
|
PWM_TIM1_CHANNEL3 + PWM_TIM1_CHANNEL4)
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM2_CHANNEL1
|
|
|
|
# ifdef CONFIG_STM32_TIM2_CH1OUT
|
2017-08-23 12:41:22 +02:00
|
|
|
# define PWM_TIM2_CH1CFG GPIO_TIM2_CH1OUT_1
|
2015-11-01 23:09:11 +01:00
|
|
|
# else
|
|
|
|
# define PWM_TIM2_CH1CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM2_CHANNEL1 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM2_CHANNEL1 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM2_CHANNEL2
|
|
|
|
# ifdef CONFIG_STM32_TIM2_CH2OUT
|
|
|
|
# define PWM_TIM2_CH2CFG GPIO_TIM2_CH2OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM2_CH2CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM2_CHANNEL2 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM2_CHANNEL2 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM2_CHANNEL3
|
|
|
|
# ifdef CONFIG_STM32_TIM2_CH3OUT
|
|
|
|
# define PWM_TIM2_CH3CFG GPIO_TIM2_CH3OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM2_CH3CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM2_CHANNEL3 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM2_CHANNEL3 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM2_CHANNEL4
|
|
|
|
# ifdef CONFIG_STM32_TIM2_CH4OUT
|
|
|
|
# define PWM_TIM2_CH4CFG GPIO_TIM2_CH4OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM2_CH4CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM2_CHANNEL4 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM2_CHANNEL4 0
|
|
|
|
#endif
|
|
|
|
#define PWM_TIM2_NCHANNELS (PWM_TIM2_CHANNEL1 + PWM_TIM2_CHANNEL2 + \
|
|
|
|
PWM_TIM2_CHANNEL3 + PWM_TIM2_CHANNEL4)
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM3_CHANNEL1
|
|
|
|
# ifdef CONFIG_STM32_TIM3_CH1OUT
|
|
|
|
# define PWM_TIM3_CH1CFG GPIO_TIM3_CH1OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM3_CH1CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM3_CHANNEL1 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM3_CHANNEL1 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM3_CHANNEL2
|
|
|
|
# ifdef CONFIG_STM32_TIM3_CH2OUT
|
|
|
|
# define PWM_TIM3_CH2CFG GPIO_TIM3_CH2OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM3_CH2CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM3_CHANNEL2 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM3_CHANNEL2 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM3_CHANNEL3
|
|
|
|
# ifdef CONFIG_STM32_TIM3_CH3OUT
|
|
|
|
# define PWM_TIM3_CH3CFG GPIO_TIM3_CH3OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM3_CH3CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM3_CHANNEL3 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM3_CHANNEL3 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM3_CHANNEL4
|
|
|
|
# ifdef CONFIG_STM32_TIM3_CH4OUT
|
|
|
|
# define PWM_TIM3_CH4CFG GPIO_TIM3_CH4OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM3_CH4CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM3_CHANNEL4 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM3_CHANNEL4 0
|
|
|
|
#endif
|
|
|
|
#define PWM_TIM3_NCHANNELS (PWM_TIM3_CHANNEL1 + PWM_TIM3_CHANNEL2 + \
|
|
|
|
PWM_TIM3_CHANNEL3 + PWM_TIM3_CHANNEL4)
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM4_CHANNEL1
|
|
|
|
# ifdef CONFIG_STM32_TIM4_CH1OUT
|
|
|
|
# define PWM_TIM4_CH1CFG GPIO_TIM4_CH1OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM4_CH1CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM4_CHANNEL1 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM4_CHANNEL1 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM4_CHANNEL2
|
|
|
|
# ifdef CONFIG_STM32_TIM4_CH2OUT
|
|
|
|
# define PWM_TIM4_CH2CFG GPIO_TIM4_CH2OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM4_CH2CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM4_CHANNEL2 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM4_CHANNEL2 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM4_CHANNEL3
|
|
|
|
# ifdef CONFIG_STM32_TIM4_CH3OUT
|
|
|
|
# define PWM_TIM4_CH3CFG GPIO_TIM4_CH3OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM4_CH3CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM4_CHANNEL3 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM4_CHANNEL3 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM4_CHANNEL4
|
|
|
|
# ifdef CONFIG_STM32_TIM4_CH4OUT
|
|
|
|
# define PWM_TIM4_CH4CFG GPIO_TIM4_CH4OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM4_CH4CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM4_CHANNEL4 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM4_CHANNEL4 0
|
|
|
|
#endif
|
|
|
|
#define PWM_TIM4_NCHANNELS (PWM_TIM4_CHANNEL1 + PWM_TIM4_CHANNEL2 + \
|
|
|
|
PWM_TIM4_CHANNEL3 + PWM_TIM4_CHANNEL4)
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM5_CHANNEL1
|
|
|
|
# ifdef CONFIG_STM32_TIM5_CH1OUT
|
|
|
|
# define PWM_TIM5_CH1CFG GPIO_TIM5_CH1OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM5_CH1CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM5_CHANNEL1 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM5_CHANNEL1 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM5_CHANNEL2
|
|
|
|
# ifdef CONFIG_STM32_TIM5_CH2OUT
|
|
|
|
# define PWM_TIM5_CH2CFG GPIO_TIM5_CH2OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM5_CH2CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM5_CHANNEL2 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM5_CHANNEL2 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM5_CHANNEL3
|
|
|
|
# ifdef CONFIG_STM32_TIM5_CH3OUT
|
|
|
|
# define PWM_TIM5_CH3CFG GPIO_TIM5_CH3OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM5_CH3CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM5_CHANNEL3 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM5_CHANNEL3 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM5_CHANNEL4
|
|
|
|
# ifdef CONFIG_STM32_TIM5_CH4OUT
|
|
|
|
# define PWM_TIM5_CH4CFG GPIO_TIM5_CH4OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM5_CH4CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM5_CHANNEL4 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM5_CHANNEL4 0
|
|
|
|
#endif
|
|
|
|
#define PWM_TIM5_NCHANNELS (PWM_TIM5_CHANNEL1 + PWM_TIM5_CHANNEL2 + \
|
|
|
|
PWM_TIM5_CHANNEL3 + PWM_TIM5_CHANNEL4)
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM8_CHANNEL1
|
|
|
|
# ifdef CONFIG_STM32_TIM8_CH1OUT
|
|
|
|
# define PWM_TIM8_CH1CFG GPIO_TIM8_CH1OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM8_CH1CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM8_CHANNEL1 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM8_CHANNEL1 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM8_CHANNEL2
|
|
|
|
# ifdef CONFIG_STM32_TIM8_CH2OUT
|
|
|
|
# define PWM_TIM8_CH2CFG GPIO_TIM8_CH2OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM8_CH2CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM8_CHANNEL2 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM8_CHANNEL2 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM8_CHANNEL3
|
|
|
|
# ifdef CONFIG_STM32_TIM8_CH3OUT
|
|
|
|
# define PWM_TIM8_CH3CFG GPIO_TIM8_CH3OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM8_CH3CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM8_CHANNEL3 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM8_CHANNEL3 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM8_CHANNEL4
|
|
|
|
# ifdef CONFIG_STM32_TIM8_CH4OUT
|
|
|
|
# define PWM_TIM8_CH4CFG GPIO_TIM8_CH4OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM8_CH4CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM8_CHANNEL4 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM8_CHANNEL4 0
|
|
|
|
#endif
|
|
|
|
#define PWM_TIM8_NCHANNELS (PWM_TIM8_CHANNEL1 + PWM_TIM8_CHANNEL2 + \
|
|
|
|
PWM_TIM8_CHANNEL3 + PWM_TIM8_CHANNEL4)
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM9_CHANNEL1
|
|
|
|
# ifdef CONFIG_STM32_TIM9_CH1OUT
|
|
|
|
# define PWM_TIM9_CH1CFG GPIO_TIM9_CH1OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM9_CH1CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM9_CHANNEL1 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM9_CHANNEL1 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM9_CHANNEL2
|
|
|
|
# ifdef CONFIG_STM32_TIM9_CH2OUT
|
|
|
|
# define PWM_TIM9_CH2CFG GPIO_TIM9_CH2OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM9_CH2CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM9_CHANNEL2 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM9_CHANNEL2 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM9_CHANNEL3
|
|
|
|
# ifdef CONFIG_STM32_TIM9_CH3OUT
|
|
|
|
# define PWM_TIM9_CH3CFG GPIO_TIM9_CH3OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM9_CH3CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM9_CHANNEL3 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM9_CHANNEL3 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM9_CHANNEL4
|
|
|
|
# ifdef CONFIG_STM32_TIM9_CH4OUT
|
|
|
|
# define PWM_TIM9_CH4CFG GPIO_TIM9_CH4OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM9_CH4CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM9_CHANNEL4 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM9_CHANNEL4 0
|
|
|
|
#endif
|
|
|
|
#define PWM_TIM9_NCHANNELS (PWM_TIM9_CHANNEL1 + PWM_TIM9_CHANNEL2 + \
|
|
|
|
PWM_TIM9_CHANNEL3 + PWM_TIM9_CHANNEL4)
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM10_CHANNEL1
|
|
|
|
# ifdef CONFIG_STM32_TIM10_CH1OUT
|
|
|
|
# define PWM_TIM10_CH1CFG GPIO_TIM10_CH1OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM10_CH1CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM10_CHANNEL1 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM10_CHANNEL1 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM10_CHANNEL2
|
|
|
|
# ifdef CONFIG_STM32_TIM10_CH2OUT
|
|
|
|
# define PWM_TIM10_CH2CFG GPIO_TIM10_CH2OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM10_CH2CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM10_CHANNEL2 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM10_CHANNEL2 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM10_CHANNEL3
|
|
|
|
# ifdef CONFIG_STM32_TIM10_CH3OUT
|
|
|
|
# define PWM_TIM10_CH3CFG GPIO_TIM10_CH3OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM10_CH3CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM10_CHANNEL3 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM10_CHANNEL3 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM10_CHANNEL4
|
|
|
|
# ifdef CONFIG_STM32_TIM10_CH4OUT
|
|
|
|
# define PWM_TIM10_CH4CFG GPIO_TIM10_CH4OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM10_CH4CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM10_CHANNEL4 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM10_CHANNEL4 0
|
|
|
|
#endif
|
|
|
|
#define PWM_TIM10_NCHANNELS (PWM_TIM10_CHANNEL1 + PWM_TIM10_CHANNEL2 + \
|
|
|
|
PWM_TIM10_CHANNEL3 + PWM_TIM10_CHANNEL4)
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM11_CHANNEL1
|
|
|
|
# ifdef CONFIG_STM32_TIM11_CH1OUT
|
|
|
|
# define PWM_TIM11_CH1CFG GPIO_TIM11_CH1OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM11_CH1CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM11_CHANNEL1 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM11_CHANNEL1 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM11_CHANNEL2
|
|
|
|
# ifdef CONFIG_STM32_TIM11_CH2OUT
|
|
|
|
# define PWM_TIM11_CH2CFG GPIO_TIM11_CH2OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM11_CH2CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM11_CHANNEL2 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM11_CHANNEL2 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM11_CHANNEL3
|
|
|
|
# ifdef CONFIG_STM32_TIM11_CH3OUT
|
|
|
|
# define PWM_TIM11_CH3CFG GPIO_TIM11_CH3OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM11_CH3CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM11_CHANNEL3 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM11_CHANNEL3 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM11_CHANNEL4
|
|
|
|
# ifdef CONFIG_STM32_TIM11_CH4OUT
|
|
|
|
# define PWM_TIM11_CH4CFG GPIO_TIM11_CH4OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM11_CH4CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM11_CHANNEL4 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM11_CHANNEL4 0
|
|
|
|
#endif
|
|
|
|
#define PWM_TIM11_NCHANNELS (PWM_TIM11_CHANNEL1 + PWM_TIM11_CHANNEL2 + \
|
|
|
|
PWM_TIM11_CHANNEL3 + PWM_TIM11_CHANNEL4)
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM12_CHANNEL1
|
|
|
|
# ifdef CONFIG_STM32_TIM12_CH1OUT
|
|
|
|
# define PWM_TIM12_CH1CFG GPIO_TIM12_CH1OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM12_CH1CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM12_CHANNEL1 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM12_CHANNEL1 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM12_CHANNEL2
|
|
|
|
# ifdef CONFIG_STM32_TIM12_CH2OUT
|
|
|
|
# define PWM_TIM12_CH2CFG GPIO_TIM12_CH2OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM12_CH2CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM12_CHANNEL2 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM12_CHANNEL2 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM12_CHANNEL3
|
|
|
|
# ifdef CONFIG_STM32_TIM12_CH3OUT
|
|
|
|
# define PWM_TIM12_CH3CFG GPIO_TIM12_CH3OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM12_CH3CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM12_CHANNEL3 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM12_CHANNEL3 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM12_CHANNEL4
|
|
|
|
# ifdef CONFIG_STM32_TIM12_CH4OUT
|
|
|
|
# define PWM_TIM12_CH4CFG GPIO_TIM12_CH4OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM12_CH4CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM12_CHANNEL4 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM12_CHANNEL4 0
|
|
|
|
#endif
|
|
|
|
#define PWM_TIM12_NCHANNELS (PWM_TIM12_CHANNEL1 + PWM_TIM12_CHANNEL2 + \
|
|
|
|
PWM_TIM12_CHANNEL3 + PWM_TIM12_CHANNEL4)
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM13_CHANNEL1
|
|
|
|
# ifdef CONFIG_STM32_TIM13_CH1OUT
|
|
|
|
# define PWM_TIM13_CH1CFG GPIO_TIM13_CH1OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM13_CH1CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM13_CHANNEL1 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM13_CHANNEL1 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM13_CHANNEL2
|
|
|
|
# ifdef CONFIG_STM32_TIM13_CH2OUT
|
|
|
|
# define PWM_TIM13_CH2CFG GPIO_TIM13_CH2OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM13_CH2CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM13_CHANNEL2 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM13_CHANNEL2 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM13_CHANNEL3
|
|
|
|
# ifdef CONFIG_STM32_TIM13_CH3OUT
|
|
|
|
# define PWM_TIM13_CH3CFG GPIO_TIM13_CH3OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM13_CH3CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM13_CHANNEL3 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM13_CHANNEL3 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM13_CHANNEL4
|
|
|
|
# ifdef CONFIG_STM32_TIM13_CH4OUT
|
|
|
|
# define PWM_TIM13_CH4CFG GPIO_TIM13_CH4OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM13_CH4CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM13_CHANNEL4 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM13_CHANNEL4 0
|
|
|
|
#endif
|
|
|
|
#define PWM_TIM13_NCHANNELS (PWM_TIM13_CHANNEL1 + PWM_TIM13_CHANNEL2 + \
|
|
|
|
PWM_TIM13_CHANNEL3 + PWM_TIM13_CHANNEL4)
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM14_CHANNEL1
|
|
|
|
# ifdef CONFIG_STM32_TIM14_CH1OUT
|
|
|
|
# define PWM_TIM14_CH1CFG GPIO_TIM14_CH1OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM14_CH1CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM14_CHANNEL1 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM14_CHANNEL1 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM14_CHANNEL2
|
|
|
|
# ifdef CONFIG_STM32_TIM14_CH2OUT
|
|
|
|
# define PWM_TIM14_CH2CFG GPIO_TIM14_CH2OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM14_CH2CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM14_CHANNEL2 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM14_CHANNEL2 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM14_CHANNEL3
|
|
|
|
# ifdef CONFIG_STM32_TIM14_CH3OUT
|
|
|
|
# define PWM_TIM14_CH3CFG GPIO_TIM14_CH3OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM14_CH3CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM14_CHANNEL3 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM14_CHANNEL3 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM14_CHANNEL4
|
|
|
|
# ifdef CONFIG_STM32_TIM14_CH4OUT
|
|
|
|
# define PWM_TIM14_CH4CFG GPIO_TIM14_CH4OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM14_CH4CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM14_CHANNEL4 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM14_CHANNEL4 0
|
|
|
|
#endif
|
|
|
|
#define PWM_TIM14_NCHANNELS (PWM_TIM14_CHANNEL1 + PWM_TIM14_CHANNEL2 + \
|
|
|
|
PWM_TIM14_CHANNEL3 + PWM_TIM14_CHANNEL4)
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM15_CHANNEL1
|
|
|
|
# ifdef CONFIG_STM32_TIM15_CH1OUT
|
|
|
|
# define PWM_TIM15_CH1CFG GPIO_TIM15_CH1OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM15_CH1CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM15_CHANNEL1 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM15_CHANNEL1 0
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_STM32_TIM15_CHANNEL2
|
|
|
|
# ifdef CONFIG_STM32_TIM15_CH2OUT
|
|
|
|
# define PWM_TIM15_CH2CFG GPIO_TIM15_CH2OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM15_CH2CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM15_CHANNEL2 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM15_CHANNEL2 0
|
|
|
|
#endif
|
|
|
|
#define PWM_TIM15_NCHANNELS (PWM_TIM15_CHANNEL1 + PWM_TIM15_CHANNEL2)
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM16_CHANNEL1
|
|
|
|
# ifdef CONFIG_STM32_TIM16_CH1OUT
|
|
|
|
# define PWM_TIM16_CH1CFG GPIO_TIM16_CH1OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM16_CH1CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM16_CHANNEL1 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM16_CHANNEL1 0
|
|
|
|
#endif
|
|
|
|
#define PWM_TIM16_NCHANNELS PWM_TIM16_CHANNEL1
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM17_CHANNEL1
|
|
|
|
# ifdef CONFIG_STM32_TIM17_CH1OUT
|
|
|
|
# define PWM_TIM17_CH1CFG GPIO_TIM17_CH1OUT
|
|
|
|
# else
|
|
|
|
# define PWM_TIM17_CH1CFG 0
|
|
|
|
# endif
|
|
|
|
# define PWM_TIM17_CHANNEL1 1
|
|
|
|
#else
|
|
|
|
# define PWM_TIM17_CHANNEL1 0
|
|
|
|
#endif
|
|
|
|
#define PWM_TIM17_NCHANNELS PWM_TIM17_CHANNEL1
|
|
|
|
|
|
|
|
#define PWM_MAX(a, b) ((a) > (b) ? (a) : (b))
|
|
|
|
|
|
|
|
#define PWM_NCHANNELS PWM_MAX(PWM_TIM1_NCHANNELS, \
|
|
|
|
PWM_MAX(PWM_TIM2_NCHANNELS, \
|
|
|
|
PWM_MAX(PWM_TIM3_NCHANNELS, \
|
|
|
|
PWM_MAX(PWM_TIM4_NCHANNELS, \
|
|
|
|
PWM_MAX(PWM_TIM5_NCHANNELS, \
|
|
|
|
PWM_MAX(PWM_TIM8_NCHANNELS, \
|
|
|
|
PWM_MAX(PWM_TIM9_NCHANNELS, \
|
|
|
|
PWM_MAX(PWM_TIM10_NCHANNELS, \
|
|
|
|
PWM_MAX(PWM_TIM11_NCHANNELS, \
|
|
|
|
PWM_MAX(PWM_TIM12_NCHANNELS, \
|
|
|
|
PWM_MAX(PWM_TIM13_NCHANNELS, \
|
|
|
|
PWM_MAX(PWM_TIM14_NCHANNELS, \
|
|
|
|
PWM_MAX(PWM_TIM15_NCHANNELS, \
|
|
|
|
PWM_MAX(PWM_TIM16_NCHANNELS, \
|
|
|
|
PWM_TIM17_NCHANNELS))))))))))))))
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2011-12-19 20:24:09 +01:00
|
|
|
/* For each timer that is enabled for PWM usage, we need the following additional
|
|
|
|
* configuration settings:
|
|
|
|
*
|
|
|
|
* CONFIG_STM32_TIMx_CHANNEL - Specifies the timer output channel {1,..,4}
|
|
|
|
* PWM_TIMx_CHn - One of the values defined in chip/stm32*_pinmap.h. In the case
|
|
|
|
* where there are multiple pin selections, the correct setting must be provided
|
|
|
|
* in the arch/board/board.h file.
|
|
|
|
*
|
|
|
|
* NOTE: The STM32 timers are each capable of generating different signals on
|
|
|
|
* each of the four channels with different duty cycles. That capability is
|
|
|
|
* not supported by this driver: Only one output channel per timer.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM1_PWM
|
|
|
|
# if !defined(CONFIG_STM32_TIM1_CHANNEL)
|
|
|
|
# error "CONFIG_STM32_TIM1_CHANNEL must be provided"
|
|
|
|
# elif CONFIG_STM32_TIM1_CHANNEL == 1
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM1_CHANNEL1 1
|
|
|
|
# define CONFIG_STM32_TIM1_CH1MODE CONFIG_STM32_TIM1_CHMODE
|
|
|
|
# define PWM_TIM1_CH1CFG GPIO_TIM1_CH1OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM1_CHANNEL == 2
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM1_CHANNEL2 1
|
|
|
|
# define CONFIG_STM32_TIM1_CH2MODE CONFIG_STM32_TIM1_CHMODE
|
|
|
|
# define PWM_TIM1_CH2CFG GPIO_TIM1_CH2OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM1_CHANNEL == 3
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM1_CHANNEL3 1
|
|
|
|
# define CONFIG_STM32_TIM1_CH3MODE CONFIG_STM32_TIM1_CHMODE
|
|
|
|
# define PWM_TIM1_CH3CFG GPIO_TIM1_CH3OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM1_CHANNEL == 4
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM1_CHANNEL4 1
|
|
|
|
# define CONFIG_STM32_TIM1_CH4MODE CONFIG_STM32_TIM1_CHMODE
|
|
|
|
# define PWM_TIM1_CH4CFG GPIO_TIM1_CH4OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# else
|
|
|
|
# error "Unsupported value of CONFIG_STM32_TIM1_CHANNEL"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM2_PWM
|
|
|
|
# if !defined(CONFIG_STM32_TIM2_CHANNEL)
|
|
|
|
# error "CONFIG_STM32_TIM2_CHANNEL must be provided"
|
|
|
|
# elif CONFIG_STM32_TIM2_CHANNEL == 1
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM2_CHANNEL1 1
|
|
|
|
# define CONFIG_STM32_TIM2_CH1MODE CONFIG_STM32_TIM2_CHMODE
|
2017-08-23 12:41:22 +02:00
|
|
|
# define PWM_TIM2_CH1CFG GPIO_TIM2_CH1OUT_1
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM2_CHANNEL == 2
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM2_CHANNEL2 1
|
|
|
|
# define CONFIG_STM32_TIM2_CH2MODE CONFIG_STM32_TIM2_CHMODE
|
|
|
|
# define PWM_TIM2_CH2CFG GPIO_TIM2_CH2OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM2_CHANNEL == 3
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM2_CHANNEL3 1
|
|
|
|
# define CONFIG_STM32_TIM2_CH3MODE CONFIG_STM32_TIM2_CHMODE
|
|
|
|
# define PWM_TIM2_CH3CFG GPIO_TIM2_CH3OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM2_CHANNEL == 4
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM2_CHANNEL4 1
|
|
|
|
# define CONFIG_STM32_TIM2_CH4MODE CONFIG_STM32_TIM2_CHMODE
|
|
|
|
# define PWM_TIM2_CH4CFG GPIO_TIM2_CH4OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# else
|
|
|
|
# error "Unsupported value of CONFIG_STM32_TIM2_CHANNEL"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM3_PWM
|
|
|
|
# if !defined(CONFIG_STM32_TIM3_CHANNEL)
|
|
|
|
# error "CONFIG_STM32_TIM3_CHANNEL must be provided"
|
|
|
|
# elif CONFIG_STM32_TIM3_CHANNEL == 1
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM3_CHANNEL1 1
|
|
|
|
# define CONFIG_STM32_TIM3_CH1MODE CONFIG_STM32_TIM3_CHMODE
|
|
|
|
# define PWM_TIM3_CH1CFG GPIO_TIM3_CH1OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM3_CHANNEL == 2
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM3_CHANNEL2 1
|
|
|
|
# define CONFIG_STM32_TIM3_CH2MODE CONFIG_STM32_TIM3_CHMODE
|
|
|
|
# define PWM_TIM3_CH2CFG GPIO_TIM3_CH2OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM3_CHANNEL == 3
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM3_CHANNEL3 1
|
|
|
|
# define CONFIG_STM32_TIM3_CH3MODE CONFIG_STM32_TIM3_CHMODE
|
|
|
|
# define PWM_TIM3_CH3CFG GPIO_TIM3_CH3OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM3_CHANNEL == 4
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM3_CHANNEL4 1
|
|
|
|
# define CONFIG_STM32_TIM3_CH4MODE CONFIG_STM32_TIM3_CHMODE
|
|
|
|
# define PWM_TIM3_CH4CFG GPIO_TIM3_CH4OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# else
|
|
|
|
# error "Unsupported value of CONFIG_STM32_TIM3_CHANNEL"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM4_PWM
|
|
|
|
# if !defined(CONFIG_STM32_TIM4_CHANNEL)
|
|
|
|
# error "CONFIG_STM32_TIM4_CHANNEL must be provided"
|
|
|
|
# elif CONFIG_STM32_TIM4_CHANNEL == 1
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM4_CHANNEL1 1
|
|
|
|
# define CONFIG_STM32_TIM4_CH1MODE CONFIG_STM32_TIM4_CHMODE
|
|
|
|
# define PWM_TIM4_CH1CFG GPIO_TIM4_CH1OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM4_CHANNEL == 2
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM4_CHANNEL2 1
|
|
|
|
# define CONFIG_STM32_TIM4_CH2MODE CONFIG_STM32_TIM4_CHMODE
|
|
|
|
# define PWM_TIM4_CH2CFG GPIO_TIM4_CH2OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM4_CHANNEL == 3
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM4_CHANNEL3 1
|
|
|
|
# define CONFIG_STM32_TIM4_CH3MODE CONFIG_STM32_TIM4_CHMODE
|
|
|
|
# define PWM_TIM4_CH3CFG GPIO_TIM4_CH3OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM4_CHANNEL == 4
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM4_CHANNEL4 1
|
|
|
|
# define CONFIG_STM32_TIM4_CH4MODE CONFIG_STM32_TIM4_CHMODE
|
|
|
|
# define PWM_TIM4_CH4CFG GPIO_TIM4_CH4OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# else
|
|
|
|
# error "Unsupported value of CONFIG_STM32_TIM4_CHANNEL"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM5_PWM
|
|
|
|
# if !defined(CONFIG_STM32_TIM5_CHANNEL)
|
|
|
|
# error "CONFIG_STM32_TIM5_CHANNEL must be provided"
|
|
|
|
# elif CONFIG_STM32_TIM5_CHANNEL == 1
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM5_CHANNEL1 1
|
|
|
|
# define CONFIG_STM32_TIM5_CH1MODE CONFIG_STM32_TIM5_CHMODE
|
|
|
|
# define PWM_TIM5_CH1CFG GPIO_TIM5_CH1OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM5_CHANNEL == 2
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM5_CHANNEL2 1
|
|
|
|
# define CONFIG_STM32_TIM5_CH2MODE CONFIG_STM32_TIM5_CHMODE
|
|
|
|
# define PWM_TIM5_CH2CFG GPIO_TIM5_CH2OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM5_CHANNEL == 3
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM5_CHANNEL3 1
|
|
|
|
# define CONFIG_STM32_TIM5_CH3MODE CONFIG_STM32_TIM5_CHMODE
|
|
|
|
# define PWM_TIM5_CH3CFG GPIO_TIM5_CH3OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM5_CHANNEL == 4
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM5_CHANNEL4 1
|
|
|
|
# define CONFIG_STM32_TIM5_CH4MODE CONFIG_STM32_TIM5_CHMODE
|
|
|
|
# define PWM_TIM5_CH4CFG GPIO_TIM5_CH4OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# else
|
|
|
|
# error "Unsupported value of CONFIG_STM32_TIM5_CHANNEL"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM8_PWM
|
|
|
|
# if !defined(CONFIG_STM32_TIM8_CHANNEL)
|
|
|
|
# error "CONFIG_STM32_TIM8_CHANNEL must be provided"
|
|
|
|
# elif CONFIG_STM32_TIM8_CHANNEL == 1
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM8_CHANNEL1 1
|
|
|
|
# define CONFIG_STM32_TIM8_CH1MODE CONFIG_STM32_TIM8_CHMODE
|
|
|
|
# define PWM_TIM8_CH1CFG GPIO_TIM8_CH1OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM8_CHANNEL == 2
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM8_CHANNEL2 1
|
|
|
|
# define CONFIG_STM32_TIM8_CH2MODE CONFIG_STM32_TIM8_CHMODE
|
|
|
|
# define PWM_TIM8_CH2CFG GPIO_TIM8_CH2OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM8_CHANNEL == 3
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM8_CHANNEL3 1
|
|
|
|
# define CONFIG_STM32_TIM8_CH3MODE CONFIG_STM32_TIM8_CHMODE
|
|
|
|
# define PWM_TIM8_CH3CFG GPIO_TIM8_CH3OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM8_CHANNEL == 4
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM8_CHANNEL4 1
|
|
|
|
# define CONFIG_STM32_TIM8_CH4MODE CONFIG_STM32_TIM8_CHMODE
|
|
|
|
# define PWM_TIM8_CH4CFG GPIO_TIM8_CH4OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# else
|
|
|
|
# error "Unsupported value of CONFIG_STM32_TIM8_CHANNEL"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM9_PWM
|
|
|
|
# if !defined(CONFIG_STM32_TIM9_CHANNEL)
|
|
|
|
# error "CONFIG_STM32_TIM9_CHANNEL must be provided"
|
|
|
|
# elif CONFIG_STM32_TIM9_CHANNEL == 1
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM9_CHANNEL1 1
|
|
|
|
# define CONFIG_STM32_TIM9_CH1MODE CONFIG_STM32_TIM9_CHMODE
|
|
|
|
# define PWM_TIM9_CH1CFG GPIO_TIM9_CH1OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM9_CHANNEL == 2
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM9_CHANNEL2 1
|
|
|
|
# define CONFIG_STM32_TIM9_CH2MODE CONFIG_STM32_TIM9_CHMODE
|
|
|
|
# define PWM_TIM9_CH2CFG GPIO_TIM9_CH2OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM9_CHANNEL == 3
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM9_CHANNEL3 1
|
|
|
|
# define CONFIG_STM32_TIM9_CH3MODE CONFIG_STM32_TIM9_CHMODE
|
|
|
|
# define PWM_TIM9_CH3CFG GPIO_TIM9_CH3OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM9_CHANNEL == 4
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM9_CHANNEL4 1
|
|
|
|
# define CONFIG_STM32_TIM9_CH4MODE CONFIG_STM32_TIM9_CHMODE
|
|
|
|
# define PWM_TIM9_CH4CFG GPIO_TIM9_CH4OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# else
|
|
|
|
# error "Unsupported value of CONFIG_STM32_TIM9_CHANNEL"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM10_PWM
|
|
|
|
# if !defined(CONFIG_STM32_TIM10_CHANNEL)
|
|
|
|
# error "CONFIG_STM32_TIM10_CHANNEL must be provided"
|
|
|
|
# elif CONFIG_STM32_TIM10_CHANNEL == 1
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM10_CHANNEL1 1
|
|
|
|
# define CONFIG_STM32_TIM10_CH1MODE CONFIG_STM32_TIM10_CHMODE
|
|
|
|
# define PWM_TIM10_CH1CFG GPIO_TIM10_CH1OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM10_CHANNEL == 2
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM10_CHANNEL2 1
|
|
|
|
# define CONFIG_STM32_TIM10_CH2MODE CONFIG_STM32_TIM10_CHMODE
|
|
|
|
# define PWM_TIM10_CH2CFG GPIO_TIM10_CH2OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM10_CHANNEL == 3
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM10_CHANNEL3 1
|
|
|
|
# define CONFIG_STM32_TIM10_CH3MODE CONFIG_STM32_TIM10_CHMODE
|
|
|
|
# define PWM_TIM10_CH3CFG GPIO_TIM10_CH3OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM10_CHANNEL == 4
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM10_CHANNEL4 1
|
|
|
|
# define CONFIG_STM32_TIM10_CH4MODE CONFIG_STM32_TIM10_CHMODE
|
|
|
|
# define PWM_TIM10_CH4CFG GPIO_TIM10_CH4OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# else
|
|
|
|
# error "Unsupported value of CONFIG_STM32_TIM10_CHANNEL"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM11_PWM
|
|
|
|
# if !defined(CONFIG_STM32_TIM11_CHANNEL)
|
|
|
|
# error "CONFIG_STM32_TIM11_CHANNEL must be provided"
|
|
|
|
# elif CONFIG_STM32_TIM11_CHANNEL == 1
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM11_CHANNEL1 1
|
|
|
|
# define CONFIG_STM32_TIM11_CH1MODE CONFIG_STM32_TIM11_CHMODE
|
|
|
|
# define PWM_TIM11_CH1CFG GPIO_TIM11_CH1OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM11_CHANNEL == 2
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM11_CHANNEL2 1
|
|
|
|
# define CONFIG_STM32_TIM11_CH2MODE CONFIG_STM32_TIM11_CHMODE
|
|
|
|
# define PWM_TIM11_CH2CFG GPIO_TIM11_CH2OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM11_CHANNEL == 3
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM11_CHANNEL3 1
|
|
|
|
# define CONFIG_STM32_TIM11_CH3MODE CONFIG_STM32_TIM11_CHMODE
|
|
|
|
# define PWM_TIM11_CH3CFG GPIO_TIM11_CH3OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM11_CHANNEL == 4
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM11_CHANNEL4 1
|
|
|
|
# define CONFIG_STM32_TIM11_CH4MODE CONFIG_STM32_TIM11_CHMODE
|
|
|
|
# define PWM_TIM11_CH4CFG GPIO_TIM11_CH4OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# else
|
|
|
|
# error "Unsupported value of CONFIG_STM32_TIM11_CHANNEL"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM12_PWM
|
|
|
|
# if !defined(CONFIG_STM32_TIM12_CHANNEL)
|
|
|
|
# error "CONFIG_STM32_TIM12_CHANNEL must be provided"
|
|
|
|
# elif CONFIG_STM32_TIM12_CHANNEL == 1
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM12_CHANNEL1 1
|
|
|
|
# define CONFIG_STM32_TIM12_CH1MODE CONFIG_STM32_TIM12_CHMODE
|
|
|
|
# define PWM_TIM12_CH1CFG GPIO_TIM12_CH1OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM12_CHANNEL == 2
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM12_CHANNEL2 1
|
|
|
|
# define CONFIG_STM32_TIM12_CH2MODE CONFIG_STM32_TIM12_CHMODE
|
|
|
|
# define PWM_TIM12_CH2CFG GPIO_TIM12_CH2OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM12_CHANNEL == 3
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM12_CHANNEL3 1
|
|
|
|
# define CONFIG_STM32_TIM12_CH3MODE CONFIG_STM32_TIM12_CHMODE
|
|
|
|
# define PWM_TIM12_CH3CFG GPIO_TIM12_CH3OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM12_CHANNEL == 4
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM12_CHANNEL4 1
|
|
|
|
# define CONFIG_STM32_TIM12_CH4MODE CONFIG_STM32_TIM12_CHMODE
|
|
|
|
# define PWM_TIM12_CH4CFG GPIO_TIM12_CH4OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# else
|
|
|
|
# error "Unsupported value of CONFIG_STM32_TIM12_CHANNEL"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM13_PWM
|
|
|
|
# if !defined(CONFIG_STM32_TIM13_CHANNEL)
|
|
|
|
# error "CONFIG_STM32_TIM13_CHANNEL must be provided"
|
|
|
|
# elif CONFIG_STM32_TIM13_CHANNEL == 1
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM13_CHANNEL1 1
|
|
|
|
# define CONFIG_STM32_TIM13_CH1MODE CONFIG_STM32_TIM13_CHMODE
|
|
|
|
# define PWM_TIM13_CH1CFG GPIO_TIM13_CH1OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM13_CHANNEL == 2
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM13_CHANNEL2 1
|
|
|
|
# define CONFIG_STM32_TIM13_CH2MODE CONFIG_STM32_TIM13_CHMODE
|
|
|
|
# define PWM_TIM13_CH2CFG GPIO_TIM13_CH2OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM13_CHANNEL == 3
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM13_CHANNEL3 1
|
|
|
|
# define CONFIG_STM32_TIM13_CH3MODE CONFIG_STM32_TIM13_CHMODE
|
|
|
|
# define PWM_TIM13_CH3CFG GPIO_TIM13_CH3OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM13_CHANNEL == 4
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM13_CHANNEL4 1
|
|
|
|
# define CONFIG_STM32_TIM13_CH4MODE CONFIG_STM32_TIM13_CHMODE
|
|
|
|
# define PWM_TIM13_CH4CFG GPIO_TIM13_CH4OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# else
|
|
|
|
# error "Unsupported value of CONFIG_STM32_TIM13_CHANNEL"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2011-12-20 00:06:41 +01:00
|
|
|
#ifdef CONFIG_STM32_TIM14_PWM
|
2011-12-19 20:24:09 +01:00
|
|
|
# if !defined(CONFIG_STM32_TIM14_CHANNEL)
|
|
|
|
# error "CONFIG_STM32_TIM14_CHANNEL must be provided"
|
|
|
|
# elif CONFIG_STM32_TIM14_CHANNEL == 1
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM14_CHANNEL1 1
|
|
|
|
# define CONFIG_STM32_TIM14_CH1MODE CONFIG_STM32_TIM14_CHMODE
|
|
|
|
# define PWM_TIM14_CH1CFG GPIO_TIM14_CH1OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM14_CHANNEL == 2
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM14_CHANNEL2 1
|
|
|
|
# define CONFIG_STM32_TIM14_CH2MODE CONFIG_STM32_TIM14_CHMODE
|
|
|
|
# define PWM_TIM14_CH2CFG GPIO_TIM14_CH2OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM14_CHANNEL == 3
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM14_CHANNEL3 1
|
|
|
|
# define CONFIG_STM32_TIM14_CH3MODE CONFIG_STM32_TIM14_CHMODE
|
|
|
|
# define PWM_TIM14_CH3CFG GPIO_TIM14_CH3OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# elif CONFIG_STM32_TIM14_CHANNEL == 4
|
2015-11-01 23:09:11 +01:00
|
|
|
# define CONFIG_STM32_TIM14_CHANNEL4 1
|
|
|
|
# define CONFIG_STM32_TIM14_CH4MODE CONFIG_STM32_TIM14_CHMODE
|
|
|
|
# define PWM_TIM14_CH4CFG GPIO_TIM14_CH4OUT
|
2011-12-19 20:24:09 +01:00
|
|
|
# else
|
|
|
|
# error "Unsupported value of CONFIG_STM32_TIM14_CHANNEL"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2015-11-01 23:09:11 +01:00
|
|
|
#ifdef CONFIG_STM32_TIM15_PWM
|
|
|
|
# if !defined(CONFIG_STM32_TIM15_CHANNEL)
|
|
|
|
# error "CONFIG_STM32_TIM15_CHANNEL must be provided"
|
|
|
|
# elif CONFIG_STM32_TIM15_CHANNEL == 1
|
|
|
|
# define CONFIG_STM32_TIM15_CHANNEL1 1
|
|
|
|
# define CONFIG_STM32_TIM15_CH1MODE CONFIG_STM32_TIM15_CHMODE
|
|
|
|
# define PWM_TIM15_CH1CFG GPIO_TIM15_CH1OUT
|
|
|
|
# elif CONFIG_STM32_TIM15_CHANNEL == 2
|
|
|
|
# define CONFIG_STM32_TIM15_CHANNEL2 1
|
|
|
|
# define CONFIG_STM32_TIM15_CH2MODE CONFIG_STM32_TIM15_CHMODE
|
|
|
|
# define PWM_TIM15_CH2CFG GPIO_TIM15_CH2OUT
|
|
|
|
# else
|
|
|
|
# error "Unsupported value of CONFIG_STM32_TIM15_CHANNEL"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM16_PWM
|
|
|
|
# if !defined(CONFIG_STM32_TIM16_CHANNEL)
|
|
|
|
# error "CONFIG_STM32_TIM16_CHANNEL must be provided"
|
|
|
|
# elif CONFIG_STM32_TIM16_CHANNEL == 1
|
|
|
|
# define CONFIG_STM32_TIM16_CHANNEL1 1
|
|
|
|
# define CONFIG_STM32_TIM16_CH1MODE CONFIG_STM32_TIM16_CHMODE
|
|
|
|
# define PWM_TIM16_CH1CFG GPIO_TIM16_CH1OUT
|
|
|
|
# else
|
|
|
|
# error "Unsupported value of CONFIG_STM32_TIM16_CHANNEL"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_TIM17_PWM
|
|
|
|
# if !defined(CONFIG_STM32_TIM17_CHANNEL)
|
|
|
|
# error "CONFIG_STM32_TIM17_CHANNEL must be provided"
|
|
|
|
# elif CONFIG_STM32_TIM17_CHANNEL == 1
|
|
|
|
# define CONFIG_STM32_TIM17_CHANNEL1 1
|
|
|
|
# define CONFIG_STM32_TIM17_CH1MODE CONFIG_STM32_TIM17_CHMODE
|
|
|
|
# define PWM_TIM17_CH1CFG GPIO_TIM17_CH1OUT
|
|
|
|
# else
|
|
|
|
# error "Unsupported value of CONFIG_STM32_TIM17_CHANNEL"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define PWM_NCHANNELS 1
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2011-12-16 20:29:41 +01:00
|
|
|
/************************************************************************************
|
|
|
|
* Public Types
|
|
|
|
************************************************************************************/
|
|
|
|
|
|
|
|
/************************************************************************************
|
|
|
|
* Public Data
|
|
|
|
************************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
|
|
|
|
#undef EXTERN
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
#define EXTERN extern "C"
|
2015-06-13 03:00:52 +02:00
|
|
|
extern "C"
|
|
|
|
{
|
2011-12-16 20:29:41 +01:00
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/************************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
************************************************************************************/
|
|
|
|
|
|
|
|
/************************************************************************************
|
|
|
|
* Name: stm32_pwminitialize
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Initialize one timer for use with the upper_level PWM driver.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* timer - A number identifying the timer use. The number of valid timer
|
|
|
|
* IDs varies with the STM32 MCU and MCU family but is somewhere in
|
2015-11-01 23:09:11 +01:00
|
|
|
* the range of {1,..,17}.
|
2011-12-16 20:29:41 +01:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* On success, a pointer to the STM32 lower half PWM driver is returned.
|
|
|
|
* NULL is returned on any failure.
|
|
|
|
*
|
|
|
|
************************************************************************************/
|
|
|
|
|
2015-06-13 03:00:52 +02:00
|
|
|
FAR struct pwm_lowerhalf_s *stm32_pwminitialize(int timer);
|
2011-12-16 20:29:41 +01:00
|
|
|
|
|
|
|
#undef EXTERN
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __ASSEMBLY__ */
|
2011-12-19 20:24:09 +01:00
|
|
|
#endif /* CONFIG_STM32_TIMx_PWM */
|
2011-12-20 00:06:41 +01:00
|
|
|
#endif /* __ARCH_ARM_SRC_STM32_STM32_PWM_H */
|