From 8f47aee78b3e33a39d01ef626bfd4161b2cfe699 Mon Sep 17 00:00:00 2001 From: Hauke Petersen <hauke.petersen@fu-berlin.de> Date: Tue, 17 Jan 2017 14:08:39 +0100 Subject: [PATCH] boards/stm32-based: adapted PWM configuration --- boards/msbiot/include/periph_conf.h | 6 +++-- boards/nucleo-f207/Makefile.features | 1 + boards/nucleo-f207/include/periph_conf.h | 7 +++--- boards/nucleo-f303/include/periph_conf.h | 7 +++--- boards/nucleo-f334/include/periph_conf.h | 7 +++--- boards/nucleo-f446/include/periph_conf.h | 21 +++++++++------- boards/stm32f3discovery/include/periph_conf.h | 14 ++++++----- boards/stm32f4discovery/include/periph_conf.h | 24 +++++++++---------- 8 files changed, 49 insertions(+), 38 deletions(-) diff --git a/boards/msbiot/include/periph_conf.h b/boards/msbiot/include/periph_conf.h index 5c998abf61..c7d23ebf08 100644 --- a/boards/msbiot/include/periph_conf.h +++ b/boards/msbiot/include/periph_conf.h @@ -83,9 +83,11 @@ static const pwm_conf_t pwm_config[] = { { .dev = TIM11, .rcc_mask = RCC_APB2ENR_TIM11EN, - .pins = { GPIO_PIN(PORT_B, 9), GPIO_UNDEF, GPIO_UNDEF, GPIO_UNDEF }, + .chan = { { .pin = GPIO_PIN(PORT_B, 9), .cc_chan = 0 }, + { .pin = GPIO_UNDEF, .cc_chan = 0 }, + { .pin = GPIO_UNDEF, .cc_chan = 0 }, + { .pin = GPIO_UNDEF, .cc_chan = 0 } }, .af = GPIO_AF3, - .chan = 1, .bus = APB2 } }; diff --git a/boards/nucleo-f207/Makefile.features b/boards/nucleo-f207/Makefile.features index b53a6d772e..0458cbfedf 100644 --- a/boards/nucleo-f207/Makefile.features +++ b/boards/nucleo-f207/Makefile.features @@ -2,6 +2,7 @@ FEATURES_PROVIDED += periph_cpuid FEATURES_PROVIDED += periph_gpio FEATURES_PROVIDED += periph_i2c +FEATURES_PROVIDED += periph_pwm FEATURES_PROVIDED += periph_rtc FEATURES_PROVIDED += periph_spi FEATURES_PROVIDED += periph_timer diff --git a/boards/nucleo-f207/include/periph_conf.h b/boards/nucleo-f207/include/periph_conf.h index 056872f9a5..cfe40c3223 100644 --- a/boards/nucleo-f207/include/periph_conf.h +++ b/boards/nucleo-f207/include/periph_conf.h @@ -58,10 +58,11 @@ static const pwm_conf_t pwm_config[] = { { .dev = TIM3, .rcc_mask = RCC_APB1ENR_TIM3EN, - .pins = { GPIO_PIN(PORT_C, 6), GPIO_PIN(PORT_C, 7), - GPIO_PIN(PORT_C, 8), GPIO_PIN(PORT_C, 9) }, + .chan = { { .pin = GPIO_PIN(PORT_C, 6), .cc_chan = 0 }, + { .pin = GPIO_PIN(PORT_C, 7), .cc_chan = 1 }, + { .pin = GPIO_PIN(PORT_C, 8), .cc_chan = 2 }, + { .pin = GPIO_PIN(PORT_C, 9), .cc_chan = 3 } }, .af = GPIO_AF2, - .chan = 4, .bus = APB1 } }; diff --git a/boards/nucleo-f303/include/periph_conf.h b/boards/nucleo-f303/include/periph_conf.h index 72cf1cacb1..be66076729 100755 --- a/boards/nucleo-f303/include/periph_conf.h +++ b/boards/nucleo-f303/include/periph_conf.h @@ -125,10 +125,11 @@ static const pwm_conf_t pwm_config[] = { { .dev = TIM3, .rcc_mask = RCC_APB1ENR_TIM3EN, - .pins = { GPIO_PIN(PORT_C, 6), GPIO_PIN(PORT_C, 7), - GPIO_PIN(PORT_C, 8), GPIO_PIN(PORT_C, 9) }, + .chan = { { .pin = GPIO_PIN(PORT_C, 6), .cc_chan = 0 }, + { .pin = GPIO_PIN(PORT_C, 7), .cc_chan = 1 }, + { .pin = GPIO_PIN(PORT_C, 8), .cc_chan = 2 }, + { .pin = GPIO_PIN(PORT_C, 9), .cc_chan = 3 } }, .af = GPIO_AF2, - .chan = 4, .bus = APB1 } }; diff --git a/boards/nucleo-f334/include/periph_conf.h b/boards/nucleo-f334/include/periph_conf.h index 99bf7e87aa..e2cf5a9335 100644 --- a/boards/nucleo-f334/include/periph_conf.h +++ b/boards/nucleo-f334/include/periph_conf.h @@ -109,10 +109,11 @@ static const pwm_conf_t pwm_config[] = { { .dev = TIM3, .rcc_mask = RCC_APB1ENR_TIM3EN, - .pins = { GPIO_PIN(PORT_C, 6), GPIO_PIN(PORT_C, 7), - GPIO_PIN(PORT_C, 8), GPIO_PIN(PORT_C, 9) }, + .chan = { { .pin = GPIO_PIN(PORT_C, 6), .cc_chan = 0 }, + { .pin = GPIO_PIN(PORT_C, 7), .cc_chan = 1 }, + { .pin = GPIO_PIN(PORT_C, 8), .cc_chan = 2 }, + { .pin = GPIO_PIN(PORT_C, 9), .cc_chan = 3 } }, .af = GPIO_AF2, - .chan = 4, .bus = APB1 } }; diff --git a/boards/nucleo-f446/include/periph_conf.h b/boards/nucleo-f446/include/periph_conf.h index 55f6418dd0..31208df865 100644 --- a/boards/nucleo-f446/include/periph_conf.h +++ b/boards/nucleo-f446/include/periph_conf.h @@ -134,28 +134,31 @@ static const pwm_conf_t pwm_config[] = { { .dev = TIM2, .rcc_mask = RCC_APB1ENR_TIM2EN, - .pins = { GPIO_PIN(PORT_A, 15), GPIO_PIN(PORT_B, 3), - GPIO_PIN(PORT_B, 10), GPIO_PIN(PORT_B, 2) }, + .chan = { { .pin = GPIO_PIN(PORT_A, 15), .cc_chan = 0}, + { .pin = GPIO_PIN(PORT_B, 3), .cc_chan = 1}, + { .pin = GPIO_PIN(PORT_B, 10), .cc_chan = 2}, + { .pin = GPIO_PIN(PORT_B, 2), .cc_chan = 3} }, .af = GPIO_AF1, - .chan = 4, .bus = APB1 }, { .dev = TIM3, .rcc_mask = RCC_APB1ENR_TIM3EN, - .pins = { GPIO_PIN(PORT_B, 4), GPIO_UNDEF, - GPIO_UNDEF, GPIO_UNDEF }, + .chan = { { .pin = GPIO_PIN(PORT_B, 4), .cc_chan = 0 }, + { .pin = GPIO_UNDEF, .cc_chan = 0 }, + { .pin = GPIO_UNDEF, .cc_chan = 0 }, + { .pin = GPIO_UNDEF, .cc_chan = 0 } }, .af = GPIO_AF2, - .chan = 1, .bus = APB1 }, { .dev = TIM8, .rcc_mask = RCC_APB2ENR_TIM8EN, - .pins = { GPIO_PIN(PORT_C, 6), GPIO_PIN(PORT_C, 7), - GPIO_PIN(PORT_C, 8), GPIO_PIN(PORT_C, 9) }, + .chan = { { .pin = GPIO_PIN(PORT_C, 6), .cc_chan = 0}, + { .pin = GPIO_PIN(PORT_C, 7), .cc_chan = 1}, + { .pin = GPIO_PIN(PORT_C, 8), .cc_chan = 2}, + { .pin = GPIO_PIN(PORT_C, 9), .cc_chan = 3} }, .af = GPIO_AF3, - .chan = 4, .bus = APB2 }, }; diff --git a/boards/stm32f3discovery/include/periph_conf.h b/boards/stm32f3discovery/include/periph_conf.h index 391ff7f3af..28c703c1b6 100644 --- a/boards/stm32f3discovery/include/periph_conf.h +++ b/boards/stm32f3discovery/include/periph_conf.h @@ -127,19 +127,21 @@ static const pwm_conf_t pwm_config[] = { { .dev = TIM3, .rcc_mask = RCC_APB1ENR_TIM3EN, - .pins = { GPIO_PIN(PORT_C, 6), GPIO_PIN(PORT_C, 7), - GPIO_PIN(PORT_C, 8), GPIO_PIN(PORT_C, 9) }, + .chan = { { .pin = GPIO_PIN(PORT_C, 6), .cc_chan = 0 }, + { .pin = GPIO_PIN(PORT_C, 7), .cc_chan = 1 }, + { .pin = GPIO_PIN(PORT_C, 8), .cc_chan = 2 }, + { .pin = GPIO_PIN(PORT_C, 9), .cc_chan = 3 } }, .af = GPIO_AF2, - .chan = 4, .bus = APB1 }, { .dev = TIM4, .rcc_mask = RCC_APB1ENR_TIM4EN, - .pins = { GPIO_PIN(PORT_D, 12), GPIO_PIN(PORT_D, 13), - GPIO_PIN(PORT_D, 14), GPIO_PIN(PORT_D, 15) }, + .chan = { { .pin = GPIO_PIN(PORT_D, 12), .cc_chan = 0}, + { .pin = GPIO_PIN(PORT_D, 13), .cc_chan = 1}, + { .pin = GPIO_PIN(PORT_D, 14), .cc_chan = 2}, + { .pin = GPIO_PIN(PORT_D, 15), .cc_chan = 3} }, .af = GPIO_AF2, - .chan = 4, .bus = APB1 } }; diff --git a/boards/stm32f4discovery/include/periph_conf.h b/boards/stm32f4discovery/include/periph_conf.h index e3476f8c83..19f90b2159 100644 --- a/boards/stm32f4discovery/include/periph_conf.h +++ b/boards/stm32f4discovery/include/periph_conf.h @@ -159,21 +159,21 @@ static const pwm_conf_t pwm_config[] = { { .dev = TIM1, .rcc_mask = RCC_APB2ENR_TIM1EN, - .pins = { GPIO_PIN(PORT_E, 9), GPIO_PIN(PORT_E, 11), - GPIO_PIN(PORT_E, 11), GPIO_PIN(PORT_E, 14) }, + .chan = { { .pin = GPIO_PIN(PORT_E, 9), .cc_chan = 0 }, + { .pin = GPIO_PIN(PORT_E, 11), .cc_chan = 1 }, + { .pin = GPIO_PIN(PORT_E, 11), .cc_chan = 2 }, + { .pin = GPIO_PIN(PORT_E, 14), .cc_chan = 3 } }, .af = GPIO_AF1, - .chan = 4, .bus = APB2 }, - { - .dev = TIM3, - .rcc_mask = RCC_APB1ENR_TIM3EN, - .pins = { GPIO_PIN(PORT_B, 4), GPIO_PIN(PORT_B, 5), - GPIO_PIN(PORT_B, 0), GPIO_PIN(PORT_B, 1) }, - .af = GPIO_AF2, - .chan = 4, - .bus = APB1 - } + // { + // .dev = TIM3, + // .rcc_mask = RCC_APB1ENR_TIM3EN, + // .chan = { GPIO_PIN(PORT_B, 4), GPIO_PIN(PORT_B, 5), + // GPIO_PIN(PORT_B, 0), GPIO_PIN(PORT_B, 1) }, + // .af = GPIO_AF2, + // .bus = APB1 + // } }; #define PWM_NUMOF (sizeof(pwm_config) / sizeof(pwm_config[0])) -- GitLab