You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2020/05/14 06:33:17 UTC
[incubator-nuttx] 17/23: stm32: move qencoder initialization to
common board logic
This is an automated email from the ASF dual-hosted git repository.
jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 4fdf2520e6f492cbca2144fb7098bb7c76ccc4ca
Author: Matias Nitsche <mn...@dc.uba.ar>
AuthorDate: Mon May 11 19:20:55 2020 -0300
stm32: move qencoder initialization to common board logic
---
boards/arm/stm32/common/include/board_qencoder.h | 74 +++++++++++++++++++
boards/arm/stm32/common/src/Make.defs | 4 ++
.../src/stm32_qencoder.c | 17 ++---
boards/arm/stm32/mikroe-stm32f4/src/Make.defs | 4 --
.../arm/stm32/mikroe-stm32f4/src/mikroe-stm32f4.h | 12 ----
.../arm/stm32/mikroe-stm32f4/src/stm32_appinit.c | 6 +-
.../arm/stm32/mikroe-stm32f4/src/stm32_qencoder.c | 82 ---------------------
boards/arm/stm32/nucleo-f446re/src/Make.defs | 4 --
boards/arm/stm32/nucleo-f446re/src/nucleo-f446re.h | 12 ----
boards/arm/stm32/nucleo-f446re/src/stm32_appinit.c | 6 +-
.../arm/stm32/nucleo-f446re/src/stm32_qencoder.c | 82 ---------------------
boards/arm/stm32/nucleo-f4x1re/src/Make.defs | 4 --
boards/arm/stm32/nucleo-f4x1re/src/nucleo-f4x1re.h | 12 ----
boards/arm/stm32/nucleo-f4x1re/src/stm32_bringup.c | 6 +-
.../arm/stm32/nucleo-f4x1re/src/stm32_qencoder.c | 83 ----------------------
boards/arm/stm32/stm3240g-eval/src/Make.defs | 4 --
boards/arm/stm32/stm32f103-minimum/src/Make.defs | 4 --
.../stm32/stm32f103-minimum/src/stm32_bringup.c | 6 +-
.../stm32f103-minimum/src/stm32f103_minimum.h | 12 ----
boards/arm/stm32/stm32f3discovery/src/Make.defs | 4 --
.../arm/stm32/stm32f3discovery/src/stm32_bringup.c | 6 +-
.../stm32/stm32f3discovery/src/stm32_qencoder.c | 82 ---------------------
.../stm32/stm32f3discovery/src/stm32f3discovery.h | 12 ----
boards/arm/stm32/stm32f4discovery/src/Make.defs | 4 --
.../arm/stm32/stm32f4discovery/src/stm32_bringup.c | 6 +-
.../stm32/stm32f4discovery/src/stm32_qencoder.c | 80 ---------------------
.../stm32/stm32f4discovery/src/stm32f4discovery.h | 12 ----
boards/arm/stm32/stm32ldiscovery/src/Make.defs | 4 --
.../arm/stm32/stm32ldiscovery/src/stm32_bringup.c | 6 +-
.../arm/stm32/stm32ldiscovery/src/stm32_qencoder.c | 82 ---------------------
.../stm32/stm32ldiscovery/src/stm32ldiscovery.h | 12 ----
31 files changed, 122 insertions(+), 622 deletions(-)
diff --git a/boards/arm/stm32/common/include/board_qencoder.h b/boards/arm/stm32/common/include/board_qencoder.h
new file mode 100644
index 0000000..9aee53c
--- /dev/null
+++ b/boards/arm/stm32/common/include/board_qencoder.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+ * boards/arm/stm32/common/include/stm32_qencoder.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __STM32_QENCODER_H
+#define __STM32_QENCODER_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+
+/****************************************************************************
+ * Name: board_qencoder_initialize
+ *
+ * Description:
+ * Initialize the quadrature encoder driver for the given timer
+ *
+ ****************************************************************************/
+
+int board_qencoder_initialize(int devno, int timerno);
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __STM32_QENCODER_H
diff --git a/boards/arm/stm32/common/src/Make.defs b/boards/arm/stm32/common/src/Make.defs
index ee95f29..1d8d75d 100644
--- a/boards/arm/stm32/common/src/Make.defs
+++ b/boards/arm/stm32/common/src/Make.defs
@@ -66,6 +66,10 @@ ifeq ($(CONFIG_SENSORS_ZEROCROSS),y)
CSRCS += stm32_zerocross.c
endif
+ifeq ($(CONFIG_SENSORS_QENCODER),y)
+ CSRCS += stm32_qencoder.c
+endif
+
DEPPATH += --dep-path src
VPATH += :src
CFLAGS += $(shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src)
diff --git a/boards/arm/stm32/stm32f103-minimum/src/stm32_qencoder.c b/boards/arm/stm32/common/src/stm32_qencoder.c
similarity index 88%
rename from boards/arm/stm32/stm32f103-minimum/src/stm32_qencoder.c
rename to boards/arm/stm32/common/src/stm32_qencoder.c
index 49b9bb7..222f019 100644
--- a/boards/arm/stm32/stm32f103-minimum/src/stm32_qencoder.c
+++ b/boards/arm/stm32/common/src/stm32_qencoder.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * boards/arm/stm32/stm32f103-minimum/src/stm32_qencoder.c
+ * boards/arm/stm32/common/src/stm32_qencoder.c
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gn...@nuttx.org>
@@ -41,6 +41,7 @@
#include <errno.h>
#include <debug.h>
+#include <stdio.h>
#include <nuttx/sensors/qencoder.h>
#include <arch/board/board.h>
@@ -48,29 +49,29 @@
#include "chip.h"
#include "arm_arch.h"
#include "stm32_qencoder.h"
-#include "stm32f103_minimum.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
- * Name: stm32_qencoder_initialize
+ * Name: board_qencoder_initialize
*
* Description:
- * All STM32 architectures must provide the following interface to work with
- * examples/qencoder.
+ * Initialize the quadrature encoder driver for the given timer
*
****************************************************************************/
-int stm32_qencoder_initialize(FAR const char *devpath, int timer)
+int board_qencoder_initialize(int devno, int timerno)
{
int ret;
+ char devpath[12];
/* Initialize a quadrature encoder interface. */
- sninfo("Initializing the quadrature encoder using TIM%d\n", timer);
- ret = stm32_qeinitialize(devpath, timer);
+ sninfo("Initializing the quadrature encoder using TIM%d\n", timerno);
+ snprintf(devpath, 12, "/dev/qe%d", devno);
+ ret = stm32_qeinitialize(devpath, timerno);
if (ret < 0)
{
snerr("ERROR: stm32_qeinitialize failed: %d\n", ret);
diff --git a/boards/arm/stm32/mikroe-stm32f4/src/Make.defs b/boards/arm/stm32/mikroe-stm32f4/src/Make.defs
index 844ebe2..4312038 100644
--- a/boards/arm/stm32/mikroe-stm32f4/src/Make.defs
+++ b/boards/arm/stm32/mikroe-stm32f4/src/Make.defs
@@ -54,10 +54,6 @@ ifeq ($(CONFIG_PWM),y)
CSRCS += stm32_pwm.c
endif
-ifeq ($(CONFIG_SENSORS_QENCODER),y)
-CSRCS += stm32_qencoder.c
-endif
-
ifeq ($(CONFIG_LIB_BOARDCTL),y)
CSRCS += stm32_appinit.c
endif
diff --git a/boards/arm/stm32/mikroe-stm32f4/src/mikroe-stm32f4.h b/boards/arm/stm32/mikroe-stm32f4/src/mikroe-stm32f4.h
index 5958e7e..ab46877 100644
--- a/boards/arm/stm32/mikroe-stm32f4/src/mikroe-stm32f4.h
+++ b/boards/arm/stm32/mikroe-stm32f4/src/mikroe-stm32f4.h
@@ -253,18 +253,6 @@ int stm32_pwm_setup(void);
#endif
/****************************************************************************
- * Name: stm32_qencoder_initialize
- *
- * Description:
- * Initialize and register a qencoder
- *
- ****************************************************************************/
-
-#ifdef CONFIG_SENSORS_QENCODER
-int stm32_qencoder_initialize(FAR const char *devpath, int timer);
-#endif
-
-/****************************************************************************
* Name: stm32_lcdinitialize
*
* Description:
diff --git a/boards/arm/stm32/mikroe-stm32f4/src/stm32_appinit.c b/boards/arm/stm32/mikroe-stm32f4/src/stm32_appinit.c
index e705b7c..fb61c4d 100644
--- a/boards/arm/stm32/mikroe-stm32f4/src/stm32_appinit.c
+++ b/boards/arm/stm32/mikroe-stm32f4/src/stm32_appinit.c
@@ -76,6 +76,10 @@
#include "stm32.h"
#include "mikroe-stm32f4.h"
+#ifdef CONFIG_SENSORS_QENCODER
+#include "board_qencoder.h"
+#endif
+
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -385,7 +389,7 @@ int board_app_initialize(uintptr_t arg)
#ifdef CONFIG_SENSORS_QENCODER
/* Initialize and register the qencoder driver */
- ret = stm32_qencoder_initialize("/dev/qe0", CONFIG_MIKROE_QETIMER);
+ ret = board_qencoder_initialize(0, CONFIG_MIKROE_QETIMER);
if (ret != OK)
{
syslog(LOG_ERR,
diff --git a/boards/arm/stm32/mikroe-stm32f4/src/stm32_qencoder.c b/boards/arm/stm32/mikroe-stm32f4/src/stm32_qencoder.c
deleted file mode 100644
index 654be4b..0000000
--- a/boards/arm/stm32/mikroe-stm32f4/src/stm32_qencoder.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
- * boards/arm/stm32/mikroe_stm32f4/src/stm32_qencoder.c
- *
- * Copyright (C) 2012-2013, 2016 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
- *
- * 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <errno.h>
-#include <debug.h>
-
-#include <nuttx/sensors/qencoder.h>
-#include <arch/board/board.h>
-
-#include "chip.h"
-#include "arm_arch.h"
-#include "stm32_qencoder.h"
-#include "mikroe-stm32f4.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: stm32_qencoder_initialize
- *
- * Description:
- * All STM32 architectures must provide the following interface to work with
- * examples/qencoder.
- *
- ****************************************************************************/
-
-int stm32_qencoder_initialize(FAR const char *devpath, int timer)
-{
- int ret;
-
- /* Initialize a quadrature encoder interface. */
-
- sninfo("Initializing the quadrature encoder using TIM%d\n", timer);
- ret = stm32_qeinitialize(devpath, timer);
- if (ret < 0)
- {
- snerr("ERROR: stm32_qeinitialize failed: %d\n", ret);
- }
-
- return ret;
-}
-
-#endif /* HAVE_QENCODER */
diff --git a/boards/arm/stm32/nucleo-f446re/src/Make.defs b/boards/arm/stm32/nucleo-f446re/src/Make.defs
index 06c61d9..395328c 100644
--- a/boards/arm/stm32/nucleo-f446re/src/Make.defs
+++ b/boards/arm/stm32/nucleo-f446re/src/Make.defs
@@ -55,10 +55,6 @@ CSRCS += stm32_ajoystick.c
endif
endif
-ifeq ($(CONFIG_SENSORS_QENCODER),y)
-CSRCS += stm32_qencoder.c
-endif
-
ifeq ($(CONFIG_NSH_LIBRARY),y)
CSRCS += stm32_appinit.c
endif
diff --git a/boards/arm/stm32/nucleo-f446re/src/nucleo-f446re.h b/boards/arm/stm32/nucleo-f446re/src/nucleo-f446re.h
index db8a00e..a19ef1d 100644
--- a/boards/arm/stm32/nucleo-f446re/src/nucleo-f446re.h
+++ b/boards/arm/stm32/nucleo-f446re/src/nucleo-f446re.h
@@ -261,18 +261,6 @@ int stm32_adc_setup(void);
#endif
/****************************************************************************
- * Name: stm32_qencoder_initialize
- *
- * Description:
- * Initialize and register a qencoder
- *
- ****************************************************************************/
-
-#ifdef CONFIG_SENSORS_QENCODER
-int stm32_qencoder_initialize(FAR const char *devpath, int timer);
-#endif
-
-/****************************************************************************
* Name: board_ajoy_initialize
*
* Description:
diff --git a/boards/arm/stm32/nucleo-f446re/src/stm32_appinit.c b/boards/arm/stm32/nucleo-f446re/src/stm32_appinit.c
index d4c4020..7789425 100644
--- a/boards/arm/stm32/nucleo-f446re/src/stm32_appinit.c
+++ b/boards/arm/stm32/nucleo-f446re/src/stm32_appinit.c
@@ -55,6 +55,10 @@
#include "nucleo-f446re.h"
+#ifdef CONFIG_SENSORS_QENCODER
+#include "board_qencoder.h"
+#endif
+
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -132,7 +136,7 @@ int board_app_initialize(uintptr_t arg)
#ifdef CONFIG_SENSORS_QENCODER
/* Initialize and register the qencoder driver */
- ret = stm32_qencoder_initialize("/dev/qe0", CONFIG_NUCLEO_F401RE_QETIMER);
+ ret = board_qencoder_initialize(0, CONFIG_NUCLEO_F401RE_QETIMER);
if (ret != OK)
{
syslog(LOG_ERR,
diff --git a/boards/arm/stm32/nucleo-f446re/src/stm32_qencoder.c b/boards/arm/stm32/nucleo-f446re/src/stm32_qencoder.c
deleted file mode 100644
index 4f6e6e3..0000000
--- a/boards/arm/stm32/nucleo-f446re/src/stm32_qencoder.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
- * boards/arm/stm32/nucleo-f446re/src/stm32_qencoder.c
- *
- * Copyright (C) 2019 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
- *
- * 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.
- *
- ****************************************************************************/
-
-/*****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <errno.h>
-#include <debug.h>
-
-#include <nuttx/sensors/qencoder.h>
-#include <arch/board/board.h>
-
-#include "chip.h"
-#include "arm_arch.h"
-#include "stm32_qencoder.h"
-#include "nucleo-f446re.h"
-
-/*****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/*****************************************************************************
- * Name: stm32_qencoder_initialize
- *
- * Description:
- * All STM32 architectures must provide the following interface to work
- * with examples/qencoder.
- *
- ****************************************************************************/
-
-int stm32_qencoder_initialize(FAR const char *devpath, int timer)
-{
- int ret;
-
- /* Initialize a quadrature encoder interface. */
-
- sninfo("Initializing the quadrature encoder using TIM%d\n", timer);
- ret = stm32_qeinitialize(devpath, timer);
- if (ret < 0)
- {
- snerr("ERROR: stm32_qeinitialize failed: %d\n", ret);
- }
-
- return ret;
-}
-
-#endif /* HAVE_QENCODER */
diff --git a/boards/arm/stm32/nucleo-f4x1re/src/Make.defs b/boards/arm/stm32/nucleo-f4x1re/src/Make.defs
index 273f635..d38cb8b 100644
--- a/boards/arm/stm32/nucleo-f4x1re/src/Make.defs
+++ b/boards/arm/stm32/nucleo-f4x1re/src/Make.defs
@@ -55,10 +55,6 @@ CSRCS += stm32_ajoystick.c
endif
endif
-ifeq ($(CONFIG_SENSORS_QENCODER),y)
-CSRCS += stm32_qencoder.c
-endif
-
ifeq ($(CONFIG_CAN_MCP2515),y)
CSRCS += stm32_mcp2515.c
endif
diff --git a/boards/arm/stm32/nucleo-f4x1re/src/nucleo-f4x1re.h b/boards/arm/stm32/nucleo-f4x1re/src/nucleo-f4x1re.h
index 91bd54e..750c148 100644
--- a/boards/arm/stm32/nucleo-f4x1re/src/nucleo-f4x1re.h
+++ b/boards/arm/stm32/nucleo-f4x1re/src/nucleo-f4x1re.h
@@ -289,18 +289,6 @@ int stm32_adc_setup(void);
#endif
/****************************************************************************
- * Name: stm32_qencoder_initialize
- *
- * Description:
- * Initialize and register a qencoder
- *
- ****************************************************************************/
-
-#ifdef CONFIG_SENSORS_QENCODER
-int stm32_qencoder_initialize(FAR const char *devpath, int timer);
-#endif
-
-/****************************************************************************
* Name: board_ajoy_initialize
*
* Description:
diff --git a/boards/arm/stm32/nucleo-f4x1re/src/stm32_bringup.c b/boards/arm/stm32/nucleo-f4x1re/src/stm32_bringup.c
index a30f82e..c9e015e 100644
--- a/boards/arm/stm32/nucleo-f4x1re/src/stm32_bringup.c
+++ b/boards/arm/stm32/nucleo-f4x1re/src/stm32_bringup.c
@@ -56,6 +56,10 @@
#include <nuttx/board.h>
+#ifdef CONFIG_SENSORS_QENCODER
+#include "board_qencoder.h"
+#endif
+
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -151,7 +155,7 @@ int stm32_bringup(void)
#ifdef CONFIG_SENSORS_QENCODER
/* Initialize and register the qencoder driver */
- ret = stm32_qencoder_initialize("/dev/qe0", CONFIG_NUCLEO_F401RE_QETIMER);
+ ret = board_qencoder_initialize(0, CONFIG_NUCLEO_F401RE_QETIMER);
if (ret != OK)
{
syslog(LOG_ERR,
diff --git a/boards/arm/stm32/nucleo-f4x1re/src/stm32_qencoder.c b/boards/arm/stm32/nucleo-f4x1re/src/stm32_qencoder.c
deleted file mode 100644
index e5b7eda..0000000
--- a/boards/arm/stm32/nucleo-f4x1re/src/stm32_qencoder.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
- * boards/arm/stm32/nucleo-f4x1re/src/stm32_qencoder.c
- *
- * Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
- *
- * 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <errno.h>
-#include <debug.h>
-
-#include <nuttx/sensors/qencoder.h>
-
-#include "chip.h"
-#include "arm_arch.h"
-#include "stm32_qencoder.h"
-#include "nucleo-f4x1re.h"
-
-#include <arch/board/board.h>
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: stm32_qencoder_initialize
- *
- * Description:
- * All STM32 architectures must provide the following interface to work with
- * examples/qencoder.
- *
- ****************************************************************************/
-
-int stm32_qencoder_initialize(FAR const char *devpath, int timer)
-{
- int ret;
-
- /* Initialize a quadrature encoder interface. */
-
- sninfo("Initializing the quadrature encoder using TIM%d\n", timer);
- ret = stm32_qeinitialize(devpath, timer);
- if (ret < 0)
- {
- snerr("ERROR: stm32_qeinitialize failed: %d\n", ret);
- }
-
- return ret;
-}
-
-#endif /* HAVE_QENCODER */
diff --git a/boards/arm/stm32/stm3240g-eval/src/Make.defs b/boards/arm/stm32/stm3240g-eval/src/Make.defs
index 0b8ccec..c56e111 100644
--- a/boards/arm/stm32/stm3240g-eval/src/Make.defs
+++ b/boards/arm/stm32/stm3240g-eval/src/Make.defs
@@ -81,10 +81,6 @@ ifeq ($(CONFIG_INPUT_STMPE811),y)
CSRCS += stm32_stmpe811.c
endif
-ifeq ($(CONFIG_SENSORS_QENCODER),y)
-CSRCS += stm32_qencoder.c
-endif
-
DEPPATH += --dep-path board
VPATH += :board
CFLAGS += $(shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)
diff --git a/boards/arm/stm32/stm32f103-minimum/src/Make.defs b/boards/arm/stm32/stm32f103-minimum/src/Make.defs
index 87829af..b8d3c26 100644
--- a/boards/arm/stm32/stm32f103-minimum/src/Make.defs
+++ b/boards/arm/stm32/stm32f103-minimum/src/Make.defs
@@ -115,10 +115,6 @@ ifeq ($(CONFIG_LCD_PCD8544),y)
CSRCS += stm32_pcd8544.c
endif
-ifeq ($(CONFIG_SENSORS_QENCODER),y)
- CSRCS += stm32_qencoder.c
-endif
-
ifeq ($(CONFIG_USBDEV),y)
CSRCS += stm32_usbdev.c
endif
diff --git a/boards/arm/stm32/stm32f103-minimum/src/stm32_bringup.c b/boards/arm/stm32/stm32f103-minimum/src/stm32_bringup.c
index b01e1ad..efa6510 100644
--- a/boards/arm/stm32/stm32f103-minimum/src/stm32_bringup.c
+++ b/boards/arm/stm32/stm32f103-minimum/src/stm32_bringup.c
@@ -129,6 +129,10 @@
#include "stm32_zerocross.h"
#endif
+#ifdef CONFIG_SENSORS_QENCODER
+#include "board_qencoder.h"
+#endif
+
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -402,7 +406,7 @@ int stm32_bringup(void)
#ifdef CONFIG_SENSORS_QENCODER
/* Initialize and register the qencoder driver */
- ret = stm32_qencoder_initialize("/dev/qe0",
+ ret = board_qencoder_initialize(0,
CONFIG_STM32F103MINIMUM_QETIMER);
if (ret != OK)
{
diff --git a/boards/arm/stm32/stm32f103-minimum/src/stm32f103_minimum.h b/boards/arm/stm32/stm32f103-minimum/src/stm32f103_minimum.h
index 6031556..03abbc8 100644
--- a/boards/arm/stm32/stm32f103-minimum/src/stm32f103_minimum.h
+++ b/boards/arm/stm32/stm32f103-minimum/src/stm32f103_minimum.h
@@ -293,18 +293,6 @@ int stm32_max6675initialize(FAR const char *devpath);
int stm32_w25initialize(int minor);
/****************************************************************************
- * Name: stm32_qencoder_initialize
- *
- * Description:
- * Initialize and register a qencoder
- *
- ****************************************************************************/
-
-#ifdef CONFIG_SENSORS_QENCODER
-int stm32_qencoder_initialize(FAR const char *devpath, int timer);
-#endif
-
-/****************************************************************************
* Name: stm32_rgbled_setup
*
* Description:
diff --git a/boards/arm/stm32/stm32f3discovery/src/Make.defs b/boards/arm/stm32/stm32f3discovery/src/Make.defs
index 37cf318..66b8eea 100644
--- a/boards/arm/stm32/stm32f3discovery/src/Make.defs
+++ b/boards/arm/stm32/stm32f3discovery/src/Make.defs
@@ -60,10 +60,6 @@ ifeq ($(CONFIG_PWM),y)
CSRCS += stm32_pwm.c
endif
-ifeq ($(CONFIG_SENSORS_QENCODER),y)
-CSRCS += stm32_qencoder.c
-endif
-
DEPPATH += --dep-path board
VPATH += :board
CFLAGS += $(shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)
diff --git a/boards/arm/stm32/stm32f3discovery/src/stm32_bringup.c b/boards/arm/stm32/stm32f3discovery/src/stm32_bringup.c
index bac5226..894d43a 100644
--- a/boards/arm/stm32/stm32f3discovery/src/stm32_bringup.c
+++ b/boards/arm/stm32/stm32f3discovery/src/stm32_bringup.c
@@ -53,6 +53,10 @@
#include "stm32.h"
#include "stm32f3discovery.h"
+#ifdef CONFIG_SENSORS_QENCODER
+#include "board_qencoder.h"
+#endif
+
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -129,7 +133,7 @@ int stm32_bringup(void)
#ifdef CONFIG_SENSORS_QENCODER
/* Initialize and register the qencoder driver */
- ret = stm32_qencoder_initialize("/dev/qe0", CONFIG_STM32F3DISCO_QETIMER);
+ ret = board_qencoder_initialize(0, CONFIG_STM32F3DISCO_QETIMER);
if (ret != OK)
{
syslog(LOG_ERR,
diff --git a/boards/arm/stm32/stm32f3discovery/src/stm32_qencoder.c b/boards/arm/stm32/stm32f3discovery/src/stm32_qencoder.c
deleted file mode 100644
index d29c72b..0000000
--- a/boards/arm/stm32/stm32f3discovery/src/stm32_qencoder.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
- * boards/arm/stm32/stm32f3discovery/src/stm32_qencoder.c
- *
- * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
- *
- * 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <errno.h>
-#include <debug.h>
-
-#include <nuttx/sensors/qencoder.h>
-#include <arch/board/board.h>
-
-#include "chip.h"
-#include "arm_arch.h"
-#include "stm32_qencoder.h"
-#include "stm32f3discovery.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: stm32_qencoder_initialize
- *
- * Description:
- * All STM32 architectures must provide the following interface to work with
- * examples/qencoder.
- *
- ****************************************************************************/
-
-int stm32_qencoder_initialize(FAR const char *devpath, int timer)
-{
- int ret;
-
- /* Initialize a quadrature encoder interface. */
-
- sninfo("Initializing the quadrature encoder using TIM%d\n", timer);
- ret = stm32_qeinitialize(devpath, timer);
- if (ret < 0)
- {
- snerr("ERROR: stm32_qeinitialize failed: %d\n", ret);
- }
-
- return ret;
-}
-
-#endif /* HAVE_QENCODER */
diff --git a/boards/arm/stm32/stm32f3discovery/src/stm32f3discovery.h b/boards/arm/stm32/stm32f3discovery/src/stm32f3discovery.h
index 8d33b45..109c12d 100644
--- a/boards/arm/stm32/stm32f3discovery/src/stm32f3discovery.h
+++ b/boards/arm/stm32/stm32f3discovery/src/stm32f3discovery.h
@@ -193,17 +193,5 @@ void weak_function stm32_usbinitialize(void);
int stm32_pwm_setup(void);
#endif
-/****************************************************************************
- * Name: stm32_qencoder_initialize
- *
- * Description:
- * Initialize and register a qencoder
- *
- ****************************************************************************/
-
-#ifdef CONFIG_SENSORS_QENCODER
-int stm32_qencoder_initialize(FAR const char *devpath, int timer);
-#endif
-
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_STM32_STM32F3DISCOVERY_SRC_STM32F3DISCOVERY_H */
diff --git a/boards/arm/stm32/stm32f4discovery/src/Make.defs b/boards/arm/stm32/stm32f4discovery/src/Make.defs
index 0346411..8cf8ed6 100644
--- a/boards/arm/stm32/stm32f4discovery/src/Make.defs
+++ b/boards/arm/stm32/stm32f4discovery/src/Make.defs
@@ -129,10 +129,6 @@ ifeq ($(CONFIG_PWM),y)
CSRCS += stm32_pwm.c
endif
-ifeq ($(CONFIG_SENSORS_QENCODER),y)
-CSRCS += stm32_qencoder.c
-endif
-
ifeq ($(CONFIG_SENSORS_XEN1210),y)
CSRCS += stm32_xen1210.c
endif
diff --git a/boards/arm/stm32/stm32f4discovery/src/stm32_bringup.c b/boards/arm/stm32/stm32f4discovery/src/stm32_bringup.c
index 0c0ef80..517c557 100644
--- a/boards/arm/stm32/stm32f4discovery/src/stm32_bringup.c
+++ b/boards/arm/stm32/stm32f4discovery/src/stm32_bringup.c
@@ -98,6 +98,10 @@
#include "stm32_zerocross.h"
#endif
+#ifdef CONFIG_SENSORS_QENCODER
+#include "board_qencoder.h"
+#endif
+
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -345,7 +349,7 @@ int stm32_bringup(void)
#ifdef CONFIG_SENSORS_QENCODER
/* Initialize and register the qencoder driver */
- ret = stm32_qencoder_initialize("/dev/qe0", CONFIG_STM32F4DISCO_QETIMER);
+ ret = board_qencoder_initialize(0, CONFIG_STM32F4DISCO_QETIMER);
if (ret != OK)
{
syslog(LOG_ERR,
diff --git a/boards/arm/stm32/stm32f4discovery/src/stm32_qencoder.c b/boards/arm/stm32/stm32f4discovery/src/stm32_qencoder.c
deleted file mode 100644
index 3d58ec1..0000000
--- a/boards/arm/stm32/stm32f4discovery/src/stm32_qencoder.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
- * boards/arm/stm32/stm32f4discovery/src/stm32_qencoder.c
- *
- * Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
- *
- * 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <errno.h>
-#include <debug.h>
-
-#include <nuttx/sensors/qencoder.h>
-#include <arch/board/board.h>
-
-#include "chip.h"
-#include "arm_arch.h"
-#include "stm32_qencoder.h"
-#include "stm32f4discovery.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: stm32_qencoder_initialize
- *
- * Description:
- * All STM32 architectures must provide the following interface to work with
- * examples/qencoder.
- *
- ****************************************************************************/
-
-int stm32_qencoder_initialize(FAR const char *devpath, int timer)
-{
- int ret;
-
- /* Initialize a quadrature encoder interface. */
-
- sninfo("Initializing the quadrature encoder using TIM%d\n", timer);
- ret = stm32_qeinitialize(devpath, timer);
- if (ret < 0)
- {
- snerr("ERROR: stm32_qeinitialize failed: %d\n", ret);
- }
-
- return ret;
-}
diff --git a/boards/arm/stm32/stm32f4discovery/src/stm32f4discovery.h b/boards/arm/stm32/stm32f4discovery/src/stm32f4discovery.h
index ff95944..7be35a0 100644
--- a/boards/arm/stm32/stm32f4discovery/src/stm32f4discovery.h
+++ b/boards/arm/stm32/stm32f4discovery/src/stm32f4discovery.h
@@ -687,18 +687,6 @@ void weak_function stm32_netinitialize(void);
#endif
/****************************************************************************
- * Name: stm32_qencoder_initialize
- *
- * Description:
- * Initialize and register a qencoder
- *
- ****************************************************************************/
-
-#ifdef CONFIG_SENSORS_QENCODER
-int stm32_qencoder_initialize(FAR const char *devpath, int timer);
-#endif
-
-/****************************************************************************
* Name: stm32_zerocross_initialize
*
* Description:
diff --git a/boards/arm/stm32/stm32ldiscovery/src/Make.defs b/boards/arm/stm32/stm32ldiscovery/src/Make.defs
index 06dd127..ae3dfef 100644
--- a/boards/arm/stm32/stm32ldiscovery/src/Make.defs
+++ b/boards/arm/stm32/stm32ldiscovery/src/Make.defs
@@ -56,10 +56,6 @@ ifeq ($(CONFIG_PWM),y)
CSRCS += stm32_pwm.c
endif
-ifeq ($(CONFIG_SENSORS_QENCODER),y)
-CSRCS += stm32_qencoder.c
-endif
-
ifeq ($(CONFIG_LIB_BOARDCTL),y)
CSRCS += stm32_appinit.c
endif
diff --git a/boards/arm/stm32/stm32ldiscovery/src/stm32_bringup.c b/boards/arm/stm32/stm32ldiscovery/src/stm32_bringup.c
index 3016a92..ad6d370 100644
--- a/boards/arm/stm32/stm32ldiscovery/src/stm32_bringup.c
+++ b/boards/arm/stm32/stm32ldiscovery/src/stm32_bringup.c
@@ -48,6 +48,10 @@
#include "stm32ldiscovery.h"
+#ifdef CONFIG_SENSORS_QENCODER
+#include "board_qencoder.h"
+#endif
+
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -104,7 +108,7 @@ int stm32_bringup(void)
#ifdef CONFIG_SENSORS_QENCODER
/* Initialize and register the qencoder driver */
- ret = stm32_qencoder_initialize("/dev/qe0", CONFIG_STM32LDISCO_QETIMER);
+ ret = board_qencoder_initialize(0, CONFIG_STM32LDISCO_QETIMER);
if (ret != OK)
{
syslog(LOG_ERR,
diff --git a/boards/arm/stm32/stm32ldiscovery/src/stm32_qencoder.c b/boards/arm/stm32/stm32ldiscovery/src/stm32_qencoder.c
deleted file mode 100644
index 260fb8a..0000000
--- a/boards/arm/stm32/stm32ldiscovery/src/stm32_qencoder.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
- * boards/arm/stm32/stm32ldiscovery/src/up_qencoder.c
- *
- * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gn...@nuttx.org>
- *
- * 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <errno.h>
-#include <debug.h>
-
-#include <nuttx/sensors/qencoder.h>
-#include <arch/board/board.h>
-
-#include "chip.h"
-#include "arm_arch.h"
-#include "stm32_qencoder.h"
-#include "stm32ldiscovery.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: stm32_qencoder_initialize
- *
- * Description:
- * All STM32 architectures must provide the following interface to work with
- * examples/qencoder.
- *
- ****************************************************************************/
-
-int stm32_qencoder_initialize(FAR const char *devpath, int timer)
-{
- int ret;
-
- /* Initialize a quadrature encoder interface. */
-
- sninfo("Initializing the quadrature encoder using TIM%d\n", timer);
- ret = stm32_qeinitialize(devpath, timer);
- if (ret < 0)
- {
- snerr("ERROR: stm32_qeinitialize failed: %d\n", ret);
- }
-
- return ret;
-}
-
-#endif /* HAVE_QENCODER */
diff --git a/boards/arm/stm32/stm32ldiscovery/src/stm32ldiscovery.h b/boards/arm/stm32/stm32ldiscovery/src/stm32ldiscovery.h
index b9aa2d7..4663261 100644
--- a/boards/arm/stm32/stm32ldiscovery/src/stm32ldiscovery.h
+++ b/boards/arm/stm32/stm32ldiscovery/src/stm32ldiscovery.h
@@ -277,17 +277,5 @@ void weak_function stm32_spidev_initialize(void);
int stm32_pwm_setup(void);
#endif
-/****************************************************************************
- * Name: stm32_qencoder_initialize
- *
- * Description:
- * Initialize and register a qencoder
- *
- ****************************************************************************/
-
-#ifdef CONFIG_SENSORS_QENCODER
-int stm32_qencoder_initialize(FAR const char *devpath, int timer);
-#endif
-
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_STM32_STM32F3DISCOVERY_SRC_STM32F3DISCOVERY_H */