2026-03-20 21:16:58 +08:00
|
|
|
|
#include "../main/SystemInclude.h"
|
2026-03-20 21:19:04 +08:00
|
|
|
|
|
|
|
|
|
|
/*****GPIO<49><4F>ʼ<EFBFBD><CABC>*****/
|
2026-03-20 21:16:58 +08:00
|
|
|
|
void SystemGPIOInit(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
GPIO_InitTypeDef GPIO_InitStruct;
|
|
|
|
|
|
|
2026-03-20 21:19:04 +08:00
|
|
|
|
GPIO_InitStruct.Pin = GPIO_PIN_All;
|
|
|
|
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
|
|
|
|
GPIO_InitStruct.Current = GPIO_CURRENT_2mA;
|
|
|
|
|
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
|
|
|
|
|
GPIO_InitStruct.SchmittTrigger = ENABLE;
|
|
|
|
|
|
GPIO_InitStruct.Alternate = GPIOx_AF_GPIO; // // AFΪ<46><CEAA>ͨIO
|
|
|
|
|
|
LHL_GPIO_Init(pGPIO0, &GPIO_InitStruct);
|
|
|
|
|
|
LHL_GPIO_Init(pGPIO1, &GPIO_InitStruct);
|
|
|
|
|
|
|
2026-03-20 21:16:58 +08:00
|
|
|
|
GPIO_InitStruct.Pin &= ~(GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3 | GPIO_PIN_4); //<2F>ܿ<EFBFBD>XIN XOUT SWDIO SWCLK
|
2026-03-20 21:19:04 +08:00
|
|
|
|
LHL_GPIO_Init(pGPIO2, &GPIO_InitStruct);
|
|
|
|
|
|
|
|
|
|
|
|
// TEST_PIN_OUT();
|
|
|
|
|
|
// SET_PIN(GPIO1, GPIO_PIN_7);
|
|
|
|
|
|
////
|
|
|
|
|
|
// TDU_SET_PIN_OUT();
|
|
|
|
|
|
// CLR_TDU_SET_PIN();
|
|
|
|
|
|
//// SET_TDU_SET_PIN();
|
|
|
|
|
|
//
|
|
|
|
|
|
// HEATING_PIN_OUT();
|
|
|
|
|
|
// CLR_HEATING_PIN();
|
|
|
|
|
|
//// SET_HEATING_PIN();
|
|
|
|
|
|
//
|
|
|
|
|
|
// HP_CON_PIN_OUT();
|
|
|
|
|
|
//// CLR_HP_CON_PIN();
|
|
|
|
|
|
// SET_HP_CON_PIN();
|
2026-03-20 21:16:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-20 21:19:04 +08:00
|
|
|
|
/*****<2A><><EFBFBD><EFBFBD>*****/
|
2026-03-20 21:16:58 +08:00
|
|
|
|
void EnableOutput(GPIO_TypeDef* GPIOx, uint16_t GPIO_PinPos)
|
|
|
|
|
|
{
|
2026-03-20 21:19:04 +08:00
|
|
|
|
GPIOx->OE |= 1<<GPIO_PinPos;
|
|
|
|
|
|
GPIOx->IE &= ~(1<<GPIO_PinPos);
|
|
|
|
|
|
// <20><><EFBFBD>ö˿ڵ<CBBF><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
GPIOx->DR &= ~(3u << (GPIO_PinPos * 2));
|
|
|
|
|
|
GPIOx->DR |= ((uint32_t)GPIO_CURRENT_2mA << (GPIO_PinPos * 2));
|
2026-03-20 21:16:58 +08:00
|
|
|
|
|
2026-03-20 21:19:04 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>趨
|
2026-03-20 21:16:58 +08:00
|
|
|
|
GPIOx->OD &= ~(1u << GPIO_PinPos);
|
2026-03-20 21:19:04 +08:00
|
|
|
|
// // <20><>©<EFBFBD><C2A9><EFBFBD><EFBFBD><EFBFBD>趨
|
2026-03-20 21:16:58 +08:00
|
|
|
|
// GPIOx->OD |= (1u << GPIO_PinPos);
|
|
|
|
|
|
}
|
2026-03-20 21:19:04 +08:00
|
|
|
|
/*****<2A><><EFBFBD><EFBFBD>*****/
|
2026-03-20 21:16:58 +08:00
|
|
|
|
void EnableInput(GPIO_TypeDef* GPIOx, uint16_t GPIO_PinPos)
|
|
|
|
|
|
{
|
2026-03-20 21:19:04 +08:00
|
|
|
|
GPIOx->OE &= ~(1u << GPIO_PinPos);
|
|
|
|
|
|
GPIOx->IE |= (1u << GPIO_PinPos);
|
2026-03-20 21:16:58 +08:00
|
|
|
|
}
|
2026-03-20 21:19:04 +08:00
|
|
|
|
/*****<2A><><EFBFBD><EFBFBD>*****/
|
2026-03-20 21:16:58 +08:00
|
|
|
|
void EnablePullUp(GPIO_TypeDef* GPIOx, uint16_t GPIO_PinPos)
|
|
|
|
|
|
{
|
|
|
|
|
|
GPIOx->PDE &= ~(1u << GPIO_PinPos);
|
|
|
|
|
|
GPIOx->PUE |= (1u << GPIO_PinPos);
|
|
|
|
|
|
}
|
2026-03-20 21:19:04 +08:00
|
|
|
|
/*****<2A><><EFBFBD><EFBFBD>*****/
|
2026-03-20 21:16:58 +08:00
|
|
|
|
void EnablePullDown(GPIO_TypeDef* GPIOx, uint16_t GPIO_PinPos)
|
|
|
|
|
|
{
|
|
|
|
|
|
GPIOx->PUE &= ~(1u << GPIO_PinPos);
|
|
|
|
|
|
GPIOx->PDE |= (1u << GPIO_PinPos);
|
|
|
|
|
|
}
|
2026-03-20 21:19:04 +08:00
|
|
|
|
|