mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 06:23:53 +01:00
board: Initial import of stm32f0discovery
This commit is contained in:
parent
e01ac410a5
commit
0a9f4ed6a3
4
boards/stm32f0discovery/Makefile
Normal file
4
boards/stm32f0discovery/Makefile
Normal file
@ -0,0 +1,4 @@
|
||||
# tell the Makefile.base which module to build
|
||||
MODULE = $(BOARD)_base
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
48
boards/stm32f0discovery/Makefile.include
Normal file
48
boards/stm32f0discovery/Makefile.include
Normal file
@ -0,0 +1,48 @@
|
||||
# define the cpu used by the stm32f0-discovery board
|
||||
export CPU = stm32f0
|
||||
export CPU_MODEL = stm32f051r8
|
||||
|
||||
#define the default port depending on the host OS
|
||||
OS := $(shell uname)
|
||||
ifeq ($(OS),Linux)
|
||||
PORT ?= /dev/ttyUSB0
|
||||
else ifeq ($(OS),Darwin)
|
||||
PORT ?= $(shell ls -1 /dev/tty.SLAB_USBtoUART* | head -n 1)
|
||||
else
|
||||
$(info CAUTION: No flash tool for your host system found!)
|
||||
# TODO: add support for windows as host platform
|
||||
endif
|
||||
export PORT
|
||||
|
||||
# define tools used for building the project
|
||||
export PREFIX = arm-none-eabi-
|
||||
export CC = $(PREFIX)gcc
|
||||
export AR = $(PREFIX)ar
|
||||
export AS = $(PREFIX)as
|
||||
export LINK = $(PREFIX)gcc
|
||||
export SIZE = $(PREFIX)size
|
||||
export OBJCOPY = $(PREFIX)objcopy
|
||||
export TERMPROG = $(RIOTBASE)/dist/tools/pyterm/pyterm.py
|
||||
export FLASHER = st-flash
|
||||
export DEBUGGER = $(RIOTBOARD)/$(BOARD)/dist/debug.sh
|
||||
|
||||
# define build specific options
|
||||
CPU_USAGE = -mcpu=cortex-m0
|
||||
FPU_USAGE =
|
||||
export CFLAGS += -ggdb -g3 -std=gnu99 -Os -Wall -Wstrict-prototypes $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian -mthumb -mthumb-interwork -nostartfiles
|
||||
export CFLAGS += -ffunction-sections -fdata-sections -fno-builtin
|
||||
export ASFLAGS += -ggdb -g3 $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian
|
||||
export LINKFLAGS += -g3 -ggdb -std=gnu99 $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian -static -lgcc -mthumb -mthumb-interwork -nostartfiles
|
||||
# $(LINKERSCRIPT) is specified in cpu/Makefile.include
|
||||
export LINKFLAGS += -T$(LINKERSCRIPT)
|
||||
export OFLAGS = -O binary
|
||||
export FFLAGS = write bin/$(BOARD)/$(APPLICATION).hex 0x08000000
|
||||
export DEBUGGER_FLAGS = $(RIOTBOARD)/$(BOARD)/dist/gdb.conf bin/$(BOARD)/$(APPLICATION).elf
|
||||
|
||||
# use the nano-specs of the NewLib when available
|
||||
ifeq ($(shell $(LINK) -specs=nano.specs -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
|
||||
export LINKFLAGS += -specs=nano.specs -lc -lnosys
|
||||
endif
|
||||
|
||||
# export board specific includes to the global includes-listing
|
||||
export INCLUDES += -I$(RIOTBOARD)/$(BOARD)/include
|
||||
63
boards/stm32f0discovery/board.c
Normal file
63
boards/stm32f0discovery/board.c
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser General
|
||||
* Public License v2.1. See the file LICENSE in the top level directory for more
|
||||
* details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup board_stm32f0discovery
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific implementations for the STM32F0Discovery evaluation board
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "board.h"
|
||||
#include "periph/uart.h"
|
||||
|
||||
|
||||
static void leds_init(void);
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
/* initialize the boards LEDs */
|
||||
leds_init();
|
||||
|
||||
/* initialize the CPU */
|
||||
cpu_init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize the boards on-board LEDs (LD3 and LD4)
|
||||
*
|
||||
* The LED initialization is hard-coded in this function. As the LEDs are soldered
|
||||
* onto the board they are fixed to their CPU pins.
|
||||
*
|
||||
* The LEDs are connected to the following pins:
|
||||
* - LD3: PC8
|
||||
* - LD4: PC9
|
||||
*/
|
||||
void leds_init(void)
|
||||
{
|
||||
/* enable clock for port GPIOC */
|
||||
RCC->AHBENR |= RCC_AHBENR_GPIOCEN;
|
||||
|
||||
/* set output speed to 50MHz */
|
||||
LED_PORT->OSPEEDR |= 0x000f0000;
|
||||
/* set output type to push-pull */
|
||||
LED_PORT->OTYPER &= ~(0x00000300);
|
||||
/* configure pins as general outputs */
|
||||
LED_PORT->MODER &= ~(0x000f0000);
|
||||
LED_PORT->MODER |= 0x00050000;
|
||||
/* disable pull resistors */
|
||||
LED_PORT->PUPDR &= ~(0x000f0000);
|
||||
|
||||
/* turn all LEDs off */
|
||||
LED_PORT->BRR = 0x0300;
|
||||
}
|
||||
4
boards/stm32f0discovery/dist/debug.sh
vendored
Executable file
4
boards/stm32f0discovery/dist/debug.sh
vendored
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Debugging $1"
|
||||
arm-none-eabi-gdb -tui -command=$1 $2
|
||||
1
boards/stm32f0discovery/dist/gdb.conf
vendored
Normal file
1
boards/stm32f0discovery/dist/gdb.conf
vendored
Normal file
@ -0,0 +1 @@
|
||||
tar extended-remote :4242
|
||||
77
boards/stm32f0discovery/include/board.h
Normal file
77
boards/stm32f0discovery/include/board.h
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser General
|
||||
* Public License v2.1. See the file LICENSE in the top level directory for more
|
||||
* details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup board_stm32f0discovery STM32F0Discovery
|
||||
* @ingroup boards
|
||||
* @brief Support for the STM32F0Discovery board
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific definitions for the STM32F0Discovery evaluation board.
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
*/
|
||||
|
||||
#ifndef __BOARD_H
|
||||
#define __BOARD_H
|
||||
|
||||
#include "cpu.h"
|
||||
|
||||
|
||||
/**
|
||||
* @name The nominal CPU core clock in this board
|
||||
*/
|
||||
#define F_CPU (48000000UL)
|
||||
|
||||
/**
|
||||
* @name Assign the peripheral timer to be used as hardware timer
|
||||
*/
|
||||
#define HW_TIMER TIMER_0
|
||||
|
||||
/**
|
||||
* @name Assign the UART interface to be used for stdio
|
||||
*/
|
||||
#define STDIO UART_0
|
||||
|
||||
/**
|
||||
* @name LED pin definitions
|
||||
* @{
|
||||
*/
|
||||
#define LED_PORT GPIOC
|
||||
#define LD3_PIN (1 << 9)
|
||||
#define LD4_PIN (1 << 8)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Macros for controlling the on-board LEDs.
|
||||
* @{
|
||||
*/
|
||||
#define LD3_ON (LED_PORT->BSRR = LD3_PIN)
|
||||
#define LD3_OFF (LED_PORT->BRR = LD3_PIN)
|
||||
#define LD3_TOGGLE (LED_PORT->ODR ^= LD3_PIN)
|
||||
#define LD4_ON (LED_PORT->BSRR = LD4_PIN)
|
||||
#define LD4_OFF (LED_PORT->BRR = LD4_PIN)
|
||||
#define LD4_TOGGLE (LED_PORT->ODR ^= LD4_PIN)
|
||||
|
||||
/* for compatibility to other boards */
|
||||
#define LED_GREEN_ON LD4_ON
|
||||
#define LED_GREEN_OFF LD4_OFF
|
||||
#define LED_GREEN_TOGGLE LD4_TOGGLE
|
||||
#define LED_RED_ON LD3_ON
|
||||
#define LED_RED_OFF LD3_OFF
|
||||
#define LED_RED_TOGGLE LD3_TOGGLE
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
||||
*/
|
||||
void board_init(void);
|
||||
|
||||
#endif /** __BOARD_H */
|
||||
/** @} */
|
||||
376
boards/stm32f0discovery/include/periph_conf.h
Normal file
376
boards/stm32f0discovery/include/periph_conf.h
Normal file
@ -0,0 +1,376 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser General
|
||||
* Public License v2.1. See the file LICENSE in the top level directory for more
|
||||
* details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup board_stm32f0discovery
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Peripheral MCU configuration for the STM32F0discovery board
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
*/
|
||||
|
||||
#ifndef __PERIPH_CONF_H
|
||||
#define __PERIPH_CONF_H
|
||||
|
||||
/**
|
||||
* @name Clock system configuration
|
||||
* @{
|
||||
*/
|
||||
#define CLOCK_HSE (8000000U) /* external oscillator */
|
||||
#define CLOCK_CORECLOCK (48000000U) /* desired core clock frequency */
|
||||
|
||||
/* the actual PLL values are automatically generated */
|
||||
#define CLOCK_PLL_MUL (CLOCK_CORECLOCK / CLOCK_HSE)
|
||||
/** @} */
|
||||
|
||||
|
||||
/**
|
||||
* @name Timer configuration
|
||||
* @{
|
||||
*/
|
||||
#define TIMER_NUMOF (1U)
|
||||
#define TIMER_0_EN 1
|
||||
#define TIMER_1_EN 0
|
||||
|
||||
/* Timer 0 configuration */
|
||||
#define TIMER_0_DEV TIM2
|
||||
#define TIMER_0_CHANNELS 4
|
||||
#define TIMER_0_PRESCALER (47U)
|
||||
#define TIMER_0_MAX_VALUE (0xffffffff)
|
||||
#define TIMER_0_CLKEN() (RCC->APB1ENR |= RCC_APB1ENR_TIM2EN)
|
||||
#define TIMER_0_ISR isr_tim2
|
||||
#define TIMER_0_IRQ_CHAN TIM2_IRQn
|
||||
#define TIMER_0_IRQ_PRIO 1
|
||||
|
||||
/* Timer 1 configuration */
|
||||
#define TIMER_1_DEV TIMx /* TODO */
|
||||
#define TIMER_1_CHANNELS
|
||||
#define TIMER_1_PRESCALER (47U)
|
||||
#define TIMER_1_MAX_VALUE (0xffff)
|
||||
#define TIMER_1_CLKEN()
|
||||
#define TIMER_1_ISR
|
||||
#define TIMER_1_IRQCHAN
|
||||
#define TIMER_1_IRQ_PRIO
|
||||
/** @} */
|
||||
|
||||
|
||||
/**
|
||||
* @name UART configuration
|
||||
* @{
|
||||
*/
|
||||
#define UART_NUMOF (2U)
|
||||
#define UART_0_EN 1
|
||||
#define UART_1_EN 1
|
||||
#define UART_IRQ_PRIO 1
|
||||
|
||||
/* UART 0 device configuration */
|
||||
#define UART_0_DEV USART1
|
||||
#define UART_0_CLKEN() (RCC->APB2ENR |= RCC_APB2ENR_USART1EN)
|
||||
#define UART_0_IRQ USART1_IRQn
|
||||
#define UART_0_ISR isr_usart1
|
||||
/* UART 0 pin configuration */
|
||||
#define UART_0_PORT GPIOB
|
||||
#define UART_0_PORT_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOBEN)
|
||||
#define UART_0_RX_PIN 7
|
||||
#define UART_0_TX_PIN 6
|
||||
#define UART_0_AF 0
|
||||
|
||||
/* UART 1 device configuration */
|
||||
#define UART_1_DEV USART2
|
||||
#define UART_1_CLKEN() (RCC->APB1ENR |= RCC_APB1ENR_USART2EN)
|
||||
#define UART_1_IRQ USART2_IRQn
|
||||
#define UART_1_ISR isr_usart2
|
||||
/* UART 1 pin configuration */
|
||||
#define UART_1_PORT GPIOA
|
||||
#define UART_1_PORT_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOAEN)
|
||||
#define UART_1_RX_PIN 3
|
||||
#define UART_1_TX_PIN 2
|
||||
#define UART_1_AF 1
|
||||
/** @} */
|
||||
|
||||
|
||||
/**
|
||||
* @name ADC configuration
|
||||
* @{
|
||||
*/
|
||||
#define ADC_NUMOF (0U)
|
||||
#define ADC_0_EN 0
|
||||
#define ADC_1_EN 0
|
||||
|
||||
/* ADC 0 configuration */
|
||||
#define ADC_0_DEV ADC1 /* TODO */
|
||||
#define ADC_0_SAMPLE_TIMER
|
||||
/* ADC 0 channel 0 pin config */
|
||||
#define ADC_0_C0_PORT
|
||||
#define ADC_0_C0_PIN
|
||||
#define ADC_0_C0_CLKEN()
|
||||
#define ADC_0_C0_AFCFG()
|
||||
/* ADC 0 channel 1 pin config */
|
||||
#define ADC_0_C1_PORT
|
||||
#define ADC_0_C1_PIN
|
||||
#define ADC_0_C1_CLKEN()
|
||||
#define ADC_0_C1_AFCFG()
|
||||
/* ADC 0 channel 2 pin config */
|
||||
#define ADC_0_C2_PORT
|
||||
#define ADC_0_C2_PIN
|
||||
#define ADC_0_C2_CLKEN()
|
||||
#define ADC_0_C2_AFCFG()
|
||||
/* ADC 0 channel 3 pin config */
|
||||
#define ADC_0_C3_PORT
|
||||
#define ADC_0_C3_PIN
|
||||
#define ADC_0_C3_CLKEN()
|
||||
#define ADC_0_C3_AFCFG()
|
||||
|
||||
/* ADC 0 configuration */
|
||||
#define ADC_1_DEV ADC2 /* TODO */
|
||||
#define ADC_1_SAMPLE_TIMER
|
||||
/* ADC 0 channel 0 pin config */
|
||||
#define ADC_1_C0_PORT
|
||||
#define ADC_1_C0_PIN
|
||||
#define ADC_1_C0_CLKEN()
|
||||
#define ADC_1_C0_AFCFG()
|
||||
/* ADC 0 channel 1 pin config */
|
||||
#define ADC_1_C1_PORT
|
||||
#define ADC_1_C1_PIN
|
||||
#define ADC_1_C1_CLKEN()
|
||||
#define ADC_1_C1_AFCFG()
|
||||
/* ADC 0 channel 2 pin config */
|
||||
#define ADC_1_C2_PORT
|
||||
#define ADC_1_C2_PIN
|
||||
#define ADC_1_C2_CLKEN()
|
||||
#define ADC_1_C2_AFCFG()
|
||||
/* ADC 0 channel 3 pin config */
|
||||
#define ADC_1_C3_PORT
|
||||
#define ADC_1_C3_PIN
|
||||
#define ADC_1_C3_CLKEN()
|
||||
#define ADC_1_C3_AFCFG()
|
||||
/** @} */
|
||||
|
||||
|
||||
/**
|
||||
* @name PWM configuration
|
||||
* @{
|
||||
*/
|
||||
#define PWM_NUMOF (0U) /* TODO */
|
||||
#define PWM_0_EN 0
|
||||
#define PWM_1_EN 0
|
||||
|
||||
/* PWM 0 device configuration */
|
||||
#define PWM_0_DEV
|
||||
#define PWM_0_CHANNELS
|
||||
/* PWM 0 pin configuration */
|
||||
#define PWM_0_PORT
|
||||
#define PWM_0_PINS
|
||||
#define PWM_0_PORT_CLKEN()
|
||||
#define PWM_0_CH1_AFCFG()
|
||||
#define PWM_0_CH2_AFCFG()
|
||||
#define PWM_0_CH3_AFCFG()
|
||||
#define PWM_0_CH4_AFCFG()
|
||||
|
||||
/* PWM 1 device configuration */
|
||||
#define PWM_1_DEV
|
||||
#define PWM_1_CHANNELS
|
||||
/* PWM 1 pin configuration */
|
||||
#define PWM_1_PORT
|
||||
#define PWM_1_PINS
|
||||
#define PWM_1_PORT_CLKEN()
|
||||
#define PWM_1_CH1_AFCFG()
|
||||
#define PWM_1_CH2_AFCFG()
|
||||
#define PWM_1_CH3_AFCFG()
|
||||
#define PWM_1_CH4_AFCFG()
|
||||
/** @} */
|
||||
|
||||
|
||||
/**
|
||||
* @name SPI configuration
|
||||
* @{
|
||||
*/
|
||||
#define SPI_NUMOF (0U) /* TODO */
|
||||
#define SPI_0_EN 0
|
||||
#define SPI_1_EN 0
|
||||
|
||||
/* SPI 0 device config */
|
||||
#define SPI_0_DEV
|
||||
#define SPI_0_CLKEN()
|
||||
#define SPI_0_IRQ SPI1_IRQn
|
||||
#define SPI_0_IRQ_HANDLER
|
||||
#define SPI_0_IRQ_PRIO 1
|
||||
/* SPI 1 pin configuration */
|
||||
#define SPI_0_PORT
|
||||
#define SPI_0_PINS
|
||||
#define SPI_1_PORT_CLKEN()
|
||||
#define SPI_1_SCK_AFCFG()
|
||||
#define SPI_1_MISO_AFCFG()
|
||||
#define SPI_1_MOSI_AFCFG()
|
||||
|
||||
/* SPI 1 device config */
|
||||
#define SPI_1_DEV SPI2
|
||||
#define SPI_1_CLKEN()
|
||||
#define SPI_1_IRQ SPI2_IRQn
|
||||
#define SPI_1_IRQ_HANDLER
|
||||
#define SPI_1_IRQ_PRIO 1
|
||||
/* SPI 1 pin configuration */
|
||||
#define SPI_1_PORT
|
||||
#define SPI_1_PINS
|
||||
#define SPI_1_PORT_CLKEN()
|
||||
#define SPI_1_SCK_AFCFG()
|
||||
#define SPI_1_MISO_AFCFG()
|
||||
#define SPI_1_MOSI_AFCFG()
|
||||
/** @} */
|
||||
|
||||
|
||||
/**
|
||||
* @name I2C configuration
|
||||
* @{
|
||||
*/
|
||||
#define I2C_NUMOF (0U) /* TODO */
|
||||
#define I2C_0_EN 0
|
||||
#define I2C_0_EN 0
|
||||
|
||||
/* SPI 0 device configuration */
|
||||
#define I2C_0_DEV I2C1
|
||||
#define I2C_0_CLKEN()
|
||||
#define I2C_0_ISR isr_i2c1
|
||||
#define I2C_0_IRQ I2C1_IRQn
|
||||
#define I2C_0_IRQ_PRIO 1
|
||||
/* SPI 0 pin configuration */
|
||||
#define I2C_0_PORT
|
||||
#define I2C_0_PINS
|
||||
#define I2C_0_PORT_CLKEN()
|
||||
#define I2C_0_SCL_AFCFG()
|
||||
#define I2C_0_SDA_AFCFG()
|
||||
|
||||
/* SPI 1 device configuration */
|
||||
#define I2C_1_DEV I2C2
|
||||
#define I2C_1_CLKEN()
|
||||
#define I2C_1_ISR isr_i2c2
|
||||
#define I2C_1_IRQ I2C2_IRQn
|
||||
#define I2C_1_IRQ_PRIO 1
|
||||
/* SPI 1 pin configuration */
|
||||
#define I2C_1_PORT
|
||||
#define I2C_1_PINS
|
||||
#define I2C_1_PORT_CLKEN()
|
||||
#define I2C_1_SCL_AFCFG()
|
||||
#define I2C_1_SDA_AFCFG()
|
||||
/** @} */
|
||||
|
||||
|
||||
/**
|
||||
* @name GPIO configuration
|
||||
* @{
|
||||
*/
|
||||
#define GPIO_NUMOF 12
|
||||
#define GPIO_0_EN 1
|
||||
#define GPIO_1_EN 1
|
||||
#define GPIO_2_EN 1
|
||||
#define GPIO_3_EN 1
|
||||
#define GPIO_4_EN 1
|
||||
#define GPIO_5_EN 1
|
||||
#define GPIO_6_EN 1
|
||||
#define GPIO_7_EN 1
|
||||
#define GPIO_8_EN 1
|
||||
#define GPIO_9_EN 1
|
||||
#define GPIO_10_EN 1
|
||||
#define GPIO_11_EN 1
|
||||
#define GPIO_IRQ_PRIO 1
|
||||
|
||||
/* IRQ config */
|
||||
#define GPIO_IRQ_0 GPIO_0
|
||||
#define GPIO_IRQ_1 GPIO_1
|
||||
#define GPIO_IRQ_2 GPIO_0 /* not configured */
|
||||
#define GPIO_IRQ_3 GPIO_0 /* not configured */
|
||||
#define GPIO_IRQ_4 GPIO_2
|
||||
#define GPIO_IRQ_5 GPIO_3
|
||||
#define GPIO_IRQ_6 GPIO_4
|
||||
#define GPIO_IRQ_7 GPIO_5
|
||||
#define GPIO_IRQ_8 GPIO_0 /* not configured */
|
||||
#define GPIO_IRQ_9 GPIO_0 /* not configured */
|
||||
#define GPIO_IRQ_10 GPIO_6
|
||||
#define GPIO_IRQ_11 GPIO_7
|
||||
#define GPIO_IRQ_12 GPIO_8
|
||||
#define GPIO_IRQ_13 GPIO_9
|
||||
#define GPIO_IRQ_14 GPIO_10
|
||||
#define GPIO_IRQ_15 GPIO_11
|
||||
|
||||
/* GPIO channel 0 config */
|
||||
#define GPIO_0_PORT GPIOA /* Used for user button 1 */
|
||||
#define GPIO_0_PIN 0
|
||||
#define GPIO_0_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOAEN)
|
||||
#define GPIO_0_EXTI_CFG() (SYSCFG->EXTICR[0] |= SYSCFG_EXTICR1_EXTI0_PA)
|
||||
#define GPIO_0_IRQ EXTI0_1_IRQn
|
||||
/* GPIO channel 1 config */
|
||||
#define GPIO_1_PORT GPIOA
|
||||
#define GPIO_1_PIN 1
|
||||
#define GPIO_1_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOAEN)
|
||||
#define GPIO_1_EXTI_CFG() (SYSCFG->EXTICR[0] |= SYSCFG_EXTICR1_EXTI1_PA)
|
||||
#define GPIO_1_IRQ EXTI0_1_IRQn
|
||||
/* GPIO channel 2 config */
|
||||
#define GPIO_2_PORT GPIOF
|
||||
#define GPIO_2_PIN 4
|
||||
#define GPIO_2_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOFEN)
|
||||
#define GPIO_2_EXTI_CFG() (SYSCFG->EXTICR[1] |= SYSCFG_EXTICR2_EXTI4_PF)
|
||||
#define GPIO_2_IRQ EXTI4_15_IRQn
|
||||
/* GPIO channel 3 config */
|
||||
#define GPIO_3_PORT GPIOF
|
||||
#define GPIO_3_PIN 5
|
||||
#define GPIO_3_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOFEN)
|
||||
#define GPIO_3_EXTI_CFG() (SYSCFG->EXTICR[1] |= SYSCFG_EXTICR2_EXTI5_PF)
|
||||
#define GPIO_3_IRQ EXTI4_15_IRQn
|
||||
/* GPIO channel 4 config */
|
||||
#define GPIO_4_PORT GPIOF
|
||||
#define GPIO_4_PIN 6
|
||||
#define GPIO_4_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOFEN)
|
||||
#define GPIO_4_EXTI_CFG() (SYSCFG->EXTICR[1] |= SYSCFG_EXTICR2_EXTI6_PF)
|
||||
#define GPIO_4_IRQ EXTI4_15_IRQn
|
||||
/* GPIO channel 5 config */
|
||||
#define GPIO_5_PORT GPIOF
|
||||
#define GPIO_5_PIN 7
|
||||
#define GPIO_5_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOFEN)
|
||||
#define GPIO_5_EXTI_CFG() (SYSCFG->EXTICR[1] |= SYSCFG_EXTICR2_EXTI7_PF)
|
||||
#define GPIO_5_IRQ EXTI4_15_IRQn
|
||||
/* GPIO channel 6 config */
|
||||
#define GPIO_6_PORT GPIOC
|
||||
#define GPIO_6_PIN 10
|
||||
#define GPIO_6_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOCEN)
|
||||
#define GPIO_6_EXTI_CFG() (SYSCFG->EXTICR[2] |= SYSCFG_EXTICR3_EXTI10_PC)
|
||||
#define GPIO_6_IRQ EXTI4_15_IRQn
|
||||
/* GPIO channel 7 config */
|
||||
#define GPIO_7_PORT GPIOC
|
||||
#define GPIO_7_PIN 11
|
||||
#define GPIO_7_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOCEN)
|
||||
#define GPIO_7_EXTI_CFG() (SYSCFG->EXTICR[2] |= SYSCFG_EXTICR3_EXTI11_PC)
|
||||
#define GPIO_7_IRQ EXTI4_15_IRQn
|
||||
/* GPIO channel 8 config */
|
||||
#define GPIO_8_PORT GPIOC
|
||||
#define GPIO_8_PIN 12
|
||||
#define GPIO_8_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOCEN)
|
||||
#define GPIO_8_EXTI_CFG() (SYSCFG->EXTICR[3] |= SYSCFG_EXTICR4_EXTI12_PC)
|
||||
#define GPIO_8_IRQ EXTI4_15_IRQn
|
||||
/* GPIO channel 9 config */
|
||||
#define GPIO_9_PORT GPIOC
|
||||
#define GPIO_9_PIN 13
|
||||
#define GPIO_9_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOCEN)
|
||||
#define GPIO_9_EXTI_CFG() (SYSCFG->EXTICR[3] |= SYSCFG_EXTICR4_EXTI13_PC)
|
||||
#define GPIO_9_IRQ EXTI4_15_IRQn
|
||||
/* GPIO channel 10 config */
|
||||
#define GPIO_10_PORT GPIOC
|
||||
#define GPIO_10_PIN 14
|
||||
#define GPIO_10_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOCEN)
|
||||
#define GPIO_10_EXTI_CFG() (SYSCFG->EXTICR[3] |= SYSCFG_EXTICR4_EXTI14_PC)
|
||||
#define GPIO_10_IRQ EXTI4_15_IRQn
|
||||
/* GPIO channel 11 config */
|
||||
#define GPIO_11_PORT GPIOC
|
||||
#define GPIO_11_PIN 15
|
||||
#define GPIO_11_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOCEN)
|
||||
#define GPIO_11_EXTI_CFG() (SYSCFG->EXTICR[3] |= SYSCFG_EXTICR4_EXTI15_PC)
|
||||
#define GPIO_11_IRQ EXTI4_15_IRQn
|
||||
/** @} */
|
||||
|
||||
#endif /* __PERIPH_CONF_H */
|
||||
Loading…
x
Reference in New Issue
Block a user