Merged in paulpatience/nuttx-arch/stm32_pwm (pull request #28)

This commit is contained in:
Gregory Nutt 2015-11-01 16:51:32 -06:00
commit 96cee3709a
4 changed files with 3350 additions and 294 deletions

File diff suppressed because it is too large Load Diff

View File

@ -698,6 +698,10 @@
#define ATIM_CCMR_MODE_OCREFHI (5) /* 101: OCxREF forced high */
#define ATIM_CCMR_MODE_PWM1 (6) /* 110: PWM mode 1 */
#define ATIM_CCMR_MODE_PWM2 (7) /* 111: PWM mode 2 */
#define ATIM_CCMR_MODE_COMBINED1 (12) /* 1100: Combined PWM mode 1 */
#define ATIM_CCMR_MODE_COMBINED2 (13) /* 1101: Combined PWM mode 2 */
#define ATIM_CCMR_MODE_ASYMMETRIC1 (14) /* 1110: Asymmetric PWM mode 1 */
#define ATIM_CCMR_MODE_ASYMMETRIC2 (15) /* 1111: Asymmetric PWM mode 2 */
/* Capture/compare mode register 1 -- Input capture mode */
@ -764,8 +768,8 @@
#define ATIM_CCMR2_OC4CE (1 << 15) /* Bit 15: Output Compare 4 Clear Enable */
#ifdef CONFIG_STM32_STM32F30XX
# define ATIM_CCMR1_OC3M 1 << 16) /* Bit 16: Output Compare 3 mode - bit 3 */
# define ATIM_CCMR1_OC4M 1 << 24) /* Bit 24: Output Compare 4 mode - bit 3 */
# define ATIM_CCMR2_OC3M (1 << 16) /* Bit 16: Output Compare 3 mode - bit 3 */
# define ATIM_CCMR2_OC4M (1 << 24) /* Bit 24: Output Compare 4 mode - bit 3 */
#endif
/* Capture/compare mode register 2 - Input Capture Mode */

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,9 @@
* arch/arm/src/stm32/stm32_pwm.h
*
* Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Copyright (C) 2015 Omni Hoverboards Inc. All rights reserved.
* Authors: Gregory Nutt <gnutt@nuttx.org>
* Paul Alexander Patience <paul-a.patience@polymtl.ca>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -96,6 +98,15 @@
#ifndef CONFIG_STM32_TIM14
# undef CONFIG_STM32_TIM14_PWM
#endif
#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
/* The basic timers (timer 6 and 7) are not capable of generating output pulses */
@ -109,11 +120,597 @@
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) || \
defined(CONFIG_STM32_TIM13_PWM) || defined(CONFIG_STM32_TIM14_PWM)
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)
#include <arch/board/board.h>
#include "chip/stm32_tim.h"
#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
# define PWM_TIM2_CH1CFG GPIO_TIM2_CH1OUT
# 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
/* For each timer that is enabled for PWM usage, we need the following additional
* configuration settings:
*
@ -131,13 +728,21 @@
# if !defined(CONFIG_STM32_TIM1_CHANNEL)
# error "CONFIG_STM32_TIM1_CHANNEL must be provided"
# elif CONFIG_STM32_TIM1_CHANNEL == 1
# define PWM_TIM1_PINCFG GPIO_TIM1_CH1OUT
# define CONFIG_STM32_TIM1_CHANNEL1 1
# define CONFIG_STM32_TIM1_CH1MODE CONFIG_STM32_TIM1_CHMODE
# define PWM_TIM1_CH1CFG GPIO_TIM1_CH1OUT
# elif CONFIG_STM32_TIM1_CHANNEL == 2
# define PWM_TIM1_PINCFG GPIO_TIM1_CH2OUT
# define CONFIG_STM32_TIM1_CHANNEL2 1
# define CONFIG_STM32_TIM1_CH2MODE CONFIG_STM32_TIM1_CHMODE
# define PWM_TIM1_CH2CFG GPIO_TIM1_CH2OUT
# elif CONFIG_STM32_TIM1_CHANNEL == 3
# define PWM_TIM1_PINCFG GPIO_TIM1_CH3OUT
# define CONFIG_STM32_TIM1_CHANNEL3 1
# define CONFIG_STM32_TIM1_CH3MODE CONFIG_STM32_TIM1_CHMODE
# define PWM_TIM1_CH3CFG GPIO_TIM1_CH3OUT
# elif CONFIG_STM32_TIM1_CHANNEL == 4
# define PWM_TIM1_PINCFG GPIO_TIM1_CH4OUT
# define CONFIG_STM32_TIM1_CHANNEL4 1
# define CONFIG_STM32_TIM1_CH4MODE CONFIG_STM32_TIM1_CHMODE
# define PWM_TIM1_CH4CFG GPIO_TIM1_CH4OUT
# else
# error "Unsupported value of CONFIG_STM32_TIM1_CHANNEL"
# endif
@ -147,13 +752,21 @@
# if !defined(CONFIG_STM32_TIM2_CHANNEL)
# error "CONFIG_STM32_TIM2_CHANNEL must be provided"
# elif CONFIG_STM32_TIM2_CHANNEL == 1
# define PWM_TIM2_PINCFG GPIO_TIM2_CH1OUT
# define CONFIG_STM32_TIM2_CHANNEL1 1
# define CONFIG_STM32_TIM2_CH1MODE CONFIG_STM32_TIM2_CHMODE
# define PWM_TIM2_CH1CFG GPIO_TIM2_CH1OUT
# elif CONFIG_STM32_TIM2_CHANNEL == 2
# define PWM_TIM2_PINCFG GPIO_TIM2_CH2OUT
# define CONFIG_STM32_TIM2_CHANNEL2 1
# define CONFIG_STM32_TIM2_CH2MODE CONFIG_STM32_TIM2_CHMODE
# define PWM_TIM2_CH2CFG GPIO_TIM2_CH2OUT
# elif CONFIG_STM32_TIM2_CHANNEL == 3
# define PWM_TIM2_PINCFG GPIO_TIM2_CH3OUT
# define CONFIG_STM32_TIM2_CHANNEL3 1
# define CONFIG_STM32_TIM2_CH3MODE CONFIG_STM32_TIM2_CHMODE
# define PWM_TIM2_CH3CFG GPIO_TIM2_CH3OUT
# elif CONFIG_STM32_TIM2_CHANNEL == 4
# define PWM_TIM2_PINCFG GPIO_TIM2_CH4OUT
# define CONFIG_STM32_TIM2_CHANNEL4 1
# define CONFIG_STM32_TIM2_CH4MODE CONFIG_STM32_TIM2_CHMODE
# define PWM_TIM2_CH4CFG GPIO_TIM2_CH4OUT
# else
# error "Unsupported value of CONFIG_STM32_TIM2_CHANNEL"
# endif
@ -163,13 +776,21 @@
# if !defined(CONFIG_STM32_TIM3_CHANNEL)
# error "CONFIG_STM32_TIM3_CHANNEL must be provided"
# elif CONFIG_STM32_TIM3_CHANNEL == 1
# define PWM_TIM3_PINCFG GPIO_TIM3_CH1OUT
# define CONFIG_STM32_TIM3_CHANNEL1 1
# define CONFIG_STM32_TIM3_CH1MODE CONFIG_STM32_TIM3_CHMODE
# define PWM_TIM3_CH1CFG GPIO_TIM3_CH1OUT
# elif CONFIG_STM32_TIM3_CHANNEL == 2
# define PWM_TIM3_PINCFG GPIO_TIM3_CH2OUT
# define CONFIG_STM32_TIM3_CHANNEL2 1
# define CONFIG_STM32_TIM3_CH2MODE CONFIG_STM32_TIM3_CHMODE
# define PWM_TIM3_CH2CFG GPIO_TIM3_CH2OUT
# elif CONFIG_STM32_TIM3_CHANNEL == 3
# define PWM_TIM3_PINCFG GPIO_TIM3_CH3OUT
# define CONFIG_STM32_TIM3_CHANNEL3 1
# define CONFIG_STM32_TIM3_CH3MODE CONFIG_STM32_TIM3_CHMODE
# define PWM_TIM3_CH3CFG GPIO_TIM3_CH3OUT
# elif CONFIG_STM32_TIM3_CHANNEL == 4
# define PWM_TIM3_PINCFG GPIO_TIM3_CH4OUT
# define CONFIG_STM32_TIM3_CHANNEL4 1
# define CONFIG_STM32_TIM3_CH4MODE CONFIG_STM32_TIM3_CHMODE
# define PWM_TIM3_CH4CFG GPIO_TIM3_CH4OUT
# else
# error "Unsupported value of CONFIG_STM32_TIM3_CHANNEL"
# endif
@ -179,13 +800,21 @@
# if !defined(CONFIG_STM32_TIM4_CHANNEL)
# error "CONFIG_STM32_TIM4_CHANNEL must be provided"
# elif CONFIG_STM32_TIM4_CHANNEL == 1
# define PWM_TIM4_PINCFG GPIO_TIM4_CH1OUT
# define CONFIG_STM32_TIM4_CHANNEL1 1
# define CONFIG_STM32_TIM4_CH1MODE CONFIG_STM32_TIM4_CHMODE
# define PWM_TIM4_CH1CFG GPIO_TIM4_CH1OUT
# elif CONFIG_STM32_TIM4_CHANNEL == 2
# define PWM_TIM4_PINCFG GPIO_TIM4_CH2OUT
# define CONFIG_STM32_TIM4_CHANNEL2 1
# define CONFIG_STM32_TIM4_CH2MODE CONFIG_STM32_TIM4_CHMODE
# define PWM_TIM4_CH2CFG GPIO_TIM4_CH2OUT
# elif CONFIG_STM32_TIM4_CHANNEL == 3
# define PWM_TIM4_PINCFG GPIO_TIM4_CH3OUT
# define CONFIG_STM32_TIM4_CHANNEL3 1
# define CONFIG_STM32_TIM4_CH3MODE CONFIG_STM32_TIM4_CHMODE
# define PWM_TIM4_CH3CFG GPIO_TIM4_CH3OUT
# elif CONFIG_STM32_TIM4_CHANNEL == 4
# define PWM_TIM4_PINCFG GPIO_TIM4_CH4OUT
# define CONFIG_STM32_TIM4_CHANNEL4 1
# define CONFIG_STM32_TIM4_CH4MODE CONFIG_STM32_TIM4_CHMODE
# define PWM_TIM4_CH4CFG GPIO_TIM4_CH4OUT
# else
# error "Unsupported value of CONFIG_STM32_TIM4_CHANNEL"
# endif
@ -195,13 +824,21 @@
# if !defined(CONFIG_STM32_TIM5_CHANNEL)
# error "CONFIG_STM32_TIM5_CHANNEL must be provided"
# elif CONFIG_STM32_TIM5_CHANNEL == 1
# define PWM_TIM5_PINCFG GPIO_TIM5_CH1OUT
# define CONFIG_STM32_TIM5_CHANNEL1 1
# define CONFIG_STM32_TIM5_CH1MODE CONFIG_STM32_TIM5_CHMODE
# define PWM_TIM5_CH1CFG GPIO_TIM5_CH1OUT
# elif CONFIG_STM32_TIM5_CHANNEL == 2
# define PWM_TIM5_PINCFG GPIO_TIM5_CH2OUT
# define CONFIG_STM32_TIM5_CHANNEL2 1
# define CONFIG_STM32_TIM5_CH2MODE CONFIG_STM32_TIM5_CHMODE
# define PWM_TIM5_CH2CFG GPIO_TIM5_CH2OUT
# elif CONFIG_STM32_TIM5_CHANNEL == 3
# define PWM_TIM5_PINCFG GPIO_TIM5_CH3OUT
# define CONFIG_STM32_TIM5_CHANNEL3 1
# define CONFIG_STM32_TIM5_CH3MODE CONFIG_STM32_TIM5_CHMODE
# define PWM_TIM5_CH3CFG GPIO_TIM5_CH3OUT
# elif CONFIG_STM32_TIM5_CHANNEL == 4
# define PWM_TIM5_PINCFG GPIO_TIM5_CH4OUT
# define CONFIG_STM32_TIM5_CHANNEL4 1
# define CONFIG_STM32_TIM5_CH4MODE CONFIG_STM32_TIM5_CHMODE
# define PWM_TIM5_CH4CFG GPIO_TIM5_CH4OUT
# else
# error "Unsupported value of CONFIG_STM32_TIM5_CHANNEL"
# endif
@ -211,13 +848,21 @@
# if !defined(CONFIG_STM32_TIM8_CHANNEL)
# error "CONFIG_STM32_TIM8_CHANNEL must be provided"
# elif CONFIG_STM32_TIM8_CHANNEL == 1
# define PWM_TIM8_PINCFG GPIO_TIM8_CH1OUT
# define CONFIG_STM32_TIM8_CHANNEL1 1
# define CONFIG_STM32_TIM8_CH1MODE CONFIG_STM32_TIM8_CHMODE
# define PWM_TIM8_CH1CFG GPIO_TIM8_CH1OUT
# elif CONFIG_STM32_TIM8_CHANNEL == 2
# define PWM_TIM8_PINCFG GPIO_TIM8_CH2OUT
# define CONFIG_STM32_TIM8_CHANNEL2 1
# define CONFIG_STM32_TIM8_CH2MODE CONFIG_STM32_TIM8_CHMODE
# define PWM_TIM8_CH2CFG GPIO_TIM8_CH2OUT
# elif CONFIG_STM32_TIM8_CHANNEL == 3
# define PWM_TIM8_PINCFG GPIO_TIM8_CH3OUT
# define CONFIG_STM32_TIM8_CHANNEL3 1
# define CONFIG_STM32_TIM8_CH3MODE CONFIG_STM32_TIM8_CHMODE
# define PWM_TIM8_CH3CFG GPIO_TIM8_CH3OUT
# elif CONFIG_STM32_TIM8_CHANNEL == 4
# define PWM_TIM8_PINCFG GPIO_TIM8_CH4OUT
# define CONFIG_STM32_TIM8_CHANNEL4 1
# define CONFIG_STM32_TIM8_CH4MODE CONFIG_STM32_TIM8_CHMODE
# define PWM_TIM8_CH4CFG GPIO_TIM8_CH4OUT
# else
# error "Unsupported value of CONFIG_STM32_TIM8_CHANNEL"
# endif
@ -227,13 +872,21 @@
# if !defined(CONFIG_STM32_TIM9_CHANNEL)
# error "CONFIG_STM32_TIM9_CHANNEL must be provided"
# elif CONFIG_STM32_TIM9_CHANNEL == 1
# define PWM_TIM9_PINCFG GPIO_TIM9_CH1OUT
# define CONFIG_STM32_TIM9_CHANNEL1 1
# define CONFIG_STM32_TIM9_CH1MODE CONFIG_STM32_TIM9_CHMODE
# define PWM_TIM9_CH1CFG GPIO_TIM9_CH1OUT
# elif CONFIG_STM32_TIM9_CHANNEL == 2
# define PWM_TIM9_PINCFG GPIO_TIM9_CH2OUT
# define CONFIG_STM32_TIM9_CHANNEL2 1
# define CONFIG_STM32_TIM9_CH2MODE CONFIG_STM32_TIM9_CHMODE
# define PWM_TIM9_CH2CFG GPIO_TIM9_CH2OUT
# elif CONFIG_STM32_TIM9_CHANNEL == 3
# define PWM_TIM9_PINCFG GPIO_TIM9_CH3OUT
# define CONFIG_STM32_TIM9_CHANNEL3 1
# define CONFIG_STM32_TIM9_CH3MODE CONFIG_STM32_TIM9_CHMODE
# define PWM_TIM9_CH3CFG GPIO_TIM9_CH3OUT
# elif CONFIG_STM32_TIM9_CHANNEL == 4
# define PWM_TIM9_PINCFG GPIO_TIM9_CH4OUT
# define CONFIG_STM32_TIM9_CHANNEL4 1
# define CONFIG_STM32_TIM9_CH4MODE CONFIG_STM32_TIM9_CHMODE
# define PWM_TIM9_CH4CFG GPIO_TIM9_CH4OUT
# else
# error "Unsupported value of CONFIG_STM32_TIM9_CHANNEL"
# endif
@ -243,13 +896,21 @@
# if !defined(CONFIG_STM32_TIM10_CHANNEL)
# error "CONFIG_STM32_TIM10_CHANNEL must be provided"
# elif CONFIG_STM32_TIM10_CHANNEL == 1
# define PWM_TIM10_PINCFG GPIO_TIM10_CH1OUT
# define CONFIG_STM32_TIM10_CHANNEL1 1
# define CONFIG_STM32_TIM10_CH1MODE CONFIG_STM32_TIM10_CHMODE
# define PWM_TIM10_CH1CFG GPIO_TIM10_CH1OUT
# elif CONFIG_STM32_TIM10_CHANNEL == 2
# define PWM_TIM10_PINCFG GPIO_TIM10_CH2OUT
# define CONFIG_STM32_TIM10_CHANNEL2 1
# define CONFIG_STM32_TIM10_CH2MODE CONFIG_STM32_TIM10_CHMODE
# define PWM_TIM10_CH2CFG GPIO_TIM10_CH2OUT
# elif CONFIG_STM32_TIM10_CHANNEL == 3
# define PWM_TIM10_PINCFG GPIO_TIM10_CH3OUT
# define CONFIG_STM32_TIM10_CHANNEL3 1
# define CONFIG_STM32_TIM10_CH3MODE CONFIG_STM32_TIM10_CHMODE
# define PWM_TIM10_CH3CFG GPIO_TIM10_CH3OUT
# elif CONFIG_STM32_TIM10_CHANNEL == 4
# define PWM_TIM10_PINCFG GPIO_TIM10_CH4OUT
# define CONFIG_STM32_TIM10_CHANNEL4 1
# define CONFIG_STM32_TIM10_CH4MODE CONFIG_STM32_TIM10_CHMODE
# define PWM_TIM10_CH4CFG GPIO_TIM10_CH4OUT
# else
# error "Unsupported value of CONFIG_STM32_TIM10_CHANNEL"
# endif
@ -259,13 +920,21 @@
# if !defined(CONFIG_STM32_TIM11_CHANNEL)
# error "CONFIG_STM32_TIM11_CHANNEL must be provided"
# elif CONFIG_STM32_TIM11_CHANNEL == 1
# define PWM_TIM11_PINCFG GPIO_TIM11_CH1OUT
# define CONFIG_STM32_TIM11_CHANNEL1 1
# define CONFIG_STM32_TIM11_CH1MODE CONFIG_STM32_TIM11_CHMODE
# define PWM_TIM11_CH1CFG GPIO_TIM11_CH1OUT
# elif CONFIG_STM32_TIM11_CHANNEL == 2
# define PWM_TIM11_PINCFG GPIO_TIM11_CH2OUT
# define CONFIG_STM32_TIM11_CHANNEL2 1
# define CONFIG_STM32_TIM11_CH2MODE CONFIG_STM32_TIM11_CHMODE
# define PWM_TIM11_CH2CFG GPIO_TIM11_CH2OUT
# elif CONFIG_STM32_TIM11_CHANNEL == 3
# define PWM_TIM11_PINCFG GPIO_TIM11_CH3OUT
# define CONFIG_STM32_TIM11_CHANNEL3 1
# define CONFIG_STM32_TIM11_CH3MODE CONFIG_STM32_TIM11_CHMODE
# define PWM_TIM11_CH3CFG GPIO_TIM11_CH3OUT
# elif CONFIG_STM32_TIM11_CHANNEL == 4
# define PWM_TIM11_PINCFG GPIO_TIM11_CH4OUT
# define CONFIG_STM32_TIM11_CHANNEL4 1
# define CONFIG_STM32_TIM11_CH4MODE CONFIG_STM32_TIM11_CHMODE
# define PWM_TIM11_CH4CFG GPIO_TIM11_CH4OUT
# else
# error "Unsupported value of CONFIG_STM32_TIM11_CHANNEL"
# endif
@ -275,13 +944,21 @@
# if !defined(CONFIG_STM32_TIM12_CHANNEL)
# error "CONFIG_STM32_TIM12_CHANNEL must be provided"
# elif CONFIG_STM32_TIM12_CHANNEL == 1
# define PWM_TIM12_PINCFG GPIO_TIM12_CH1OUT
# define CONFIG_STM32_TIM12_CHANNEL1 1
# define CONFIG_STM32_TIM12_CH1MODE CONFIG_STM32_TIM12_CHMODE
# define PWM_TIM12_CH1CFG GPIO_TIM12_CH1OUT
# elif CONFIG_STM32_TIM12_CHANNEL == 2
# define PWM_TIM12_PINCFG GPIO_TIM12_CH2OUT
# define CONFIG_STM32_TIM12_CHANNEL2 1
# define CONFIG_STM32_TIM12_CH2MODE CONFIG_STM32_TIM12_CHMODE
# define PWM_TIM12_CH2CFG GPIO_TIM12_CH2OUT
# elif CONFIG_STM32_TIM12_CHANNEL == 3
# define PWM_TIM12_PINCFG GPIO_TIM12_CH3OUT
# define CONFIG_STM32_TIM12_CHANNEL3 1
# define CONFIG_STM32_TIM12_CH3MODE CONFIG_STM32_TIM12_CHMODE
# define PWM_TIM12_CH3CFG GPIO_TIM12_CH3OUT
# elif CONFIG_STM32_TIM12_CHANNEL == 4
# define PWM_TIM12_PINCFG GPIO_TIM12_CH4OUT
# define CONFIG_STM32_TIM12_CHANNEL4 1
# define CONFIG_STM32_TIM12_CH4MODE CONFIG_STM32_TIM12_CHMODE
# define PWM_TIM12_CH4CFG GPIO_TIM12_CH4OUT
# else
# error "Unsupported value of CONFIG_STM32_TIM12_CHANNEL"
# endif
@ -291,13 +968,21 @@
# if !defined(CONFIG_STM32_TIM13_CHANNEL)
# error "CONFIG_STM32_TIM13_CHANNEL must be provided"
# elif CONFIG_STM32_TIM13_CHANNEL == 1
# define PWM_TIM13_PINCFG GPIO_TIM13_CH1OUT
# define CONFIG_STM32_TIM13_CHANNEL1 1
# define CONFIG_STM32_TIM13_CH1MODE CONFIG_STM32_TIM13_CHMODE
# define PWM_TIM13_CH1CFG GPIO_TIM13_CH1OUT
# elif CONFIG_STM32_TIM13_CHANNEL == 2
# define PWM_TIM13_PINCFG GPIO_TIM13_CH2OUT
# define CONFIG_STM32_TIM13_CHANNEL2 1
# define CONFIG_STM32_TIM13_CH2MODE CONFIG_STM32_TIM13_CHMODE
# define PWM_TIM13_CH2CFG GPIO_TIM13_CH2OUT
# elif CONFIG_STM32_TIM13_CHANNEL == 3
# define PWM_TIM13_PINCFG GPIO_TIM13_CH3OUT
# define CONFIG_STM32_TIM13_CHANNEL3 1
# define CONFIG_STM32_TIM13_CH3MODE CONFIG_STM32_TIM13_CHMODE
# define PWM_TIM13_CH3CFG GPIO_TIM13_CH3OUT
# elif CONFIG_STM32_TIM13_CHANNEL == 4
# define PWM_TIM13_PINCFG GPIO_TIM13_CH4OUT
# define CONFIG_STM32_TIM13_CHANNEL4 1
# define CONFIG_STM32_TIM13_CH4MODE CONFIG_STM32_TIM13_CHMODE
# define PWM_TIM13_CH4CFG GPIO_TIM13_CH4OUT
# else
# error "Unsupported value of CONFIG_STM32_TIM13_CHANNEL"
# endif
@ -307,18 +992,70 @@
# if !defined(CONFIG_STM32_TIM14_CHANNEL)
# error "CONFIG_STM32_TIM14_CHANNEL must be provided"
# elif CONFIG_STM32_TIM14_CHANNEL == 1
# define PWM_TIM14_PINCFG GPIO_TIM14_CH1OUT
# define CONFIG_STM32_TIM14_CHANNEL1 1
# define CONFIG_STM32_TIM14_CH1MODE CONFIG_STM32_TIM14_CHMODE
# define PWM_TIM14_CH1CFG GPIO_TIM14_CH1OUT
# elif CONFIG_STM32_TIM14_CHANNEL == 2
# define PWM_TIM14_PINCFG GPIO_TIM14_CH2OUT
# define CONFIG_STM32_TIM14_CHANNEL2 1
# define CONFIG_STM32_TIM14_CH2MODE CONFIG_STM32_TIM14_CHMODE
# define PWM_TIM14_CH2CFG GPIO_TIM14_CH2OUT
# elif CONFIG_STM32_TIM14_CHANNEL == 3
# define PWM_TIM14_PINCFG GPIO_TIM14_CH3OUT
# define CONFIG_STM32_TIM14_CHANNEL3 1
# define CONFIG_STM32_TIM14_CH3MODE CONFIG_STM32_TIM14_CHMODE
# define PWM_TIM14_CH3CFG GPIO_TIM14_CH3OUT
# elif CONFIG_STM32_TIM14_CHANNEL == 4
# define PWM_TIM14_PINCFG GPIO_TIM14_CH4OUT
# define CONFIG_STM32_TIM14_CHANNEL4 1
# define CONFIG_STM32_TIM14_CH4MODE CONFIG_STM32_TIM14_CHMODE
# define PWM_TIM14_CH4CFG GPIO_TIM14_CH4OUT
# else
# error "Unsupported value of CONFIG_STM32_TIM14_CHANNEL"
# endif
#endif
#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
/************************************************************************************
* Public Types
************************************************************************************/
@ -351,7 +1088,7 @@ extern "C"
* 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
* the range of {1,..,14}.
* the range of {1,..,17}.
*
* Returned Value:
* On success, a pointer to the STM32 lower half PWM driver is returned.