2016-08-15 17:34:43 +02:00
|
|
|
/*****************************************************************************
|
2019-08-19 15:16:08 +00:00
|
|
|
* boards/arm/stm32/stm32butterfly2/src/stm32_butterfly2.h
|
2016-08-15 17:34:43 +02:00
|
|
|
*
|
|
|
|
* Copyright (C) 2016 Michał Łyszczek. All rights reserved.
|
|
|
|
* Author: Michał Łyszczek <michal.lyszczek@gmail.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 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.
|
|
|
|
****************************************************************************/
|
|
|
|
|
2019-08-19 15:16:08 +00:00
|
|
|
#ifndef __BOARDS_ARM_STM32_STM32_BUTTERFLY2_SRC_STM32_BUTTERFLY2_H
|
|
|
|
#define __BOARDS_ARM_STM32_STM32_BUTTERFLY2_SRC_STM32_BUTTERFLY2_H 1
|
2016-08-17 22:03:24 +02:00
|
|
|
|
2016-08-15 17:34:43 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "stm32_gpio.h"
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2016-08-17 20:13:17 +02:00
|
|
|
/* SD Card pins */
|
|
|
|
|
2016-08-15 17:34:43 +02:00
|
|
|
#define GPIO_SD_CS (GPIO_OUTPUT | GPIO_CNF_OUTPP | GPIO_MODE_50MHz |\
|
|
|
|
GPIO_OUTPUT_SET | GPIO_PORTA | GPIO_PIN4)
|
|
|
|
#define GPIO_SD_CD (GPIO_INPUT | GPIO_CNF_INFLOAT | GPIO_EXTI |\
|
|
|
|
GPIO_PORTB | GPIO_PIN9)
|
|
|
|
|
2016-08-17 20:13:17 +02:00
|
|
|
/* USB pins */
|
|
|
|
|
|
|
|
#define GPIO_OTGFS_PWRON (GPIO_OUTPUT | GPIO_CNF_OUTPP | GPIO_MODE_50MHz |\
|
|
|
|
GPIO_OUTPUT_SET | GPIO_PORTD | GPIO_PIN15)
|
|
|
|
|
2016-08-15 17:34:43 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2016-08-17 21:34:51 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* Name: stm32_led_initialize
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Initializes low level gpio pins for board LEDS
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void stm32_led_initialize(void);
|
|
|
|
|
2016-08-15 17:34:43 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* Name: stm32_spidev_initialize
|
|
|
|
*
|
|
|
|
* Description:
|
2016-08-17 20:13:17 +02:00
|
|
|
* Called to configure SPI chip select GPIO pins.
|
2016-08-15 17:34:43 +02:00
|
|
|
*
|
|
|
|
* Note:
|
2016-08-17 20:13:17 +02:00
|
|
|
* Here only CS pins are configured as SPI pins are configured by driver
|
|
|
|
* itself.
|
2016-08-15 17:34:43 +02:00
|
|
|
****************************************************************************/
|
|
|
|
|
2016-08-17 21:34:51 +02:00
|
|
|
#ifdef CONFIG_STM32_SPI1
|
2016-08-15 17:34:43 +02:00
|
|
|
void stm32_spidev_initialize(void);
|
2016-08-17 21:34:51 +02:00
|
|
|
#else
|
2016-08-18 16:16:19 +02:00
|
|
|
static inline void stm32_spidev_initialize(void) {}
|
2016-08-17 21:34:51 +02:00
|
|
|
#endif
|
2016-08-15 17:34:43 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
2016-08-17 21:34:51 +02:00
|
|
|
* Name: stm32_mmcsd_initialize
|
2016-08-15 17:34:43 +02:00
|
|
|
*
|
|
|
|
* Description:
|
2016-08-17 20:13:17 +02:00
|
|
|
* Initializes SPI-based SD card
|
2016-08-15 17:34:43 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2016-08-17 21:34:51 +02:00
|
|
|
#ifdef CONFIG_MMCSD
|
|
|
|
int stm32_mmcsd_initialize(int minor);
|
|
|
|
#else
|
2016-08-18 16:16:19 +02:00
|
|
|
static inline int stm32_mmcsd_initialize(int minor) { (void)minor; return 0; }
|
2016-08-17 21:34:51 +02:00
|
|
|
#endif
|
2016-08-15 17:34:43 +02:00
|
|
|
|
2016-08-17 20:13:17 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* Name: stm32_usb_initialize
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Initializes USB pins
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_OTGFS
|
|
|
|
void stm32_usb_initialize(void);
|
|
|
|
#else
|
|
|
|
static inline void stm32_usb_initialize(void) {}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* Name: stm32_usbhost_initialize
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Initializes USB host functionality.
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_USBHOST
|
|
|
|
int stm32_usbhost_initialize(void);
|
|
|
|
#else
|
2016-08-18 16:16:19 +02:00
|
|
|
static inline int stm32_usbhost_initialize(void) { return 0; }
|
2016-08-17 20:13:17 +02:00
|
|
|
#endif
|
|
|
|
|
2019-08-19 15:16:08 +00:00
|
|
|
/****************************************************************************
|
2016-12-05 17:06:08 -06:00
|
|
|
* Name: stm32_adc_setup
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Initialize ADC and register the ADC driver.
|
|
|
|
*
|
2019-08-19 15:16:08 +00:00
|
|
|
****************************************************************************/
|
2016-12-05 17:06:08 -06:00
|
|
|
|
|
|
|
#ifdef CONFIG_STM32_ADC
|
|
|
|
int stm32_adc_setup(void);
|
|
|
|
#else
|
|
|
|
static inline int stm32_adc_setup(void) { return 0; }
|
|
|
|
#endif
|
|
|
|
|
2019-08-19 15:16:08 +00:00
|
|
|
#endif /* __BOARDS_ARM_STM32_STM32_BUTTERFLY2_SRC_STM32_BUTTERFLY2_H */
|