From a0711b1c192b200f873f37bf66c9657adb6d2112 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 22 Nov 2016 06:41:46 -0600 Subject: [PATCH] configs: All QE encoder files. Last change made timer hard-coded to 3. Make configurable. --- configs/mikroe-stm32f4/Kconfig | 5 +++++ configs/mikroe-stm32f4/src/stm32_appinit.c | 2 +- configs/nucleo-f4x1re/Kconfig | 5 +++++ configs/nucleo-f4x1re/src/stm32_appinit.c | 2 +- configs/nucleo-l476rg/Kconfig | 5 +++++ configs/nucleo-l476rg/src/stm32_appinit.c | 2 +- configs/stm32f3discovery/Kconfig | 5 +++++ configs/stm32f3discovery/src/stm32_appinit.c | 2 +- configs/stm32f4discovery/Kconfig | 5 +++++ configs/stm32f4discovery/README.txt | 2 ++ configs/stm32f4discovery/src/stm32_bringup.c | 2 +- configs/stm32f4discovery/src/stm32_qencoder.c | 2 +- configs/stm32ldiscovery/Kconfig | 6 ++++++ configs/stm32ldiscovery/src/stm32_appinit.c | 2 +- 14 files changed, 40 insertions(+), 7 deletions(-) diff --git a/configs/mikroe-stm32f4/Kconfig b/configs/mikroe-stm32f4/Kconfig index 836f13cf2b..00a5e41ee4 100644 --- a/configs/mikroe-stm32f4/Kconfig +++ b/configs/mikroe-stm32f4/Kconfig @@ -76,6 +76,11 @@ config MIKROE_RAMMTD_SIZE ---help--- Sets the size of static RAM allocation for the SMART RAM device +config MIKROE_QETIMER + int "Timer to use with QE encoder" + default 3 + depends on QENCODER + config PM_ALARM_SEC int "PM_STANDBY delay (seconds)" default 15 diff --git a/configs/mikroe-stm32f4/src/stm32_appinit.c b/configs/mikroe-stm32f4/src/stm32_appinit.c index cfc907dd03..89828b2872 100644 --- a/configs/mikroe-stm32f4/src/stm32_appinit.c +++ b/configs/mikroe-stm32f4/src/stm32_appinit.c @@ -366,7 +366,7 @@ int board_app_initialize(uintptr_t arg) #ifdef CONFIG_QENCODER /* Initialize and register the qencoder driver */ - ret = stm32_qencoder_initialize("/dev/qe0", 3); + ret = stm32_qencoder_initialize("/dev/qe0", CONFIG_MIKROE_QETIMER); if (ret != OK) { syslog(LOG_ERR, diff --git a/configs/nucleo-f4x1re/Kconfig b/configs/nucleo-f4x1re/Kconfig index 6449f5b673..27e172d841 100644 --- a/configs/nucleo-f4x1re/Kconfig +++ b/configs/nucleo-f4x1re/Kconfig @@ -5,6 +5,11 @@ if ARCH_BOARD_NUCLEO_F401RE +config NUCLEO_F401RE_QETIMER + int "Timer to use with QE encoder" + default 3 + depends on QENCODER + config NUCLEO_F401RE_AJOY_MINBUTTONS bool "Minimal Joystick Buttons" default n if !STM32_USART1 diff --git a/configs/nucleo-f4x1re/src/stm32_appinit.c b/configs/nucleo-f4x1re/src/stm32_appinit.c index 06df903438..a55f6a3c51 100644 --- a/configs/nucleo-f4x1re/src/stm32_appinit.c +++ b/configs/nucleo-f4x1re/src/stm32_appinit.c @@ -142,7 +142,7 @@ int board_app_initialize(uintptr_t arg) #ifdef CONFIG_QENCODER /* Initialize and register the qencoder driver */ - ret = stm32_qencoder_initialize("/dev/qe0", 3); + ret = stm32_qencoder_initialize("/dev/qe0", CONFIG_NUCLEO_F401RE_QETIMER); if (ret != OK) { syslog(LOG_ERR, diff --git a/configs/nucleo-l476rg/Kconfig b/configs/nucleo-l476rg/Kconfig index 7361b3f490..8edd703e42 100644 --- a/configs/nucleo-l476rg/Kconfig +++ b/configs/nucleo-l476rg/Kconfig @@ -5,6 +5,11 @@ if ARCH_BOARD_NUCLEO_L476RG +config NUCLEO_L476RG_QETIMER + int "Timer to use with QE encoder" + default 3 + depends on QENCODER + config NUCLEO_L476RG_AJOY_MINBUTTONS bool "Minimal Joystick Buttons" default n if !STM32_USART1 diff --git a/configs/nucleo-l476rg/src/stm32_appinit.c b/configs/nucleo-l476rg/src/stm32_appinit.c index 6b279bd7a5..ceeca0eff3 100644 --- a/configs/nucleo-l476rg/src/stm32_appinit.c +++ b/configs/nucleo-l476rg/src/stm32_appinit.c @@ -221,7 +221,7 @@ int board_app_initialize(uintptr_t arg) #ifdef CONFIG_QENCODER /* Initialize and register the qencoder driver */ - ret = stm32l4_qencoder_initialize("/dev/qe0", 3); + ret = stm32l4_qencoder_initialize("/dev/qe0", CONFIG_NUCLEO_L476RG_QETIMER); if (ret != OK) { syslog(LOG_ERR, diff --git a/configs/stm32f3discovery/Kconfig b/configs/stm32f3discovery/Kconfig index de0d2da5f8..71e736df11 100644 --- a/configs/stm32f3discovery/Kconfig +++ b/configs/stm32f3discovery/Kconfig @@ -5,6 +5,11 @@ if ARCH_BOARD_STM32F3_DISCOVERY +config STM32F3DISCO_QETIMER + int "Timer to use with QE encoder" + default 3 + depends on QENCODER + config PM_BUTTONS bool "PM Button support" default n diff --git a/configs/stm32f3discovery/src/stm32_appinit.c b/configs/stm32f3discovery/src/stm32_appinit.c index d4726c22b7..68cb782539 100644 --- a/configs/stm32f3discovery/src/stm32_appinit.c +++ b/configs/stm32f3discovery/src/stm32_appinit.c @@ -130,7 +130,7 @@ int board_app_initialize(uintptr_t arg) #ifdef CONFIG_QENCODER /* Initialize and register the qencoder driver */ - ret = stm32_qencoder_initialize("/dev/qe0", 3); + ret = stm32_qencoder_initialize("/dev/qe0", CONFIG_STM32F3DISCO_QETIMER); if (ret != OK) { syslog(LOG_ERR, diff --git a/configs/stm32f4discovery/Kconfig b/configs/stm32f4discovery/Kconfig index 3c84095efc..9703364210 100644 --- a/configs/stm32f4discovery/Kconfig +++ b/configs/stm32f4discovery/Kconfig @@ -22,6 +22,11 @@ config STM32F4DISCO_USBHOST_PRIO default 100 depends on USBHOST +config STM32F4DISCO_QETIMER + int "Timer to use with QE encoder" + default 3 + depends on QENCODER + config PM_BUTTONS bool "PM button support" default n diff --git a/configs/stm32f4discovery/README.txt b/configs/stm32f4discovery/README.txt index 2b1bb2501f..aaa37fe7f7 100644 --- a/configs/stm32f4discovery/README.txt +++ b/configs/stm32f4discovery/README.txt @@ -456,6 +456,8 @@ pins PA15 and PA1 for CH1 and CH2, respectively). If TIM8 is selected, then PC6 and PI5 will be used for CH1 and CH2 (see include board.h for pin definitions). +Selected via CONFIG_STM32F4DISCO_QETIMER + FPU === diff --git a/configs/stm32f4discovery/src/stm32_bringup.c b/configs/stm32f4discovery/src/stm32_bringup.c index 7805a71e05..8a800d59f3 100644 --- a/configs/stm32f4discovery/src/stm32_bringup.c +++ b/configs/stm32f4discovery/src/stm32_bringup.c @@ -162,7 +162,7 @@ int stm32_bringup(void) #ifdef CONFIG_QENCODER /* Initialize and register the qencoder driver */ - ret = stm32_qencoder_initialize("/dev/qe0", 3); + ret = stm32_qencoder_initialize("/dev/qe0", CONFIG_STM32F4DISCO_QETIMER); if (ret != OK) { syslog(LOG_ERR, diff --git a/configs/stm32f4discovery/src/stm32_qencoder.c b/configs/stm32f4discovery/src/stm32_qencoder.c index 9a8af84ddd..80264a7a2a 100644 --- a/configs/stm32f4discovery/src/stm32_qencoder.c +++ b/configs/stm32f4discovery/src/stm32_qencoder.c @@ -1,7 +1,7 @@ /************************************************************************************ * configs/stm32f4discovery/src/stm32_qencoder.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/configs/stm32ldiscovery/Kconfig b/configs/stm32ldiscovery/Kconfig index 2d37b4e88d..34e1f83388 100644 --- a/configs/stm32ldiscovery/Kconfig +++ b/configs/stm32ldiscovery/Kconfig @@ -4,4 +4,10 @@ # if ARCH_BOARD_STM32FL_DISCOVERY + +config STM32LDISCO_QETIMER + int "Timer to use with QE encoder" + default 3 + depends on QENCODER + endif diff --git a/configs/stm32ldiscovery/src/stm32_appinit.c b/configs/stm32ldiscovery/src/stm32_appinit.c index eb60217e5e..b0f4909a2e 100644 --- a/configs/stm32ldiscovery/src/stm32_appinit.c +++ b/configs/stm32ldiscovery/src/stm32_appinit.c @@ -94,7 +94,7 @@ int board_app_initialize(uintptr_t arg) #ifdef CONFIG_QENCODER /* Initialize and register the qencoder driver */ - ret = stm32_qencoder_initialize("/dev/qe0", 3); + ret = stm32_qencoder_initialize("/dev/qe0", CONFIG_STM32LDISCO_QETIMER); if (ret != OK) { syslog(LOG_ERR,