From d91cadb11a9fcf046e80ba398812ee3f285158c0 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Wed, 7 Sep 2011 16:08:34 -0400 Subject: Update outdated stm32.h usages. stm32.h has been updated to prefix its definitions. Update the rest of libmaple to take this into account. --- libmaple/delay.h | 2 +- libmaple/i2c.c | 8 ++++---- libmaple/nvic.c | 2 +- libmaple/util.c | 2 +- wirish/comm/HardwareSerial.cpp | 10 +++++----- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libmaple/delay.h b/libmaple/delay.h index dd68ec6..6f8b8ba 100644 --- a/libmaple/delay.h +++ b/libmaple/delay.h @@ -15,7 +15,7 @@ * @param us Number of microseconds to delay. */ static inline void delay_us(uint32 us) { - us *= DELAY_US_MULT; + us *= STM32_DELAY_US_MULT; /* fudge for function call overhead */ us--; diff --git a/libmaple/i2c.c b/libmaple/i2c.c index 8f6967b..e3f3199 100644 --- a/libmaple/i2c.c +++ b/libmaple/i2c.c @@ -393,7 +393,7 @@ void i2c_init(i2c_dev *dev) { * I2C_REMAP: Remap I2C1 to SCL/PB8 SDA/PB9. */ void i2c_master_enable(i2c_dev *dev, uint32 flags) { -#define I2C_CLK (PCLK1/1000000) +#define I2C_CLK (STM32_PCLK1/1000000) uint32 ccr = 0; uint32 trise = 0; @@ -425,16 +425,16 @@ void i2c_master_enable(i2c_dev *dev, uint32 flags) { if (flags & I2C_DUTY_16_9) { /* Tlow/Thigh = 16/9 */ ccr |= I2C_CCR_DUTY; - ccr |= PCLK1/(400000 * 25); + ccr |= STM32_PCLK1/(400000 * 25); } else { /* Tlow/Thigh = 2 */ - ccr |= PCLK1/(400000 * 3); + ccr |= STM32_PCLK1/(400000 * 3); } trise = (300 * (I2C_CLK)/1000) + 1; } else { /* Tlow/Thigh = 1 */ - ccr = PCLK1/(100000 * 2); + ccr = STM32_PCLK1/(100000 * 2); trise = I2C_CLK + 1; } diff --git a/libmaple/nvic.c b/libmaple/nvic.c index eed9af8..bbbf13f 100644 --- a/libmaple/nvic.c +++ b/libmaple/nvic.c @@ -68,7 +68,7 @@ void nvic_init(uint32 vector_table_address, uint32 offset) { * Lower priority level for all peripheral interrupts to lowest * possible. */ - for (i = 0; i < NR_INTERRUPTS; i++) { + for (i = 0; i < STM32_NR_INTERRUPTS; i++) { nvic_irq_set_priority((nvic_irq_num)i, 0xF); } diff --git a/libmaple/util.c b/libmaple/util.c index f91b0df..bb56a62 100644 --- a/libmaple/util.c +++ b/libmaple/util.c @@ -39,7 +39,7 @@ /* Failed ASSERT()s send out a message using this USART config. */ #ifndef ERROR_USART #define ERROR_USART USART2 -#define ERROR_USART_CLK_SPEED PCLK1 +#define ERROR_USART_CLK_SPEED STM32_PCLK1 #define ERROR_USART_BAUD 9600 #define ERROR_TX_PORT GPIOA #define ERROR_TX_PIN 2 diff --git a/wirish/comm/HardwareSerial.cpp b/wirish/comm/HardwareSerial.cpp index 7824a4d..6ef9222 100644 --- a/wirish/comm/HardwareSerial.cpp +++ b/wirish/comm/HardwareSerial.cpp @@ -49,12 +49,12 @@ #define RX5 BOARD_UART5_RX_PIN #endif -HardwareSerial Serial1(USART1, TX1, RX1, PCLK2); -HardwareSerial Serial2(USART2, TX2, RX2, PCLK1); -HardwareSerial Serial3(USART3, TX3, RX3, PCLK1); +HardwareSerial Serial1(USART1, TX1, RX1, STM32_PCLK2); +HardwareSerial Serial2(USART2, TX2, RX2, STM32_PCLK1); +HardwareSerial Serial3(USART3, TX3, RX3, STM32_PCLK1); #if defined(STM32_HIGH_DENSITY) && !defined(BOARD_maple_RET6) -HardwareSerial Serial4(UART4, TX4, RX4, PCLK1); -HardwareSerial Serial5(UART5, TX5, RX5, PCLK1); +HardwareSerial Serial4(UART4, TX4, RX4, STM32_PCLK1); +HardwareSerial Serial5(UART5, TX5, RX5, STM32_PCLK1); #endif HardwareSerial::HardwareSerial(usart_dev *usart_device, -- cgit v1.2.3