arm/stm32f103-minimum: Use common board MFRC522

This commit is contained in:
Alan C. Assis 2024-08-10 08:51:14 -07:00 committed by Xiang Xiao
parent 208b8e084f
commit fe10abe4a0
6 changed files with 5 additions and 106 deletions

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -56,6 +56,10 @@
# include <nuttx/video/fb.h>
#endif
#ifdef CONFIG_CL_MFRC522
#include "stm32_mfrc522.h"
#endif
#include "stm32f103_minimum.h"
/* Conditional logic in stm32f103_minimum.h will determine if certain

View File

@ -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 <nuttx/config.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/spi/spi.h>
#include <nuttx/contactless/mfrc522.h>
#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 */

View File

@ -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 */