diff --git a/arch/arm/src/stm32f0/chip/stm32f0_pinmap.h b/arch/arm/src/stm32f0/chip/stm32f0_pinmap.h new file mode 100644 index 00000000000..a586cbdbc73 --- /dev/null +++ b/arch/arm/src/stm32f0/chip/stm32f0_pinmap.h @@ -0,0 +1,53 @@ +/************************************************************************************ + * arch/arm/src/stm32f0/chip/stm32f0_pinmap.h + * + * Copyright (C) 2015 Sebastien Lorquet. All rights reserved. + * Author: Sebastien Lorquet + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_STM32F0_CHIP_STM32F0_PINMAP_H +#define __ARCH_ARM_SRC_STM32F0_CHIP_STM32F0_PINMAP_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include +#include "chip.h" + +#if defined(CONFIG_STM32F0_STM32F05X) +# include "chip/stm32f05xr_pinmap.h" +#else +# error "Unsupported STM32F0 pin map" +#endif + +#endif /* __ARCH_ARM_SRC_STM32F0_CHIP_STM32F0_PINMAP_H */ + diff --git a/arch/arm/src/stm32f0/stm32f0_serial.c b/arch/arm/src/stm32f0/stm32f0_serial.c index 66f88e38eb3..6c122328af6 100644 --- a/arch/arm/src/stm32f0/stm32f0_serial.c +++ b/arch/arm/src/stm32f0/stm32f0_serial.c @@ -59,14 +59,21 @@ #endif #include -#include -#include "chip.h" -#include "stm32f0_uart.h" -//#include "stm32f0_dma.h" -#include "stm32f0_rcc.h" #include "up_arch.h" #include "up_internal.h" +#include "chip.h" +#include "stm32f0_gpio.h" +#include "stm32f0_uart.h" +#include "stm32f0_rcc.h" +#include "chip/stm32f0_pinmap.h" + +/* board.h should be included last. It may depend on defintions from + * previous header files and it may, in certain cases, override definitions + * provided in previous header files. + */ + +#include /**************************************************************************** * Pre-processor Definitions diff --git a/configs/stm32f0discovery/include/board.h b/configs/stm32f0discovery/include/board.h index 4123b11f560..4840067e96d 100644 --- a/configs/stm32f0discovery/include/board.h +++ b/configs/stm32f0discovery/include/board.h @@ -237,38 +237,5 @@ #define BUTTON_USER_BIT (1 << BUTTON_USER) /* Alternate Pin Functions **********************************************************/ -/* The STM32L-Discovery has no on-board RS-232 driver. Further, there are no USART - * pins that do not conflict with the on board resources, in particular, the LCD: - * Most USART pins are available if the LCD is enabled; USART2 may be used if either - * the LCD or the on-board LEDs are disabled. - * - * PA9 USART1_TX LCD glass COM1 P2, pin 22 - * PA10 USART1_RX LCD glass COM2 P2, pin 21 - * PB6 USART1_TX LED Blue P2, pin 8 - * PB7 USART1_RX LED Green P2, pin 7 - * - * PA2 USART2_TX LCD SEG1 P1, pin 17 - * PA3 USART2_RX LCD SEG2 P1, pin 18 - * - * PB10 USART3_TX LCD SEG6 P1, pin 22 - * PB11 USART3_RX LCD SEG7 P1, pin 23 - * PC10 USART3_TX LCD SEG22 P2, pin 15 - * PC11 USART3_RX LCD SEG23 P2, pin 14 - */ - -/* Select PA9 and PA10 if the LCD is not enabled */ - -//#define GPIO_USART1_RX GPIO_USART1_RX_1 /* PA10 */ -//#define GPIO_USART1_TX GPIO_USART1_TX_1 /* PA9 */ - -/* This there are no other options for USART1 on this part */ - -#define GPIO_USART2_RX GPIO_USART2_RX_1 /* PA3 */ -#define GPIO_USART2_TX GPIO_USART2_TX_1 /* PA2 */ - -/* Arbirtrarily select PB10 and PB11 */ - -#define GPIO_USART3_RX GPIO_USART3_RX_1 /* PB11 */ -#define GPIO_USART3_TX GPIO_USART3_TX_1 /* PB10 */ #endif /* __CONFIG_STM32F0DISCOVERY_INCLUDE_BOARD_H */