Merge branch 'master' of git://github.com/bcostm/mbed into bcostm-master

pull/269/merge
Bogdan Marinescu 2014-04-22 12:53:02 +01:00
commit c9167e8c43
10 changed files with 26 additions and 14 deletions

View File

@ -153,8 +153,6 @@ __I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9}
* @{ * @{
*/ */
void SetSysClock(void);
#if (USE_PLL_HSE_XTAL != 0) || (USE_PLL_HSE_EXTC != 0) #if (USE_PLL_HSE_XTAL != 0) || (USE_PLL_HSE_EXTC != 0)
uint8_t SetSysClock_PLL_HSE(uint8_t bypass); uint8_t SetSysClock_PLL_HSE(uint8_t bypass);
#endif #endif
@ -208,10 +206,6 @@ void SystemInit(void)
/* Disable all interrupts */ /* Disable all interrupts */
RCC->CIR = 0x00000000; RCC->CIR = 0x00000000;
/* Configure the System clock source, PLL Multiplier and Divider factors,
AHB/APBx prescalers and Flash settings */
SetSysClock();
/* Configure the Vector Table location add offset address ------------------*/ /* Configure the Vector Table location add offset address ------------------*/
#ifdef VECT_TAB_SRAM #ifdef VECT_TAB_SRAM
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */ SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */

View File

@ -65,6 +65,7 @@ extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Cloc
extern void SystemInit(void); extern void SystemInit(void);
extern void SystemCoreClockUpdate(void); extern void SystemCoreClockUpdate(void);
extern void SetSysClock(void);
/** /**
* @} * @}

View File

@ -26,10 +26,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "analogin_api.h" #include "analogin_api.h"
#include "wait_api.h"
#if DEVICE_ANALOGIN #if DEVICE_ANALOGIN
#include "wait_api.h"
#include "cmsis.h" #include "cmsis.h"
#include "pinmap.h" #include "pinmap.h"
#include "error.h" #include "error.h"

View File

@ -29,7 +29,6 @@
*/ */
#include <stddef.h> #include <stddef.h>
#include "cmsis.h" #include "cmsis.h"
#include "gpio_irq_api.h" #include "gpio_irq_api.h"
#include "pinmap.h" #include "pinmap.h"
#include "error.h" #include "error.h"

View File

@ -100,7 +100,7 @@ void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
void i2c_frequency(i2c_t *obj, int hz) { void i2c_frequency(i2c_t *obj, int hz) {
I2C_TypeDef *i2c = (I2C_TypeDef *)(obj->i2c); I2C_TypeDef *i2c = (I2C_TypeDef *)(obj->i2c);
I2C_InitTypeDef I2C_InitStructure; I2C_InitTypeDef I2C_InitStructure;
uint32_t tim; uint32_t tim = 0;
// Disable the Fast Mode Plus capability // Disable the Fast Mode Plus capability
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); // Enable SYSCFG clock RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); // Enable SYSCFG clock

View File

@ -25,11 +25,14 @@
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "cmsis.h"
extern void SystemCoreClockUpdate(void);
// This function is called after RAM initialization and before main. // This function is called after RAM initialization and before main.
void mbed_sdk_init() { void mbed_sdk_init() {
/* Configure the System clock source, PLL Multiplier and Divider factors,
AHB/APBx prescalers and Flash settings */
SetSysClock();
// Update the SystemCoreClock variable. // Update the SystemCoreClock variable.
SystemCoreClockUpdate(); SystemCoreClockUpdate();
} }

View File

@ -29,6 +29,8 @@
*/ */
#include "pwmout_api.h" #include "pwmout_api.h"
#if DEVICE_PWMOUT
#include "cmsis.h" #include "cmsis.h"
#include "pinmap.h" #include "pinmap.h"
#include "error.h" #include "error.h"
@ -275,3 +277,5 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us) {
float value = (float)us / (float)obj->period; float value = (float)us / (float)obj->period;
pwmout_write(obj, value); pwmout_write(obj, value);
} }
#endif

View File

@ -29,6 +29,8 @@
*/ */
#include "rtc_api.h" #include "rtc_api.h"
#if DEVICE_RTC
static int rtc_inited = 0; static int rtc_inited = 0;
void rtc_init(void) { void rtc_init(void) {
@ -136,3 +138,5 @@ void rtc_write(time_t t) {
RTC_SetTime(RTC_Format_BIN, &timeStruct); RTC_SetTime(RTC_Format_BIN, &timeStruct);
PWR_BackupAccessCmd(DISABLE); // Disable access to RTC PWR_BackupAccessCmd(DISABLE); // Disable access to RTC
} }
#endif

View File

@ -28,6 +28,9 @@
******************************************************************************* *******************************************************************************
*/ */
#include "serial_api.h" #include "serial_api.h"
#if DEVICE_SERIAL
#include "cmsis.h" #include "cmsis.h"
#include "pinmap.h" #include "pinmap.h"
#include "error.h" #include "error.h"
@ -309,3 +312,5 @@ void serial_break_clear(serial_t *obj) {
USART_RequestCmd(usart, USART_Request_SBKRQ, DISABLE); USART_RequestCmd(usart, USART_Request_SBKRQ, DISABLE);
USART_ClearFlag(usart, USART_FLAG_SBK); USART_ClearFlag(usart, USART_FLAG_SBK);
} }
#endif

View File

@ -28,10 +28,10 @@
******************************************************************************* *******************************************************************************
*/ */
#include "sleep_api.h" #include "sleep_api.h"
#include "cmsis.h"
// This function is in the system_stm32f30x.c file #if DEVICE_SLEEP
extern void SetSysClock(void);
#include "cmsis.h"
// MCU SLEEP mode // MCU SLEEP mode
void sleep(void) { void sleep(void) {
@ -53,3 +53,5 @@ void deepsleep(void) {
// After wake-up from STOP reconfigure the PLL // After wake-up from STOP reconfigure the PLL
SetSysClock(); SetSysClock();
} }
#endif