Merged in masayuki2009/nuttx.nuttx/stm32f4dis_with_gs2200m (pull request #1057)
stm32f4dis with gs2200m * drivers: wireless: Add SPI_SELECT() to _read/write_data() in gs2200m.c Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com> * boards: stm32f4discovery: Add support for gs2200m NOTE: GS2200M for Spresense works with mikroe STM32F4 Discovery Shield (slot3) Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com> Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
parent
7135abbd2c
commit
7389f86561
110
boards/arm/stm32/stm32f4discovery/configs/wifi/defconfig
Normal file
110
boards/arm/stm32/stm32f4discovery/configs/wifi/defconfig
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
#
|
||||||
|
# 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_FPU is not set
|
||||||
|
# CONFIG_MMCSD_HAVE_CARDDETECT is not set
|
||||||
|
# CONFIG_MMCSD_HAVE_WRITEPROTECT is not set
|
||||||
|
# CONFIG_NSH_ARGCAT is not set
|
||||||
|
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||||
|
# CONFIG_NSH_CMDPARMS is not set
|
||||||
|
# CONFIG_SPI_CALLBACK is not set
|
||||||
|
# CONFIG_STM32_CCMEXCLUDE is not set
|
||||||
|
CONFIG_ARCH="arm"
|
||||||
|
CONFIG_ARCH_BOARD="stm32f4discovery"
|
||||||
|
CONFIG_ARCH_BOARD_STM32F4_DISCOVERY=y
|
||||||
|
CONFIG_ARCH_BUTTONS=y
|
||||||
|
CONFIG_ARCH_CHIP="stm32"
|
||||||
|
CONFIG_ARCH_CHIP_STM32=y
|
||||||
|
CONFIG_ARCH_CHIP_STM32F407VG=y
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_BOARDCTL_RESET=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_CODECS_HASH_MD5=y
|
||||||
|
CONFIG_DEBUG_FULLOPT=y
|
||||||
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
|
CONFIG_DRIVERS_WIRELESS=y
|
||||||
|
CONFIG_EXAMPLES_HELLO=y
|
||||||
|
CONFIG_EXAMPLES_WEBSERVER=y
|
||||||
|
CONFIG_FAT_LFN=y
|
||||||
|
CONFIG_FS_FAT=y
|
||||||
|
CONFIG_FS_FATTIME=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_HAVE_CXX=y
|
||||||
|
CONFIG_HAVE_CXXINITIALIZE=y
|
||||||
|
CONFIG_HEAP_COLORATION=y
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_LIB_SENDFILE_BUFSIZE=1024
|
||||||
|
CONFIG_MAX_TASKS=16
|
||||||
|
CONFIG_MAX_WDOGPARMS=2
|
||||||
|
CONFIG_MMCSD=y
|
||||||
|
CONFIG_MM_REGIONS=2
|
||||||
|
CONFIG_NET=y
|
||||||
|
CONFIG_NETDB_DNSCLIENT=y
|
||||||
|
CONFIG_NETDEVICES=y
|
||||||
|
CONFIG_NETINIT_NETLOCAL=y
|
||||||
|
CONFIG_NETUTILS_CODECS=y
|
||||||
|
CONFIG_NETUTILS_FTPC=y
|
||||||
|
CONFIG_NETUTILS_HTTPD_DIRLIST=y
|
||||||
|
CONFIG_NETUTILS_HTTPD_SENDFILE=y
|
||||||
|
CONFIG_NETUTILS_TELNETD=y
|
||||||
|
CONFIG_NETUTILS_WEBCLIENT=y
|
||||||
|
CONFIG_NETUTILS_WEBSERVER=y
|
||||||
|
CONFIG_NET_BROADCAST=y
|
||||||
|
CONFIG_NET_ICMP=y
|
||||||
|
CONFIG_NET_LOCAL=y
|
||||||
|
CONFIG_NET_TCP_NO_STACK=y
|
||||||
|
CONFIG_NET_UDP_NO_STACK=y
|
||||||
|
CONFIG_NET_USRSOCK=y
|
||||||
|
CONFIG_NET_USRSOCK_CONNS=16
|
||||||
|
CONFIG_NET_USRSOCK_UDP=y
|
||||||
|
CONFIG_NFILE_DESCRIPTORS=8
|
||||||
|
CONFIG_NFILE_STREAMS=8
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_FILEIOSIZE=512
|
||||||
|
CONFIG_NSH_LINELEN=64
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_PREALLOC_MQ_MSGS=4
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_PREALLOC_WDOGS=16
|
||||||
|
CONFIG_RAM_SIZE=114688
|
||||||
|
CONFIG_RAM_START=0x20000000
|
||||||
|
CONFIG_RAW_BINARY=y
|
||||||
|
CONFIG_READLINE_CMD_HISTORY=y
|
||||||
|
CONFIG_RR_INTERVAL=200
|
||||||
|
CONFIG_SCHED_LPWORK=y
|
||||||
|
CONFIG_SCHED_LPWORKPRIORITY=30
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_SDCLONE_DISABLE=y
|
||||||
|
CONFIG_STACK_COLORATION=y
|
||||||
|
CONFIG_START_DAY=22
|
||||||
|
CONFIG_START_MONTH=10
|
||||||
|
CONFIG_START_YEAR=2019
|
||||||
|
CONFIG_STM32_DMA1=y
|
||||||
|
CONFIG_STM32_DMA2=y
|
||||||
|
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||||
|
CONFIG_STM32_PWR=y
|
||||||
|
CONFIG_STM32_SPI2=y
|
||||||
|
CONFIG_STM32_SPI2_DMA=y
|
||||||
|
CONFIG_STM32_SPI3=y
|
||||||
|
CONFIG_STM32_SPI3_DMA=y
|
||||||
|
CONFIG_STM32_SPI_DMA=y
|
||||||
|
CONFIG_STM32_USART2=y
|
||||||
|
CONFIG_SYSTEM_DHCPC_RENEW=y
|
||||||
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
CONFIG_SYSTEM_NSH_CXXINITIALIZE=y
|
||||||
|
CONFIG_SYSTEM_NTPC=y
|
||||||
|
CONFIG_TESTING_OSTEST=y
|
||||||
|
CONFIG_USART2_RXBUFSIZE=128
|
||||||
|
CONFIG_USART2_SERIAL_CONSOLE=y
|
||||||
|
CONFIG_USART2_TXBUFSIZE=128
|
||||||
|
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||||
|
CONFIG_WIRELESS_GS2200M=y
|
||||||
|
CONFIG_WL_GS2200M=y
|
||||||
|
CONFIG_WL_GS2200M_DISABLE_DHCPC=y
|
||||||
|
CONFIG_WL_GS2200M_SPI_FREQUENCY=10000000
|
@ -220,4 +220,8 @@ ifeq ($(CONFIG_MMCSD_SPI),y)
|
|||||||
CSRCS += stm32_mmcsd.c
|
CSRCS += stm32_mmcsd.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_WL_GS2200M),y)
|
||||||
|
CSRCS += stm32_gs2200m.c
|
||||||
|
endif
|
||||||
|
|
||||||
include $(TOPDIR)/boards/Board.mk
|
include $(TOPDIR)/boards/Board.mk
|
||||||
|
@ -458,5 +458,13 @@ int stm32_bringup(void)
|
|||||||
usbdev_rndis_initialize(mac);
|
usbdev_rndis_initialize(mac);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_WL_GS2200M
|
||||||
|
ret = stm32_gs2200m_initialize("/dev/gs2200m", 3);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
serr("ERROR: Failed to initialze GS2200M: %d \n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
267
boards/arm/stm32/stm32f4discovery/src/stm32_gs2200m.c
Normal file
267
boards/arm/stm32/stm32f4discovery/src/stm32_gs2200m.c
Normal file
@ -0,0 +1,267 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm/stm32/stm32f4discovery/src/stm32_gs2200m.c
|
||||||
|
*
|
||||||
|
* Copyright 2019 Sony Home Entertainment & Sound Products Inc.
|
||||||
|
* Author: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
|
||||||
|
*
|
||||||
|
* 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 of Sony Semiconductor Solutions Corporation 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 <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/arch.h>
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
#include <nuttx/spi/spi.h>
|
||||||
|
#include <nuttx/irq.h>
|
||||||
|
#include <nuttx/wireless/gs2200m.h>
|
||||||
|
|
||||||
|
#include "up_arch.h"
|
||||||
|
#include "chip.h"
|
||||||
|
#include "stm32.h"
|
||||||
|
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
#include "stm32f4discovery.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#define GPIO_GS2200M_INT (GPIO_INPUT | GPIO_FLOAT | GPIO_EXTI | \
|
||||||
|
GPIO_OPENDRAIN | GPIO_PORTD | GPIO_PIN2)
|
||||||
|
|
||||||
|
#define GPIO_GS2200M_XRST (GPIO_OUTPUT | GPIO_PUSHPULL | \
|
||||||
|
GPIO_OUTPUT_SET | GPIO_SPEED_50MHz | \
|
||||||
|
GPIO_PORTE | GPIO_PIN4)
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static int gs2200m_irq_attach(xcpt_t, FAR void *);
|
||||||
|
static void gs2200m_irq_enable(void);
|
||||||
|
static void gs2200m_irq_disable(void);
|
||||||
|
static uint32_t gs2200m_dready(int *);
|
||||||
|
static void gs2200m_reset(bool);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static const struct gs2200m_lower_s g_wifi_lower =
|
||||||
|
{
|
||||||
|
.attach = gs2200m_irq_attach,
|
||||||
|
.enable = gs2200m_irq_enable,
|
||||||
|
.disable = gs2200m_irq_disable,
|
||||||
|
.dready = gs2200m_dready,
|
||||||
|
.reset = gs2200m_reset
|
||||||
|
};
|
||||||
|
|
||||||
|
static FAR void *g_devhandle = NULL;
|
||||||
|
static volatile int32_t _enable_count = 0;
|
||||||
|
static volatile uint32_t _n_called;
|
||||||
|
|
||||||
|
static xcpt_t g_irq_handler = NULL;
|
||||||
|
static FAR void *g_irq_arg = NULL;
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: gs2200m_irq_attach
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static int gs2200m_irq_attach(xcpt_t handler, FAR void *arg)
|
||||||
|
{
|
||||||
|
/* NOTE: Just save the hander and arg here */
|
||||||
|
|
||||||
|
g_irq_handler = handler;
|
||||||
|
g_irq_arg = arg;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: gs2200m_irq_enable
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static void gs2200m_irq_enable(void)
|
||||||
|
{
|
||||||
|
irqstate_t flags = spin_lock_irqsave();
|
||||||
|
uint32_t dready = 0;
|
||||||
|
|
||||||
|
wlinfo("== ec:%d called=%d \n", _enable_count, _n_called++);
|
||||||
|
|
||||||
|
if (1 == _enable_count)
|
||||||
|
{
|
||||||
|
/* NOTE: This would happen if we received an event */
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_enable_count++;
|
||||||
|
|
||||||
|
if (1 == _enable_count)
|
||||||
|
{
|
||||||
|
/* Check if irq has been asserted */
|
||||||
|
|
||||||
|
dready = gs2200m_dready(NULL);
|
||||||
|
|
||||||
|
/* NOTE: stm32 does not support level-triggered irq */
|
||||||
|
|
||||||
|
(void)stm32_gpiosetevent(GPIO_GS2200M_INT, true, false,
|
||||||
|
true, g_irq_handler, g_irq_arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
spin_unlock_irqrestore(flags);
|
||||||
|
|
||||||
|
if (dready)
|
||||||
|
{
|
||||||
|
/* Call g_irq_handler directly */
|
||||||
|
|
||||||
|
wlinfo("== ** call irq handler ** \n");
|
||||||
|
g_irq_handler(0, NULL, g_irq_arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: gs2200m_irq_disable
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static void gs2200m_irq_disable(void)
|
||||||
|
{
|
||||||
|
irqstate_t flags = spin_lock_irqsave();
|
||||||
|
|
||||||
|
wlinfo("== ec:%d called=%d \n", _enable_count, _n_called++);
|
||||||
|
|
||||||
|
_enable_count--;
|
||||||
|
|
||||||
|
if (0 == _enable_count)
|
||||||
|
{
|
||||||
|
(void)stm32_gpiosetevent(GPIO_GS2200M_INT, false, false,
|
||||||
|
false, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
spin_unlock_irqrestore(flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: gs2200m_dready
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static uint32_t gs2200m_dready(int *ec)
|
||||||
|
{
|
||||||
|
irqstate_t flags = spin_lock_irqsave();
|
||||||
|
|
||||||
|
uint32_t r = stm32_gpioread(GPIO_GS2200M_INT);
|
||||||
|
|
||||||
|
if (ec)
|
||||||
|
{
|
||||||
|
/* Copy enable count (just for debug) */
|
||||||
|
|
||||||
|
*ec = _enable_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
spin_unlock_irqrestore(flags);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: gs2200m_reset
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static void gs2200m_reset(bool reset)
|
||||||
|
{
|
||||||
|
stm32_gpiowrite(GPIO_GS2200M_XRST, !reset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: spi_pincontrol
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Configure SPI1 pins
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static void _config_pin(void)
|
||||||
|
{
|
||||||
|
stm32_configgpio(GPIO_GS2200M_XRST); /* Assign PD6 as XRST */
|
||||||
|
stm32_configgpio(GPIO_GS2200M_INT); /* Assign PD2 as IRQ */
|
||||||
|
stm32_configgpio(GPIO_SPI3_SCK_1); /* Assign PB3 as SPI3_SCK */
|
||||||
|
stm32_configgpio(GPIO_SPI3_MISO_1); /* Assign PB4 as SPI3_MISO */
|
||||||
|
stm32_configgpio(GPIO_SPI3_MOSI_1); /* Assign PB5 as SPI3_MOSI */
|
||||||
|
stm32_configgpio(GPIO_GS2200M_CS); /* Assign PD7 as chip select */
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: stm32_gs2200m_initialize
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int stm32_gs2200m_initialize(FAR const char *devpath, int bus)
|
||||||
|
{
|
||||||
|
FAR struct spi_dev_s *spi;
|
||||||
|
|
||||||
|
wlinfo("Initializing GS2200M..\n");
|
||||||
|
|
||||||
|
if (!g_devhandle)
|
||||||
|
{
|
||||||
|
/* Configure pin */
|
||||||
|
|
||||||
|
_config_pin();
|
||||||
|
|
||||||
|
/* Initialize spi deivce */
|
||||||
|
|
||||||
|
spi = stm32_spibus_initialize(bus);
|
||||||
|
|
||||||
|
if (!spi)
|
||||||
|
{
|
||||||
|
wlerr("ERROR: Failed to initialize spi%d.\n", bus);
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_devhandle = gs2200m_register(devpath, spi, &g_wifi_lower);
|
||||||
|
|
||||||
|
if (!g_devhandle)
|
||||||
|
{
|
||||||
|
wlerr("ERROR: Failed to register gs2200m driver.\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
@ -202,6 +202,13 @@ uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
|
|||||||
void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
|
void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
|
||||||
{
|
{
|
||||||
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
|
|
||||||
|
#if defined(CONFIG_WL_GS2200M)
|
||||||
|
if (devid == SPIDEV_WIRELESS(0))
|
||||||
|
{
|
||||||
|
stm32_gpiowrite(GPIO_GS2200M_CS, !selected);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
|
uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
|
||||||
|
@ -265,6 +265,9 @@
|
|||||||
#define GPIO_MAX7219_CS (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
|
#define GPIO_MAX7219_CS (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
|
||||||
GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN3)
|
GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN3)
|
||||||
|
|
||||||
|
#define GPIO_GS2200M_CS (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
|
||||||
|
GPIO_OUTPUT_SET|GPIO_PORTE|GPIO_PIN5)
|
||||||
|
|
||||||
/* XEN1210 magnetic sensor */
|
/* XEN1210 magnetic sensor */
|
||||||
|
|
||||||
#define GPIO_XEN1210_INT (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|\
|
#define GPIO_XEN1210_INT (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|\
|
||||||
@ -865,5 +868,25 @@ int xen1210_archinitialize(int minor);
|
|||||||
int hciuart_dev_initialize(void);
|
int hciuart_dev_initialize(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: stm32_gs2200m_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Configure the gs2200m driver.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* devpath - The full path to the device.
|
||||||
|
* bus - The SPI bus number
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero (OK) is returned on success; A negated errno value is returned
|
||||||
|
* to indicate the nature of any failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_WL_GS2200M
|
||||||
|
int stm32_gs2200m_initialize(FAR const char *devpath, int bus);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
#endif /* __BOARDS_ARM_STM32_STM32F4DISCOVERY_SRC_STM32F4DISCOVERY_H */
|
#endif /* __BOARDS_ARM_STM32_STM32F4DISCOVERY_SRC_STM32F4DISCOVERY_H */
|
||||||
|
@ -817,10 +817,14 @@ static void _write_data(FAR struct gs2200m_dev_s *dev,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
SPI_SELECT(dev->spi, SPIDEV_WIRELESS(0), true);
|
||||||
|
|
||||||
for (i = 0; i < len; i++, buf++)
|
for (i = 0; i < len; i++, buf++)
|
||||||
{
|
{
|
||||||
SPI_SEND(dev->spi, *buf);
|
SPI_SEND(dev->spi, *buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SPI_SELECT(dev->spi, SPIDEV_WIRELESS(0), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -837,10 +841,14 @@ static void _read_data(FAR struct gs2200m_dev_s *dev,
|
|||||||
|
|
||||||
memset(buff, 0, len);
|
memset(buff, 0, len);
|
||||||
|
|
||||||
|
SPI_SELECT(dev->spi, SPIDEV_WIRELESS(0), true);
|
||||||
|
|
||||||
for (i = 0; i < len; i++, buff++)
|
for (i = 0; i < len; i++, buff++)
|
||||||
{
|
{
|
||||||
SPI_EXCHANGE(dev->spi, &req, buff, 1);
|
SPI_EXCHANGE(dev->spi, &req, buff, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SPI_SELECT(dev->spi, SPIDEV_WIRELESS(0), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user