From fe10abe4a0d953e0f1853189bae425a61dcb1cc9 Mon Sep 17 00:00:00 2001 From: "Alan C. Assis" Date: Sat, 10 Aug 2024 08:51:14 -0700 Subject: [PATCH] arm/stm32f103-minimum: Use common board MFRC522 --- .../configs/rfid-rc522/defconfig | 1 + .../stm32f103-minimum/src/CMakeLists.txt | 4 - .../arm/stm32/stm32f103-minimum/src/Make.defs | 4 - .../stm32f103-minimum/src/stm32_bringup.c | 4 + .../stm32f103-minimum/src/stm32_mfrc522.c | 86 ------------------- .../stm32f103-minimum/src/stm32f103_minimum.h | 12 --- 6 files changed, 5 insertions(+), 106 deletions(-) delete mode 100644 boards/arm/stm32/stm32f103-minimum/src/stm32_mfrc522.c diff --git a/boards/arm/stm32/stm32f103-minimum/configs/rfid-rc522/defconfig b/boards/arm/stm32/stm32f103-minimum/configs/rfid-rc522/defconfig index 5bb78a6b94..e36cee0693 100644 --- a/boards/arm/stm32/stm32f103-minimum/configs/rfid-rc522/defconfig +++ b/boards/arm/stm32/stm32f103-minimum/configs/rfid-rc522/defconfig @@ -19,6 +19,7 @@ # CONFIG_NSH_DISABLE_XD is not set CONFIG_ARCH="arm" CONFIG_ARCH_BOARD="stm32f103-minimum" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_STM32F103_MINIMUM=y CONFIG_ARCH_CHIP="stm32" CONFIG_ARCH_CHIP_STM32=y diff --git a/boards/arm/stm32/stm32f103-minimum/src/CMakeLists.txt b/boards/arm/stm32/stm32f103-minimum/src/CMakeLists.txt index fa92900f2d..0fc22fd9dc 100644 --- a/boards/arm/stm32/stm32f103-minimum/src/CMakeLists.txt +++ b/boards/arm/stm32/stm32f103-minimum/src/CMakeLists.txt @@ -79,10 +79,6 @@ if(CONFIG_CAN_MCP2515) list(APPEND SRCS stm32_mcp2515.c) endif() -if(CONFIG_CL_MFRC522) - list(APPEND SRCS stm32_mfrc522.c) -endif() - if(CONFIG_LCD_MAX7219) list(APPEND SRCS stm32_max7219.c) endif() diff --git a/boards/arm/stm32/stm32f103-minimum/src/Make.defs b/boards/arm/stm32/stm32f103-minimum/src/Make.defs index 651c06d46b..10c18a339c 100644 --- a/boards/arm/stm32/stm32f103-minimum/src/Make.defs +++ b/boards/arm/stm32/stm32f103-minimum/src/Make.defs @@ -81,10 +81,6 @@ ifeq ($(CONFIG_CAN_MCP2515),y) CSRCS += stm32_mcp2515.c endif -ifeq ($(CONFIG_CL_MFRC522),y) - CSRCS += stm32_mfrc522.c -endif - ifeq ($(CONFIG_LCD_MAX7219),y) CSRCS += stm32_max7219.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 d228b1bc9c..16d4a8c9fc 100644 --- a/boards/arm/stm32/stm32f103-minimum/src/stm32_bringup.c +++ b/boards/arm/stm32/stm32f103-minimum/src/stm32_bringup.c @@ -56,6 +56,10 @@ # include #endif +#ifdef CONFIG_CL_MFRC522 +#include "stm32_mfrc522.h" +#endif + #include "stm32f103_minimum.h" /* Conditional logic in stm32f103_minimum.h will determine if certain diff --git a/boards/arm/stm32/stm32f103-minimum/src/stm32_mfrc522.c b/boards/arm/stm32/stm32f103-minimum/src/stm32_mfrc522.c deleted file mode 100644 index cb20cf6155..0000000000 --- a/boards/arm/stm32/stm32f103-minimum/src/stm32_mfrc522.c +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/stm32f103-minimum/src/stm32_mfrc522.c - * - * 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -#include -#include - -#include "stm32.h" -#include "stm32_spi.h" -#include "stm32f103_minimum.h" - -#if defined(CONFIG_SPI) && defined(CONFIG_STM32_SPI1) && defined(CONFIG_CL_MFRC522) - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define MFRC522_SPI_PORTNO 1 /* On SPI1 */ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: stm32_mfrc522initialize - * - * Description: - * Initialize and register the MFRC522 RFID driver. - * - * Input Parameters: - * devpath - The full path to the driver to register. E.g., "/dev/rfid0" - * - * Returned Value: - * Zero (OK) on success; a negated errno value on failure. - * - ****************************************************************************/ - -int stm32_mfrc522initialize(const char *devpath) -{ - struct spi_dev_s *spi; - int ret; - - spi = stm32_spibus_initialize(MFRC522_SPI_PORTNO); - - if (!spi) - { - return -ENODEV; - } - - /* Then register the MFRC522 */ - - ret = mfrc522_register(devpath, spi); - if (ret < 0) - { - snerr("ERROR: Error registering MFRC522\n"); - } - - return ret; -} - -#endif /* CONFIG_SPI && CONFIG_MFRC522 */ diff --git a/boards/arm/stm32/stm32f103-minimum/src/stm32f103_minimum.h b/boards/arm/stm32/stm32f103-minimum/src/stm32f103_minimum.h index 44929f9453..fbdcf12651 100644 --- a/boards/arm/stm32/stm32f103-minimum/src/stm32f103_minimum.h +++ b/boards/arm/stm32/stm32f103-minimum/src/stm32f103_minimum.h @@ -372,17 +372,5 @@ int stm32_hyt271initialize(int devno); int stm32_ds18b20initialize(int devno); #endif -/**************************************************************************** - * Name: stm32_mfrc522initialize - * - * Description: - * Function used to initialize the MFRC522 RFID Transceiver - * - ****************************************************************************/ - -#ifdef CONFIG_CL_MFRC522 -int stm32_mfrc522initialize(const char *devpath); -#endif - #endif /* __ASSEMBLY__ */ #endif /* __BOARDS_ARM_STM32_STM32F103_MINIMUM_SRC_STM32F103_MINIMUM_H */