pins: Move duplicated pin enum into common stm32_pin_list file
This commit is contained in:
parent
26a5bd399b
commit
3eae917c34
|
@ -105,11 +105,3 @@ void pinMode(uint8_t pin, uint8_t mode) {
|
|||
|
||||
}
|
||||
|
||||
#define PIN(a, b) { GPIO##a , GPIO_PIN_##b }
|
||||
|
||||
const stm32_port_pin_type variant_pin_list[] = {
|
||||
VARIANT_PIN_LIST
|
||||
};
|
||||
|
||||
#undef PIN
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#include "stm32_def.h"
|
||||
|
||||
#include "stm32_pin_list.h"
|
||||
|
||||
#include "variant.h"
|
||||
|
||||
#define INPUT 0x0
|
||||
|
@ -98,7 +100,7 @@ inline int digitalRead(uint8_t pin) {
|
|||
#define PIN(a, b) { GPIO##a , GPIO_PIN_##b }
|
||||
|
||||
static const stm32_port_pin_type variant_pin_list_static[] = {
|
||||
VARIANT_PIN_LIST
|
||||
PIN_LIST
|
||||
};
|
||||
#undef PIN
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#include "stm32_gpio.h"
|
||||
|
||||
#define PIN(a, b) { GPIO##a , GPIO_PIN_##b }
|
||||
const stm32_port_pin_type variant_pin_list[] = {
|
||||
PIN_LIST
|
||||
};
|
||||
#undef PIN
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef STM32_PIN_LIST_H
|
||||
#define STM32_PIN_LIST_H
|
||||
|
||||
#include "variant.h"
|
||||
|
||||
#ifdef VARIANT_PIN_LIST
|
||||
#define PIN_LIST VARIANT_PIN_LIST
|
||||
#else
|
||||
#define PIN_LIST CHIP_PIN_LIST
|
||||
#endif
|
||||
|
||||
|
||||
#define PIN(a, b) P ## a ## b
|
||||
enum {
|
||||
PIN_LIST
|
||||
NUM_PINS,
|
||||
};
|
||||
#undef PIN
|
||||
|
||||
|
||||
#endif
|
|
@ -113,12 +113,4 @@
|
|||
PIN(H,0) ,\
|
||||
PIN(H,1) ,\
|
||||
|
||||
#define PIN(a, b) P ## a ## b
|
||||
|
||||
enum {
|
||||
VARIANT_PIN_LIST
|
||||
NUM_PINS,
|
||||
};
|
||||
#undef PIN
|
||||
|
||||
#endif
|
||||
|
|
|
@ -130,13 +130,5 @@
|
|||
PIN(G,14), \
|
||||
PIN(G,15),
|
||||
|
||||
#define PIN(a, b) P ## a ## b
|
||||
|
||||
enum {
|
||||
VARIANT_PIN_LIST
|
||||
NUM_PINS,
|
||||
};
|
||||
#undef PIN
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -130,13 +130,5 @@
|
|||
PIN(H,0 ), \
|
||||
PIN(H,1 ),
|
||||
|
||||
#define PIN(a, b) P ## a ## b
|
||||
|
||||
enum {
|
||||
VARIANT_PIN_LIST
|
||||
NUM_PINS,
|
||||
};
|
||||
#undef PIN
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -52,13 +52,5 @@
|
|||
PIN(D,0 ), \
|
||||
PIN(D,1 ),
|
||||
|
||||
#define PIN(a, b) P ## a ## b
|
||||
|
||||
enum {
|
||||
VARIANT_PIN_LIST
|
||||
NUM_PINS,
|
||||
};
|
||||
#undef PIN
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -107,13 +107,5 @@
|
|||
PIN(H,0 ), \
|
||||
PIN(H,1 ),
|
||||
|
||||
#define PIN(a, b) P ## a ## b
|
||||
|
||||
enum {
|
||||
VARIANT_PIN_LIST
|
||||
NUM_PINS,
|
||||
};
|
||||
#undef PIN
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -137,13 +137,5 @@
|
|||
PIN(H,0 ), \
|
||||
PIN(H,1 ),
|
||||
|
||||
#define PIN(a, b) P ## a ## b
|
||||
|
||||
enum {
|
||||
VARIANT_PIN_LIST
|
||||
NUM_PINS,
|
||||
};
|
||||
#undef PIN
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -186,13 +186,5 @@
|
|||
PIN(K,6 ), \
|
||||
PIN(K,7 ),
|
||||
|
||||
#define PIN(a, b) P ## a ## b
|
||||
|
||||
enum {
|
||||
VARIANT_PIN_LIST
|
||||
NUM_PINS,
|
||||
};
|
||||
#undef PIN
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -50,13 +50,5 @@
|
|||
PIN(H,0 ), \
|
||||
PIN(H,1 ),
|
||||
|
||||
#define PIN(a, b) P ## a ## b
|
||||
|
||||
enum {
|
||||
VARIANT_PIN_LIST
|
||||
NUM_PINS,
|
||||
};
|
||||
#undef PIN
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -68,13 +68,5 @@
|
|||
PIN(C,15), \
|
||||
PIN(D,2 ), \
|
||||
|
||||
#define PIN(a, b) P ## a ## b
|
||||
|
||||
enum {
|
||||
VARIANT_PIN_LIST
|
||||
NUM_PINS,
|
||||
};
|
||||
#undef PIN
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,21 +1,39 @@
|
|||
#include "stm32_build_defines.h"
|
||||
#include "stm32_def.h"
|
||||
|
||||
#include "stm32f1xx_ll_rcc.h"
|
||||
#include "stm32f1xx_ll_utils.h"
|
||||
#include "stm32f1xx_ll_system.h"
|
||||
#include "stm32f1xx_ll_cortex.h"
|
||||
|
||||
void SystemClock_Config(void) {
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInit;
|
||||
|
||||
/*
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||
RCC_OscInitStruct.LSEState = RCC_LSE_OFF;
|
||||
RCC_OscInitStruct.HSIState = RCC_HSI_OFF;
|
||||
RCC_OscInitStruct.HSICalibrationValue = 16;
|
||||
RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
|
||||
HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
||||
*/
|
||||
LL_RCC_HSE_Enable();
|
||||
LL_RCC_HSE_EnableBypass();
|
||||
|
||||
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE_DIV_1, LL_RCC_PLL_MUL_9);
|
||||
|
||||
LL_RCC_PLL_Enable();
|
||||
|
||||
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
|
||||
|
||||
|
||||
LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
|
||||
LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_2);
|
||||
LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1);
|
||||
|
||||
/*
|
||||
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
||||
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
|
||||
|
@ -24,14 +42,26 @@ void SystemClock_Config(void) {
|
|||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
|
||||
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);
|
||||
*/
|
||||
LL_FLASH_SetLatency(LL_FLASH_LATENCY_2);
|
||||
|
||||
LL_RCC_SetUSBClockSource(LL_RCC_USB_CLKSOURCE_PLL_DIV_1_5);
|
||||
/*
|
||||
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USB;
|
||||
PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_PLL_DIV1_5;
|
||||
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit);
|
||||
*/
|
||||
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL);
|
||||
|
||||
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
|
||||
SysTick_Config(72000000);
|
||||
|
||||
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
|
||||
LL_SYSTICK_SetClkSource(LL_SYSTICK_CLKSOURCE_HCLK);
|
||||
|
||||
LL_SetSystemCoreClock(72000000);
|
||||
|
||||
//HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
|
||||
|
||||
//HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
|
||||
|
||||
/* SysTick_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
|
||||
|
|
|
@ -49,13 +49,6 @@
|
|||
PIN(B,9), \
|
||||
PIN(D,0), \
|
||||
PIN(D,1),
|
||||
|
||||
|
||||
#define PIN(a, b) P ## a ## b
|
||||
|
||||
enum {
|
||||
VARIANT_PIN_LIST
|
||||
NUM_PINS,
|
||||
};
|
||||
#undef PIN
|
||||
|
||||
#endif
|
||||
|
|
|
@ -68,13 +68,4 @@
|
|||
PIN(C,15), \
|
||||
PIN(D,2 ),
|
||||
|
||||
#define PIN(a, b) P ## a ## b
|
||||
|
||||
enum {
|
||||
VARIANT_PIN_LIST
|
||||
NUM_PINS,
|
||||
};
|
||||
#undef PIN
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -68,13 +68,5 @@
|
|||
PIN(C,15), \
|
||||
PIN(D,2 ), \
|
||||
|
||||
#define PIN(a, b) P ## a ## b
|
||||
|
||||
enum {
|
||||
VARIANT_PIN_LIST
|
||||
NUM_PINS,
|
||||
};
|
||||
#undef PIN
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -68,13 +68,5 @@
|
|||
PIN(C,15), \
|
||||
PIN(D,2 ),
|
||||
|
||||
#define PIN(a, b) P ## a ## b
|
||||
|
||||
enum {
|
||||
VARIANT_PIN_LIST
|
||||
NUM_PINS,
|
||||
};
|
||||
#undef PIN
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -68,13 +68,5 @@
|
|||
PIN(C,15), \
|
||||
PIN(D,2 ),
|
||||
|
||||
#define PIN(a, b) P ## a ## b
|
||||
|
||||
enum {
|
||||
VARIANT_PIN_LIST
|
||||
NUM_PINS,
|
||||
};
|
||||
#undef PIN
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -68,13 +68,6 @@
|
|||
PIN(C,15), \
|
||||
PIN(D,2 ),
|
||||
|
||||
#define PIN(a, b) P ## a ## b
|
||||
|
||||
enum {
|
||||
VARIANT_PIN_LIST
|
||||
NUM_PINS,
|
||||
};
|
||||
#undef PIN
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -68,13 +68,4 @@
|
|||
PIN(C,15), \
|
||||
PIN(D,2 ),
|
||||
|
||||
#define PIN(a, b) P ## a ## b
|
||||
|
||||
enum {
|
||||
VARIANT_PIN_LIST
|
||||
NUM_PINS,
|
||||
};
|
||||
#undef PIN
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -68,13 +68,5 @@
|
|||
PIN(C,15), \
|
||||
PIN(D,2 ),
|
||||
|
||||
#define PIN(a, b) P ## a ## b
|
||||
|
||||
enum {
|
||||
VARIANT_PIN_LIST
|
||||
NUM_PINS,
|
||||
};
|
||||
#undef PIN
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -68,13 +68,5 @@
|
|||
PIN(C,15), \
|
||||
PIN(D,2 ),
|
||||
|
||||
#define PIN(a, b) P ## a ## b
|
||||
|
||||
enum {
|
||||
VARIANT_PIN_LIST
|
||||
NUM_PINS,
|
||||
};
|
||||
#undef PIN
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue