From f0b377f4344bfcc76fbe78a97394a496ee52f9e8 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Sat, 7 Aug 2021 14:22:41 +0200 Subject: [PATCH] nucleo-f446re: add qenco example configuration --- boards/arm/stm32/nucleo-f446re/Kconfig | 10 +++- .../nucleo-f446re/configs/qenco/defconfig | 52 +++++++++++++++++++ .../arm/stm32/nucleo-f446re/include/board.h | 12 ++++- 3 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 boards/arm/stm32/nucleo-f446re/configs/qenco/defconfig diff --git a/boards/arm/stm32/nucleo-f446re/Kconfig b/boards/arm/stm32/nucleo-f446re/Kconfig index bc21d54050..35d135fc34 100644 --- a/boards/arm/stm32/nucleo-f446re/Kconfig +++ b/boards/arm/stm32/nucleo-f446re/Kconfig @@ -5,10 +5,18 @@ if ARCH_BOARD_NUCLEO_F446RE +if SENSORS_QENCODER + config NUCLEO_F446RE_QETIMER int "Timer to use with QE encoder" default 3 - depends on SENSORS_QENCODER + +config NUCLEO_F446RE_QETIMER_TIM2_IHM08M1_MAP + bool "Use TIM2 QE pins to match IHM08M1 board pins" + default n + depends on STM32_TIM2_QE + +endif # SENSORS_QENCODER config NUCLEO_F446RE_AJOY_MINBUTTONS bool "Minimal Joystick Buttons" diff --git a/boards/arm/stm32/nucleo-f446re/configs/qenco/defconfig b/boards/arm/stm32/nucleo-f446re/configs/qenco/defconfig new file mode 100644 index 0000000000..a20d83c8e3 --- /dev/null +++ b/boards/arm/stm32/nucleo-f446re/configs/qenco/defconfig @@ -0,0 +1,52 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="nucleo-f446re" +CONFIG_ARCH_BOARD_NUCLEO_F446RE=y +CONFIG_ARCH_BUTTONS=y +CONFIG_ARCH_CHIP="stm32" +CONFIG_ARCH_CHIP_STM32=y +CONFIG_ARCH_CHIP_STM32F446R=y +CONFIG_ARCH_INTERRUPTSTACK=1024 +CONFIG_ARCH_IRQPRIO=y +CONFIG_BOARD_LOOPSPERMSEC=8499 +CONFIG_BOARD_STM32_COMMON=y +CONFIG_BUILTIN=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_EXAMPLES_QENCODER=y +CONFIG_EXAMPLES_QENCODER_HAVE_MAXPOS=y +CONFIG_EXAMPLES_QENCODER_MAXPOS=8192 +CONFIG_INTELHEX_BINARY=y +CONFIG_MQ_MAXMSGSIZE=5 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NUCLEO_F446RE_QETIMER=2 +CONFIG_NUCLEO_F446RE_QETIMER_TIM2_IHM08M1_MAP=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_RAM_SIZE=16386 +CONFIG_RAM_START=0x20000000 +CONFIG_RAW_BINARY=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_SDCLONE_DISABLE=y +CONFIG_SENSORS=y +CONFIG_SENSORS_QENCODER=y +CONFIG_START_DAY=14 +CONFIG_START_MONTH=10 +CONFIG_START_YEAR=2014 +CONFIG_STM32_JTAG_SW_ENABLE=y +CONFIG_STM32_QENCODER_DISABLE_EXTEND16BTIMERS=y +CONFIG_STM32_QENCODER_SAMPLE_FDTS_2=y +CONFIG_STM32_TIM2=y +CONFIG_STM32_TIM2_QE=y +CONFIG_STM32_TIM2_QEPSC=0 +CONFIG_STM32_USART2=y +CONFIG_SYSTEM_NSH=y +CONFIG_TASK_NAME_SIZE=0 +CONFIG_USART2_SERIAL_CONSOLE=y +CONFIG_USER_ENTRYPOINT="nsh_main" diff --git a/boards/arm/stm32/nucleo-f446re/include/board.h b/boards/arm/stm32/nucleo-f446re/include/board.h index d5b48be1c7..b19019693d 100644 --- a/boards/arm/stm32/nucleo-f446re/include/board.h +++ b/boards/arm/stm32/nucleo-f446re/include/board.h @@ -377,10 +377,18 @@ #define BUTTON_USER_BIT (1 << BUTTON_USER) -#define GPIO_TIM2_CH1IN (GPIO_TIM2_CH1IN_1 | GPIO_PULLUP) -#define GPIO_TIM2_CH2IN (GPIO_TIM2_CH2IN_1 | GPIO_PULLUP) +/* TIM2 input ***************************************************************/ + +#ifndef CONFIG_NUCLEO_F446RE_QETIMER_TIM2_IHM08M1_MAP +# define GPIO_TIM2_CH1IN (GPIO_TIM2_CH1IN_1 | GPIO_PULLUP) /* PA8 */ +# define GPIO_TIM2_CH2IN (GPIO_TIM2_CH2IN_1 | GPIO_PULLUP) /* PB0 */ +#else +# define GPIO_TIM2_CH1IN (GPIO_TIM2_CH1IN_2 | GPIO_PULLUP) /* PA15 */ +# define GPIO_TIM2_CH2IN (GPIO_TIM2_CH2IN_2 | GPIO_PULLUP) /* PB3 */ +#endif /* TIM3 configuration *******************************************************/ + #define GPIO_TIM3_CH1OUT GPIO_TIM3_CH1OUT_1 #ifdef CONFIG_BOARD_STM32_IHM08M1