mirror of https://github.com/ARMmbed/mbed-os.git
STM32F0 astyle
parent
c02cb71b35
commit
cedb1043f1
|
|
@ -95,7 +95,7 @@ MBED_WEAK uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
||||||
//Select HSI as system clock source to allow modification of the PLL configuration
|
//Select HSI as system clock source to allow modification of the PLL configuration
|
||||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
||||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
||||||
if(HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
|
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
|
||||||
return 0; // FAIL
|
return 0; // FAIL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ MBED_WEAK uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
||||||
//Select HSI as system clock source to allow modification of the PLL configuration
|
//Select HSI as system clock source to allow modification of the PLL configuration
|
||||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
||||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
||||||
if(HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
|
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
|
||||||
return 0; // FAIL
|
return 0; // FAIL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ MBED_WEAK uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
||||||
//Select HSI as system clock source to allow modification of the PLL configuration
|
//Select HSI as system clock source to allow modification of the PLL configuration
|
||||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
||||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
||||||
if(HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
|
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
|
||||||
return 0; // FAIL
|
return 0; // FAIL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,24 +18,26 @@
|
||||||
|
|
||||||
#define NVIC_USER_IRQ_OFFSET 16
|
#define NVIC_USER_IRQ_OFFSET 16
|
||||||
|
|
||||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// Copy and switch to dynamic vectors if first time called
|
// Copy and switch to dynamic vectors if first time called
|
||||||
if ((SYSCFG->CFGR1 & SYSCFG_CFGR1_MEM_MODE) != SYSCFG_CFGR1_MEM_MODE) {
|
if ((SYSCFG->CFGR1 & SYSCFG_CFGR1_MEM_MODE) != SYSCFG_CFGR1_MEM_MODE) {
|
||||||
uint32_t *old_vectors = (uint32_t *)NVIC_FLASH_VECTOR_ADDRESS;
|
uint32_t *old_vectors = (uint32_t *)NVIC_FLASH_VECTOR_ADDRESS;
|
||||||
for (i = 0; i < NVIC_NUM_VECTORS; i++) {
|
for (i = 0; i < NVIC_NUM_VECTORS; i++) {
|
||||||
*((uint32_t *)(NVIC_RAM_VECTOR_ADDRESS + (i*4))) = old_vectors[i];
|
*((uint32_t *)(NVIC_RAM_VECTOR_ADDRESS + (i * 4))) = old_vectors[i];
|
||||||
}
|
}
|
||||||
SYSCFG->CFGR1 |= SYSCFG_CFGR1_MEM_MODE; // Embedded SRAM mapped at 0x00000000
|
SYSCFG->CFGR1 |= SYSCFG_CFGR1_MEM_MODE; // Embedded SRAM mapped at 0x00000000
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the vector
|
// Set the vector
|
||||||
*((uint32_t *)(NVIC_RAM_VECTOR_ADDRESS + (IRQn*4) + (NVIC_USER_IRQ_OFFSET*4))) = vector;
|
*((uint32_t *)(NVIC_RAM_VECTOR_ADDRESS + (IRQn * 4) + (NVIC_USER_IRQ_OFFSET * 4))) = vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t NVIC_GetVector(IRQn_Type IRQn) {
|
uint32_t NVIC_GetVector(IRQn_Type IRQn)
|
||||||
uint32_t *vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
|
{
|
||||||
|
uint32_t *vectors = (uint32_t *)NVIC_RAM_VECTOR_ADDRESS;
|
||||||
// Return the vector
|
// Return the vector
|
||||||
return vectors[IRQn + 16];
|
return vectors[IRQn + 16];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
#define __US_TICKER_DATA_H
|
#define __US_TICKER_DATA_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "stm32f0xx.h"
|
#include "stm32f0xx.h"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue