aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/stm32f1
diff options
context:
space:
mode:
Diffstat (limited to 'libmaple/stm32f1')
-rw-r--r--libmaple/stm32f1/include/series/spi.h3
-rw-r--r--libmaple/stm32f1/spi.c25
2 files changed, 5 insertions, 23 deletions
diff --git a/libmaple/stm32f1/include/series/spi.h b/libmaple/stm32f1/include/series/spi.h
index 8cc4c4d..d288a0c 100644
--- a/libmaple/stm32f1/include/series/spi.h
+++ b/libmaple/stm32f1/include/series/spi.h
@@ -46,11 +46,8 @@ extern "C" {
struct spi_reg_map;
-/** SPI1 register map base pointer */
#define SPI1_BASE ((struct spi_reg_map*)0x40013000)
-/** SPI2 register map base pointer */
#define SPI2_BASE ((struct spi_reg_map*)0x40003800)
-/** SPI3 register map base pointer */
#define SPI3_BASE ((struct spi_reg_map*)0x40003C00)
/*
diff --git a/libmaple/stm32f1/spi.c b/libmaple/stm32f1/spi.c
index 72f2ef4..1c78cc3 100644
--- a/libmaple/stm32f1/spi.c
+++ b/libmaple/stm32f1/spi.c
@@ -33,35 +33,20 @@
#include <libmaple/spi.h>
#include <libmaple/gpio.h>
+#include "spi_private.h"
/*
* Devices
*/
-static spi_dev spi1 = {
- .regs = SPI1_BASE,
- .clk_id = RCC_SPI1,
- .irq_num = NVIC_SPI1,
-};
-static spi_dev spi2 = {
- .regs = SPI2_BASE,
- .clk_id = RCC_SPI2,
- .irq_num = NVIC_SPI2,
-};
-#if defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)
-static spi_dev spi3 = {
- .regs = SPI3_BASE,
- .clk_id = RCC_SPI3,
- .irq_num = NVIC_SPI3,
-};
-#endif
+static spi_dev spi1 = SPI_DEV(1);
+static spi_dev spi2 = SPI_DEV(2);
-/** SPI device 1 */
spi_dev *SPI1 = &spi1;
-/** SPI device 2 */
spi_dev *SPI2 = &spi2;
+
#if defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)
-/** SPI device 3 */
+static spi_dev spi3 = SPI_DEV(3);
spi_dev *SPI3 = &spi3;
#endif