aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libmaple/rcc.c2
-rw-r--r--libmaple/rcc.h2
-rw-r--r--libmaple/spi.c4
3 files changed, 6 insertions, 2 deletions
diff --git a/libmaple/rcc.c b/libmaple/rcc.c
index 4f13b0d..ab62025 100644
--- a/libmaple/rcc.c
+++ b/libmaple/rcc.c
@@ -99,6 +99,8 @@ static const struct rcc_dev_info rcc_dev_table[] = {
[RCC_TIMER2] = { .clk_domain = APB1, .line_num = 0 },
[RCC_TIMER3] = { .clk_domain = APB1, .line_num = 1 },
[RCC_TIMER4] = { .clk_domain = APB1, .line_num = 2 },
+ [RCC_SPI1] = { .clk_domain = APB2, .line_num = 12 },
+ [RCC_SPI2] = { .clk_domain = APB1, .line_num = 14 },
};
/**
diff --git a/libmaple/rcc.h b/libmaple/rcc.h
index 1bc63e6..e6a28ea 100644
--- a/libmaple/rcc.h
+++ b/libmaple/rcc.h
@@ -104,6 +104,8 @@ enum {
RCC_TIMER2,
RCC_TIMER3,
RCC_TIMER4,
+ RCC_SPI1,
+ RCC_SPI2,
};
/* prescalers */
diff --git a/libmaple/spi.c b/libmaple/spi.c
index aa75c5f..68855a5 100644
--- a/libmaple/spi.c
+++ b/libmaple/spi.c
@@ -89,12 +89,12 @@ void spi_init(uint32 spi_num,
/* limit to 18 mhz max speed */
ASSERT(prescale != CR1_BR_PRESCALE_2);
spi = (SPI*)SPI1_BASE;
- rcc_enable_clk_spi1();
+ rcc_clk_enable(RCC_SPI1);
spi_gpio_cfg(&spi_dev1);
break;
case 2:
spi = (SPI*)SPI2_BASE;
- rcc_enable_clk_spi2();
+ rcc_clk_enable(RCC_SPI2);
spi_gpio_cfg(&spi_dev2);
break;
}