|
|
|
//
|
|
|
|
// Created by MightyPork on 2018/02/04.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "platform.h"
|
|
|
|
#include "ll_extension.h"
|
|
|
|
|
|
|
|
const uint32_t LL_TIM_IC_FILTERS[] = {
|
|
|
|
LL_TIM_IC_FILTER_FDIV1,
|
|
|
|
LL_TIM_IC_FILTER_FDIV1_N2,
|
|
|
|
LL_TIM_IC_FILTER_FDIV1_N4,
|
|
|
|
LL_TIM_IC_FILTER_FDIV1_N8,
|
|
|
|
LL_TIM_IC_FILTER_FDIV2_N6,
|
|
|
|
LL_TIM_IC_FILTER_FDIV2_N8,
|
|
|
|
LL_TIM_IC_FILTER_FDIV4_N6,
|
|
|
|
LL_TIM_IC_FILTER_FDIV4_N8,
|
|
|
|
LL_TIM_IC_FILTER_FDIV8_N6,
|
|
|
|
LL_TIM_IC_FILTER_FDIV8_N8,
|
|
|
|
LL_TIM_IC_FILTER_FDIV16_N5,
|
|
|
|
LL_TIM_IC_FILTER_FDIV16_N6,
|
|
|
|
LL_TIM_IC_FILTER_FDIV16_N8,
|
|
|
|
LL_TIM_IC_FILTER_FDIV32_N5,
|
|
|
|
LL_TIM_IC_FILTER_FDIV32_N6,
|
|
|
|
LL_TIM_IC_FILTER_FDIV32_N8,
|
|
|
|
};
|
|
|
|
|
|
|
|
const uint32_t LL_TIM_ETR_FILTERS[] = {
|
|
|
|
LL_TIM_ETR_FILTER_FDIV1,
|
|
|
|
LL_TIM_ETR_FILTER_FDIV1_N2,
|
|
|
|
LL_TIM_ETR_FILTER_FDIV1_N4,
|
|
|
|
LL_TIM_ETR_FILTER_FDIV1_N8,
|
|
|
|
LL_TIM_ETR_FILTER_FDIV2_N6,
|
|
|
|
LL_TIM_ETR_FILTER_FDIV2_N8,
|
|
|
|
LL_TIM_ETR_FILTER_FDIV4_N6,
|
|
|
|
LL_TIM_ETR_FILTER_FDIV4_N8,
|
|
|
|
LL_TIM_ETR_FILTER_FDIV8_N6,
|
|
|
|
LL_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
|
|
|
|
LL_SYSCFG_EXTI_LINE14,
|
|
|
|
LL_SYSCFG_EXTI_LINE15,
|
|
|
|
};
|
|
|
|
COMPILER_ASSERT(16 == ELEMENTS_IN_ARRAY(LL_SYSCFG_EXTI_LINES));
|
|
|
|
|
|
|
|
const uint32_t LL_EXTI_LINES[16] = {
|
|
|
|
LL_EXTI_LINE_0,
|
|
|
|
LL_EXTI_LINE_1,
|
|
|
|
LL_EXTI_LINE_2,
|
|
|
|
LL_EXTI_LINE_3,
|
|
|
|
LL_EXTI_LINE_4,
|
|
|
|
LL_EXTI_LINE_5,
|
|
|
|
LL_EXTI_LINE_6,
|
|
|
|
LL_EXTI_LINE_7,
|
|
|
|
LL_EXTI_LINE_8,
|
|
|
|
LL_EXTI_LINE_9,
|
|
|
|
LL_EXTI_LINE_10,
|
|
|
|
LL_EXTI_LINE_11,
|
|
|
|
LL_EXTI_LINE_12,
|
|
|
|
LL_EXTI_LINE_13,
|
|
|
|
LL_EXTI_LINE_14,
|
|
|
|
LL_EXTI_LINE_15,
|
|
|
|
};
|
|
|
|
COMPILER_ASSERT(16 == ELEMENTS_IN_ARRAY(LL_EXTI_LINES));
|
|
|
|
|
|
|
|
/** Pin number to LL bitfield mapping */
|
|
|
|
const uint32_t LL_GPIO_PINS[16] = {
|
|
|
|
LL_GPIO_PIN_0,
|
|
|
|
LL_GPIO_PIN_1,
|
|
|
|
LL_GPIO_PIN_2,
|
|
|
|
LL_GPIO_PIN_3,
|
|
|
|
LL_GPIO_PIN_4,
|
|
|
|
LL_GPIO_PIN_5,
|
|
|
|
LL_GPIO_PIN_6,
|
|
|
|
LL_GPIO_PIN_7,
|
|
|
|
LL_GPIO_PIN_8,
|
|
|
|
LL_GPIO_PIN_9,
|
|
|
|
LL_GPIO_PIN_10,
|
|
|
|
LL_GPIO_PIN_11,
|
|
|
|
LL_GPIO_PIN_12,
|
|
|
|
LL_GPIO_PIN_13,
|
|
|
|
LL_GPIO_PIN_14,
|
|
|
|
LL_GPIO_PIN_15,
|
|
|
|
};
|
|
|
|
COMPILER_ASSERT(16 == ELEMENTS_IN_ARRAY(LL_GPIO_PINS));
|
|
|
|
|
|
|
|
/** Port number (A=0) to config struct pointer mapping */
|
|
|
|
GPIO_TypeDef * const GPIO_PERIPHS[PORTS_COUNT] = {
|
|
|
|
GPIOA,
|
|
|
|
GPIOB,
|
|
|
|
GPIOC,
|
|
|
|
GPIOD,
|
|
|
|
GPIOE,
|
|
|
|
#if PORTS_COUNT>5
|
|
|
|
GPIOF,
|
|
|
|
#endif
|
|
|
|
#if PORTS_COUNT>6
|
|
|
|
GPIOG,
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
COMPILER_ASSERT(PORTS_COUNT == ELEMENTS_IN_ARRAY(GPIO_PERIPHS));
|
|
|
|
|
|
|
|
const uint32_t LL_ADC_SAMPLETIMES[8] = {
|
|
|
|
LL_ADC_SAMPLINGTIME_1CYCLE_5,
|
|
|
|
LL_ADC_SAMPLINGTIME_7CYCLES_5,
|
|
|
|
LL_ADC_SAMPLINGTIME_13CYCLES_5,
|
|
|
|
LL_ADC_SAMPLINGTIME_28CYCLES_5,
|
|
|
|
LL_ADC_SAMPLINGTIME_41CYCLES_5,
|
|
|
|
LL_ADC_SAMPLINGTIME_55CYCLES_5,
|
|
|
|
LL_ADC_SAMPLINGTIME_71CYCLES_5,
|
|
|
|
LL_ADC_SAMPLINGTIME_239CYCLES_5,
|
|
|
|
};
|