You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
649 lines
17 KiB
649 lines
17 KiB
|
|
#include "gpio.hpp"
|
|
#define TAG "GPIO"
|
|
namespace iflytop {
|
|
/*******************************************************************************
|
|
* LISTENER *
|
|
*******************************************************************************/
|
|
|
|
static STM32_GPIO *s_irqGPIO[20];
|
|
int s_irqGPIO_num = 0;
|
|
|
|
extern "C" {
|
|
/**
|
|
* @brief This function handles EXTI line3 interrupt.
|
|
*/
|
|
void EXTI0_IRQHandler() { HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_0); }
|
|
void EXTI1_IRQHandler() { HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_1); }
|
|
void EXTI2_IRQHandler() { HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_2); }
|
|
void EXTI3_IRQHandler() { HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_3); }
|
|
void EXTI4_IRQHandler() { HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_4); }
|
|
void EXTI9_5_IRQHandler(void) {
|
|
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_5);
|
|
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_6);
|
|
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_7);
|
|
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_8);
|
|
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_9);
|
|
}
|
|
void EXTI15_10_IRQHandler(void) {
|
|
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_10);
|
|
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_11);
|
|
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_12);
|
|
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_13);
|
|
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_14);
|
|
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_15);
|
|
}
|
|
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
|
|
for (int i = 0; i < s_irqGPIO_num; i++) {
|
|
s_irqGPIO[i]->tryTriggerIRQ(GPIO_Pin);
|
|
}
|
|
}
|
|
}
|
|
|
|
void STM32_GPIO::regListener(STM32_GPIO_LISTENER *listener) { m_listener = listener; }
|
|
|
|
|
|
/*******************************************************************************
|
|
* GPIOIMPL *
|
|
*******************************************************************************/
|
|
|
|
/*******************************************************************************
|
|
* BASE_FUNC *
|
|
*******************************************************************************/
|
|
bool STM32_GPIO::enableClock() {
|
|
#ifdef GPIOA
|
|
if (m_gpio == GPIOA) {
|
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
|
return true;
|
|
}
|
|
#endif
|
|
#ifdef GPIOB
|
|
if (m_gpio == GPIOB) {
|
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
|
return true;
|
|
}
|
|
#endif
|
|
#ifdef GPIOC
|
|
if (m_gpio == GPIOC) {
|
|
__HAL_RCC_GPIOC_CLK_ENABLE();
|
|
return true;
|
|
}
|
|
#endif
|
|
#ifdef GPIOD
|
|
if (m_gpio == GPIOD) {
|
|
__HAL_RCC_GPIOD_CLK_ENABLE();
|
|
return true;
|
|
}
|
|
#endif
|
|
#ifdef GPIOE
|
|
if (m_gpio == GPIOE) {
|
|
__HAL_RCC_GPIOE_CLK_ENABLE();
|
|
return true;
|
|
}
|
|
#endif
|
|
#ifdef GPIOF
|
|
if (m_gpio == GPIOF) {
|
|
__HAL_RCC_GPIOF_CLK_ENABLE();
|
|
return true;
|
|
}
|
|
#endif
|
|
#ifdef GPIOG
|
|
if (m_gpio == GPIOG) {
|
|
__HAL_RCC_GPIOG_CLK_ENABLE();
|
|
return true;
|
|
}
|
|
#endif
|
|
#ifdef GPIOH
|
|
if (m_gpio == GPIOH) {
|
|
__HAL_RCC_GPIOH_CLK_ENABLE();
|
|
return true;
|
|
}
|
|
#endif
|
|
#ifdef GPIOI
|
|
if (m_gpio == GPIOI) {
|
|
__HAL_RCC_GPIOI_CLK_ENABLE();
|
|
return true;
|
|
}
|
|
#endif
|
|
#ifdef GPIOJ
|
|
if (m_gpio == GPIOJ) {
|
|
__HAL_RCC_GPIOJ_CLK_ENABLE();
|
|
return true;
|
|
}
|
|
#endif
|
|
#ifdef GPIOK
|
|
if (m_gpio == GPIOK) {
|
|
__HAL_RCC_GPIOK_CLK_ENABLE();
|
|
return true;
|
|
}
|
|
#endif
|
|
return false;
|
|
}
|
|
|
|
void regIRQGPIO(STM32_GPIO *gpio) {
|
|
for (int i = 0; i < s_irqGPIO_num; i++) {
|
|
if (s_irqGPIO[i] == gpio) {
|
|
return;
|
|
}
|
|
}
|
|
|
|
ZASSERT((s_irqGPIO_num + 1) < (int)ZARRAY_SIZE(s_irqGPIO));
|
|
s_irqGPIO[s_irqGPIO_num] = gpio;
|
|
s_irqGPIO_num++;
|
|
}
|
|
|
|
bool STM32_GPIO::isMirror() { return m_mirror; }
|
|
|
|
void STM32_GPIO::initAsOutput(GPIOMode_t gpiomode, bool mirror, bool initLevel) {
|
|
ZASSERT(gpiomode == kOutput_nopull || gpiomode == kOutput_pullup || gpiomode == kOutput_pulldown || gpiomode == kOutput_od);
|
|
init(gpiomode, mirror, initLevel);
|
|
}
|
|
void STM32_GPIO::initAsOutput(bool initLevel) { initAsOutput(kOutput_nopull, false, initLevel); }
|
|
|
|
void STM32_GPIO::initAsInput(GPIOMode_t gpiomode, bool mirror) {
|
|
ZASSERT(gpiomode == kInput_noIrq || gpiomode == kInput_risingIrq || gpiomode == kInput_fallingIrq || gpiomode == kInput_risingAndFallingIrq);
|
|
init(gpiomode, mirror, false);
|
|
}
|
|
void STM32_GPIO::initAsInput() { initAsInput(kInput_noIrq, false); }
|
|
|
|
void STM32_GPIO::initAsMirrorInput() { init(kInput_noIrq, true, false); }
|
|
|
|
void STM32_GPIO::init(GPIOMode_t gpiomode, bool mirror, bool initLevel) {
|
|
m_mirror = mirror;
|
|
m_mode = gpiomode;
|
|
enableClock();
|
|
|
|
GPIO_InitTypeDef m_GPIO_InitStruct = {0};
|
|
|
|
initLevel = m_mirror ? !initLevel : initLevel;
|
|
GPIO_PinState pinState = initLevel ? GPIO_PIN_SET : GPIO_PIN_RESET;
|
|
|
|
if (m_mode == kOutput_nopull || m_mode == kOutput_pullup || m_mode == kOutput_pulldown || m_mode == kOutput_od) {
|
|
HAL_GPIO_WritePin(m_gpio, m_pin, pinState);
|
|
}
|
|
|
|
if (m_mode == kOutput_nopull) {
|
|
m_GPIO_InitStruct.Pin = m_pin;
|
|
m_GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
m_GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
m_GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
} else if (m_mode == kOutput_pullup) {
|
|
m_GPIO_InitStruct.Pin = m_pin;
|
|
m_GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
m_GPIO_InitStruct.Pull = GPIO_PULLUP;
|
|
m_GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
} else if (m_mode == kOutput_pulldown) {
|
|
m_GPIO_InitStruct.Pin = m_pin;
|
|
m_GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
m_GPIO_InitStruct.Pull = GPIO_PULLDOWN;
|
|
m_GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
} else if (m_mode == kOutput_od) {
|
|
m_GPIO_InitStruct.Pin = m_pin;
|
|
m_GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
|
|
m_GPIO_InitStruct.Pull = 0;
|
|
m_GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
} else if (m_mode == kInput_noIrq) {
|
|
m_GPIO_InitStruct.Pin = m_pin;
|
|
m_GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
|
m_GPIO_InitStruct.Pull = 0;
|
|
m_GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
} else if (m_mode == kInput_risingIrq) {
|
|
m_GPIO_InitStruct.Pin = m_pin;
|
|
m_GPIO_InitStruct.Mode = m_mirror ? GPIO_MODE_IT_FALLING : GPIO_MODE_IT_RISING;
|
|
m_GPIO_InitStruct.Pull = 0;
|
|
m_GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
} else if (m_mode == kInput_fallingIrq) {
|
|
m_GPIO_InitStruct.Pin = m_pin;
|
|
m_GPIO_InitStruct.Mode = !m_mirror ? GPIO_MODE_IT_FALLING : GPIO_MODE_IT_RISING;
|
|
m_GPIO_InitStruct.Pull = 0;
|
|
m_GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
} else if (m_mode == kInput_risingAndFallingIrq) {
|
|
m_GPIO_InitStruct.Pin = m_pin;
|
|
m_GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
|
|
m_GPIO_InitStruct.Pull = 0;
|
|
m_GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
}
|
|
HAL_GPIO_Init(m_gpio, &m_GPIO_InitStruct);
|
|
if (m_mode == kInput_risingIrq || m_mode == kInput_fallingIrq || m_mode == kInput_risingAndFallingIrq) {
|
|
regIRQGPIO(this);
|
|
lastLevel = getState();
|
|
HAL_NVIC_SetPriority(getEXTIIRQn(), 0, 0);
|
|
HAL_NVIC_EnableIRQ(getEXTIIRQn());
|
|
}
|
|
return;
|
|
}
|
|
|
|
bool STM32_GPIO::isItRisingEXITGPIO() { return m_mode == kInput_risingIrq; }
|
|
bool STM32_GPIO::isItFallingEXITGPIO() { return m_mode == kInput_fallingIrq; }
|
|
bool STM32_GPIO::isItRisingAndItFallingEXITGPIO() { return m_mode == kInput_risingAndFallingIrq; }
|
|
|
|
/*******************************************************************************
|
|
* EXT FUNC *
|
|
*******************************************************************************/
|
|
|
|
/**
|
|
* @brief 判断当前是否是这个引脚产生的中断
|
|
*
|
|
* @param checkloop
|
|
* @param GPIO_Pin
|
|
* @return true
|
|
* @return false
|
|
*
|
|
* 由于STM32的GPIO中断线是共用的,所以需要根据GPIO的即时状态判断是否是这个引脚产生的中断
|
|
*
|
|
* 判断逻辑是:
|
|
* 先判断所有中断模式是 GPIO_MODE_IT_RISING 和 GPIO_MODE_IT_FALLING 的引脚,采样当前电平判断是否是这个引脚产生的中断
|
|
* 再判断中断模式是 GPIO_MODE_IT_RISING_FALLING 的引脚,直接返回true
|
|
*/
|
|
bool STM32_GPIO::tryTriggerIRQ(uint16_t GPIO_Pin) {
|
|
bool ret = false;
|
|
bool nostate = false;
|
|
if (GPIO_Pin != m_pin) return false;
|
|
if (!(isItRisingEXITGPIO() || isItFallingEXITGPIO() || isItRisingAndItFallingEXITGPIO())) {
|
|
return false;
|
|
}
|
|
|
|
nostate = getState();
|
|
|
|
if (isItRisingEXITGPIO()) {
|
|
if (nostate) {
|
|
ret = true;
|
|
if (m_listener) {
|
|
m_listener->STM32_GPIO_onIRQ(this, kRisingIrqEvent);
|
|
}
|
|
}
|
|
} else if (isItFallingEXITGPIO()) {
|
|
if (!nostate) {
|
|
ret = true;
|
|
if (m_listener) {
|
|
m_listener->STM32_GPIO_onIRQ(this, kFallingIrqEvent);
|
|
}
|
|
}
|
|
} else {
|
|
if (lastLevel != nostate) {
|
|
ret = true;
|
|
if (m_listener) {
|
|
if (lastLevel)
|
|
m_listener->STM32_GPIO_onIRQ(this, kRisingIrqEvent);
|
|
else
|
|
m_listener->STM32_GPIO_onIRQ(this, kFallingIrqEvent);
|
|
}
|
|
}
|
|
}
|
|
|
|
lastLevel = nostate;
|
|
return ret;
|
|
}
|
|
|
|
void STM32_GPIO::toggleState() { HAL_GPIO_TogglePin(m_gpio, m_pin); }
|
|
uint32_t STM32_GPIO::getStateUint32() {
|
|
if (getState())
|
|
return 1;
|
|
else
|
|
return 0;
|
|
}
|
|
|
|
bool STM32_GPIO::getState() {
|
|
bool ret = false;
|
|
if (HAL_GPIO_ReadPin(m_gpio, m_pin) == GPIO_PIN_SET) {
|
|
ret = true;
|
|
} else {
|
|
ret = false;
|
|
}
|
|
if (m_mirror) ret = !ret;
|
|
return ret;
|
|
}
|
|
bool STM32_GPIO::setState(bool state) {
|
|
if (m_mirror) state = !state;
|
|
if (state) {
|
|
HAL_GPIO_WritePin(m_gpio, m_pin, GPIO_PIN_SET);
|
|
} else {
|
|
HAL_GPIO_WritePin(m_gpio, m_pin, GPIO_PIN_RESET);
|
|
}
|
|
return true;
|
|
}
|
|
IRQn_Type STM32_GPIO::getEXTIIRQn() {
|
|
switch (m_pin) {
|
|
case GPIO_PIN_0:
|
|
return EXTI0_IRQn;
|
|
case GPIO_PIN_1:
|
|
return EXTI1_IRQn;
|
|
case GPIO_PIN_2:
|
|
return EXTI2_IRQn;
|
|
case GPIO_PIN_3:
|
|
return EXTI3_IRQn;
|
|
case GPIO_PIN_4:
|
|
return EXTI4_IRQn;
|
|
case GPIO_PIN_5:
|
|
case GPIO_PIN_6:
|
|
case GPIO_PIN_7:
|
|
case GPIO_PIN_8:
|
|
case GPIO_PIN_9:
|
|
return EXTI9_5_IRQn;
|
|
case GPIO_PIN_10:
|
|
case GPIO_PIN_11:
|
|
case GPIO_PIN_12:
|
|
case GPIO_PIN_13:
|
|
case GPIO_PIN_14:
|
|
case GPIO_PIN_15:
|
|
return EXTI15_10_IRQn;
|
|
default:
|
|
ZASSERT(0);
|
|
}
|
|
return EXTI0_IRQn;
|
|
}
|
|
/**
|
|
* @brief 初始化GPIO为中断模式
|
|
*
|
|
* @param pull GPIO_NOPULL, GPIO_PULLUP, GPIO_PULLDOWN
|
|
* @param mode GPIO_MODE_IT_RISING, GPIO_MODE_IT_FALLING, GPIO_MODE_IT_RISING_FALLING
|
|
* @return true
|
|
* @return false
|
|
*/
|
|
|
|
#ifdef GPIOA
|
|
#ifdef GPIO_PIN_0
|
|
STM32_GPIO PA0("PA0", GPIOA, GPIO_PIN_0);
|
|
#endif
|
|
#ifdef GPIO_PIN_1
|
|
STM32_GPIO PA1("PA1", GPIOA, GPIO_PIN_1);
|
|
#endif
|
|
#ifdef GPIO_PIN_2
|
|
STM32_GPIO PA2("PA2", GPIOA, GPIO_PIN_2);
|
|
#endif
|
|
#ifdef GPIO_PIN_3
|
|
STM32_GPIO PA3("PA3", GPIOA, GPIO_PIN_3);
|
|
#endif
|
|
#ifdef GPIO_PIN_4
|
|
STM32_GPIO PA4("PA4", GPIOA, GPIO_PIN_4);
|
|
#endif
|
|
#ifdef GPIO_PIN_5
|
|
STM32_GPIO PA5("PA5", GPIOA, GPIO_PIN_5);
|
|
#endif
|
|
#ifdef GPIO_PIN_6
|
|
STM32_GPIO PA6("PA6", GPIOA, GPIO_PIN_6);
|
|
#endif
|
|
#ifdef GPIO_PIN_7
|
|
STM32_GPIO PA7("PA7", GPIOA, GPIO_PIN_7);
|
|
#endif
|
|
#ifdef GPIO_PIN_8
|
|
STM32_GPIO PA8("PA8", GPIOA, GPIO_PIN_8);
|
|
#endif
|
|
#ifdef GPIO_PIN_9
|
|
STM32_GPIO PA9("PA9", GPIOA, GPIO_PIN_9);
|
|
#endif
|
|
#ifdef GPIO_PIN_10
|
|
STM32_GPIO PA10("PA10", GPIOA, GPIO_PIN_10);
|
|
#endif
|
|
#ifdef GPIO_PIN_11
|
|
STM32_GPIO PA11("PA11", GPIOA, GPIO_PIN_11);
|
|
#endif
|
|
#ifdef GPIO_PIN_12
|
|
STM32_GPIO PA12("PA12", GPIOA, GPIO_PIN_12);
|
|
#endif
|
|
#ifdef GPIO_PIN_13
|
|
STM32_GPIO PA13("PA13", GPIOA, GPIO_PIN_13);
|
|
#endif
|
|
#ifdef GPIO_PIN_14
|
|
STM32_GPIO PA14("PA14", GPIOA, GPIO_PIN_14);
|
|
#endif
|
|
#ifdef GPIO_PIN_15
|
|
STM32_GPIO PA15("PA15", GPIOA, GPIO_PIN_15);
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef GPIOB
|
|
#ifdef GPIO_PIN_0
|
|
STM32_GPIO PB0("PB0", GPIOB, GPIO_PIN_0);
|
|
#endif
|
|
#ifdef GPIO_PIN_1
|
|
STM32_GPIO PB1("PB1", GPIOB, GPIO_PIN_1);
|
|
#endif
|
|
#ifdef GPIO_PIN_2
|
|
STM32_GPIO PB2("PB2", GPIOB, GPIO_PIN_2);
|
|
#endif
|
|
#ifdef GPIO_PIN_3
|
|
STM32_GPIO PB3("PB3", GPIOB, GPIO_PIN_3);
|
|
#endif
|
|
#ifdef GPIO_PIN_4
|
|
STM32_GPIO PB4("PB4", GPIOB, GPIO_PIN_4);
|
|
#endif
|
|
#ifdef GPIO_PIN_5
|
|
STM32_GPIO PB5("PB5", GPIOB, GPIO_PIN_5);
|
|
#endif
|
|
#ifdef GPIO_PIN_6
|
|
STM32_GPIO PB6("PB6", GPIOB, GPIO_PIN_6);
|
|
#endif
|
|
#ifdef GPIO_PIN_7
|
|
STM32_GPIO PB7("PB7", GPIOB, GPIO_PIN_7);
|
|
#endif
|
|
#ifdef GPIO_PIN_8
|
|
STM32_GPIO PB8("PB8", GPIOB, GPIO_PIN_8);
|
|
#endif
|
|
#ifdef GPIO_PIN_9
|
|
STM32_GPIO PB9("PB9", GPIOB, GPIO_PIN_9);
|
|
#endif
|
|
#ifdef GPIO_PIN_10
|
|
STM32_GPIO PB10("PB10", GPIOB, GPIO_PIN_10);
|
|
#endif
|
|
#ifdef GPIO_PIN_11
|
|
STM32_GPIO PB11("PB11", GPIOB, GPIO_PIN_11);
|
|
#endif
|
|
#ifdef GPIO_PIN_12
|
|
STM32_GPIO PB12("PB12", GPIOB, GPIO_PIN_12);
|
|
#endif
|
|
#ifdef GPIO_PIN_13
|
|
STM32_GPIO PB13("PB13", GPIOB, GPIO_PIN_13);
|
|
#endif
|
|
#ifdef GPIO_PIN_14
|
|
STM32_GPIO PB14("PB14", GPIOB, GPIO_PIN_14);
|
|
#endif
|
|
#ifdef GPIO_PIN_15
|
|
STM32_GPIO PB15("PB15", GPIOB, GPIO_PIN_15);
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef GPIOC
|
|
#ifdef GPIO_PIN_0
|
|
STM32_GPIO PC0("PC0", GPIOC, GPIO_PIN_0);
|
|
#endif
|
|
#ifdef GPIO_PIN_1
|
|
STM32_GPIO PC1("PC1", GPIOC, GPIO_PIN_1);
|
|
#endif
|
|
#ifdef GPIO_PIN_2
|
|
STM32_GPIO PC2("PC2", GPIOC, GPIO_PIN_2);
|
|
#endif
|
|
#ifdef GPIO_PIN_3
|
|
STM32_GPIO PC3("PC3", GPIOC, GPIO_PIN_3);
|
|
#endif
|
|
#ifdef GPIO_PIN_4
|
|
STM32_GPIO PC4("PC4", GPIOC, GPIO_PIN_4);
|
|
#endif
|
|
#ifdef GPIO_PIN_5
|
|
STM32_GPIO PC5("PC5", GPIOC, GPIO_PIN_5);
|
|
#endif
|
|
#ifdef GPIO_PIN_6
|
|
STM32_GPIO PC6("PC6", GPIOC, GPIO_PIN_6);
|
|
#endif
|
|
#ifdef GPIO_PIN_7
|
|
STM32_GPIO PC7("PC7", GPIOC, GPIO_PIN_7);
|
|
#endif
|
|
#ifdef GPIO_PIN_8
|
|
STM32_GPIO PC8("PC8", GPIOC, GPIO_PIN_8);
|
|
#endif
|
|
#ifdef GPIO_PIN_9
|
|
STM32_GPIO PC9("PC9", GPIOC, GPIO_PIN_9);
|
|
#endif
|
|
#ifdef GPIO_PIN_10
|
|
STM32_GPIO PC10("PC10", GPIOC, GPIO_PIN_10);
|
|
#endif
|
|
#ifdef GPIO_PIN_11
|
|
STM32_GPIO PC11("PC11", GPIOC, GPIO_PIN_11);
|
|
#endif
|
|
#ifdef GPIO_PIN_12
|
|
STM32_GPIO PC12("PC12", GPIOC, GPIO_PIN_12);
|
|
#endif
|
|
#ifdef GPIO_PIN_13
|
|
STM32_GPIO PC13("PC13", GPIOC, GPIO_PIN_13);
|
|
#endif
|
|
#ifdef GPIO_PIN_14
|
|
STM32_GPIO PC14("PC14", GPIOC, GPIO_PIN_14);
|
|
#endif
|
|
#ifdef GPIO_PIN_15
|
|
STM32_GPIO PC15("PC15", GPIOC, GPIO_PIN_15);
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef GPIOD
|
|
#ifdef GPIO_PIN_0
|
|
STM32_GPIO PD0("PD0", GPIOD, GPIO_PIN_0);
|
|
#endif
|
|
#ifdef GPIO_PIN_1
|
|
STM32_GPIO PD1("PD1", GPIOD, GPIO_PIN_1);
|
|
#endif
|
|
#ifdef GPIO_PIN_2
|
|
STM32_GPIO PD2("PD2", GPIOD, GPIO_PIN_2);
|
|
#endif
|
|
#ifdef GPIO_PIN_3
|
|
STM32_GPIO PD3("PD3", GPIOD, GPIO_PIN_3);
|
|
#endif
|
|
#ifdef GPIO_PIN_4
|
|
STM32_GPIO PD4("PD4", GPIOD, GPIO_PIN_4);
|
|
#endif
|
|
#ifdef GPIO_PIN_5
|
|
STM32_GPIO PD5("PD5", GPIOD, GPIO_PIN_5);
|
|
#endif
|
|
#ifdef GPIO_PIN_6
|
|
STM32_GPIO PD6("PD6", GPIOD, GPIO_PIN_6);
|
|
#endif
|
|
#ifdef GPIO_PIN_7
|
|
STM32_GPIO PD7("PD7", GPIOD, GPIO_PIN_7);
|
|
#endif
|
|
#ifdef GPIO_PIN_8
|
|
STM32_GPIO PD8("PD8", GPIOD, GPIO_PIN_8);
|
|
#endif
|
|
#ifdef GPIO_PIN_9
|
|
STM32_GPIO PD9("PD9", GPIOD, GPIO_PIN_9);
|
|
#endif
|
|
#ifdef GPIO_PIN_10
|
|
STM32_GPIO PD10("PD10", GPIOD, GPIO_PIN_10);
|
|
#endif
|
|
#ifdef GPIO_PIN_11
|
|
STM32_GPIO PD11("PD11", GPIOD, GPIO_PIN_11);
|
|
#endif
|
|
#ifdef GPIO_PIN_12
|
|
STM32_GPIO PD12("PD12", GPIOD, GPIO_PIN_12);
|
|
#endif
|
|
#ifdef GPIO_PIN_13
|
|
STM32_GPIO PD13("PD13", GPIOD, GPIO_PIN_13);
|
|
#endif
|
|
#ifdef GPIO_PIN_14
|
|
STM32_GPIO PD14("PD14", GPIOD, GPIO_PIN_14);
|
|
#endif
|
|
#ifdef GPIO_PIN_15
|
|
STM32_GPIO PD15("PD15", GPIOD, GPIO_PIN_15);
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef GPIOE
|
|
#ifdef GPIO_PIN_0
|
|
STM32_GPIO PE0("PE0", GPIOE, GPIO_PIN_0);
|
|
#endif
|
|
#ifdef GPIO_PIN_1
|
|
STM32_GPIO PE1("PE1", GPIOE, GPIO_PIN_1);
|
|
#endif
|
|
#ifdef GPIO_PIN_2
|
|
STM32_GPIO PE2("PE2", GPIOE, GPIO_PIN_2);
|
|
#endif
|
|
#ifdef GPIO_PIN_3
|
|
STM32_GPIO PE3("PE3", GPIOE, GPIO_PIN_3);
|
|
#endif
|
|
#ifdef GPIO_PIN_4
|
|
STM32_GPIO PE4("PE4", GPIOE, GPIO_PIN_4);
|
|
#endif
|
|
#ifdef GPIO_PIN_5
|
|
STM32_GPIO PE5("PE5", GPIOE, GPIO_PIN_5);
|
|
#endif
|
|
#ifdef GPIO_PIN_6
|
|
STM32_GPIO PE6("PE6", GPIOE, GPIO_PIN_6);
|
|
#endif
|
|
#ifdef GPIO_PIN_7
|
|
STM32_GPIO PE7("PE7", GPIOE, GPIO_PIN_7);
|
|
#endif
|
|
#ifdef GPIO_PIN_8
|
|
STM32_GPIO PE8("PE8", GPIOE, GPIO_PIN_8);
|
|
#endif
|
|
#ifdef GPIO_PIN_9
|
|
STM32_GPIO PE9("PE9", GPIOE, GPIO_PIN_9);
|
|
#endif
|
|
#ifdef GPIO_PIN_10
|
|
STM32_GPIO PE10("PE10", GPIOE, GPIO_PIN_10);
|
|
#endif
|
|
#ifdef GPIO_PIN_11
|
|
STM32_GPIO PE11("PE11", GPIOE, GPIO_PIN_11);
|
|
#endif
|
|
#ifdef GPIO_PIN_12
|
|
STM32_GPIO PE12("PE12", GPIOE, GPIO_PIN_12);
|
|
#endif
|
|
#ifdef GPIO_PIN_13
|
|
STM32_GPIO PE13("PE13", GPIOE, GPIO_PIN_13);
|
|
#endif
|
|
#ifdef GPIO_PIN_14
|
|
STM32_GPIO PE14("PE14", GPIOE, GPIO_PIN_14);
|
|
#endif
|
|
#ifdef GPIO_PIN_15
|
|
STM32_GPIO PE15("PE15", GPIOE, GPIO_PIN_15);
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef GPIOF
|
|
#ifdef GPIO_PIN_0
|
|
STM32_GPIO PF0("PF0", GPIOF, GPIO_PIN_0);
|
|
#endif
|
|
#ifdef GPIO_PIN_1
|
|
STM32_GPIO PF1("PF1", GPIOF, GPIO_PIN_1);
|
|
#endif
|
|
#ifdef GPIO_PIN_2
|
|
STM32_GPIO PF2("PF2", GPIOF, GPIO_PIN_2);
|
|
#endif
|
|
#ifdef GPIO_PIN_3
|
|
STM32_GPIO PF3("PF3", GPIOF, GPIO_PIN_3);
|
|
#endif
|
|
#ifdef GPIO_PIN_4
|
|
STM32_GPIO PF4("PF4", GPIOF, GPIO_PIN_4);
|
|
#endif
|
|
#ifdef GPIO_PIN_5
|
|
STM32_GPIO PF5("PF5", GPIOF, GPIO_PIN_5);
|
|
#endif
|
|
#ifdef GPIO_PIN_6
|
|
STM32_GPIO PF6("PF6", GPIOF, GPIO_PIN_6);
|
|
#endif
|
|
#ifdef GPIO_PIN_7
|
|
STM32_GPIO PF7("PF7", GPIOF, GPIO_PIN_7);
|
|
#endif
|
|
#ifdef GPIO_PIN_8
|
|
STM32_GPIO PF8("PF8", GPIOF, GPIO_PIN_8);
|
|
#endif
|
|
#ifdef GPIO_PIN_9
|
|
STM32_GPIO PF9("PF9", GPIOF, GPIO_PIN_9);
|
|
#endif
|
|
#ifdef GPIO_PIN_10
|
|
STM32_GPIO PF10("PF10", GPIOF, GPIO_PIN_10);
|
|
#endif
|
|
#ifdef GPIO_PIN_11
|
|
STM32_GPIO PF11("PF11", GPIOF, GPIO_PIN_11);
|
|
#endif
|
|
#ifdef GPIO_PIN_12
|
|
STM32_GPIO PF12("PF12", GPIOF, GPIO_PIN_12);
|
|
#endif
|
|
#ifdef GPIO_PIN_13
|
|
STM32_GPIO PF13("PF13", GPIOF, GPIO_PIN_13);
|
|
#endif
|
|
#ifdef GPIO_PIN_14
|
|
STM32_GPIO PF14("PF14", GPIOF, GPIO_PIN_14);
|
|
#endif
|
|
#ifdef GPIO_PIN_15
|
|
STM32_GPIO PF15("PF15", GPIOF, GPIO_PIN_15);
|
|
#endif
|
|
#endif
|
|
} // namespace iflytop
|