From 17e0e5edde60e9bf2aa4d52173ad7d47d6d6da75 Mon Sep 17 00:00:00 2001 From: Perry Hung Date: Thu, 22 Apr 2010 02:36:01 -0400 Subject: Initial SPI Polling implementation. Initial commit of a polling-based SPI driver. The driver is limited to synchronous, blocking sends and a 8-bit data frame format. Tested on SPI1 and SPI2. Other peripherals are temporarily disabled, and the rx function is untested until I find a good peripheral to test everything on. --- libmaple/rcc.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libmaple/rcc.h') diff --git a/libmaple/rcc.h b/libmaple/rcc.h index 8f786ee..9973bca 100644 --- a/libmaple/rcc.h +++ b/libmaple/rcc.h @@ -100,6 +100,10 @@ #define RCC_APB1ENR_TIM4EN BIT(2) #define RCC_APB1ENR_USART2EN BIT(17) #define RCC_APB1ENR_USART3EN BIT(18) +#define RCC_APB1ENR_SPI2EN BIT(14) + +#define rcc_enable_clk_spi1() __set_bits(RCC_APB2ENR, RCC_APB2ENR_SPI1EN) +#define rcc_enable_clk_spi2() __set_bits(RCC_APB1ENR, RCC_APB1ENR_SPI2EN) #define rcc_enable_clk_timer1() __set_bits(RCC_APB2ENR, RCC_APB2ENR_TIM1EN) #define rcc_enable_clk_timer2() __set_bits(RCC_APB1ENR, RCC_APB1ENR_TIM2EN) -- cgit v1.2.3