升压充电 400ms 到8.4V 可关断
This commit is contained in:
parent
9d0e953107
commit
9a760f0c11
|
@ -22,7 +22,7 @@
|
||||||
*/
|
*/
|
||||||
__attribute__((aligned(4))) uint32_t MEM_BUF[BLE_MEMHEAP_SIZE / 4];
|
__attribute__((aligned(4))) uint32_t MEM_BUF[BLE_MEMHEAP_SIZE / 4];
|
||||||
|
|
||||||
#if(defined(BLE_MAC)) && (BLE_MAC == TRUE)
|
#if (defined(BLE_MAC)) && (BLE_MAC == TRUE)
|
||||||
const uint8_t MacAddr[6] = {0x84, 0xC2, 0xE4, 0x03, 0x02, 0x02};
|
const uint8_t MacAddr[6] = {0x84, 0xC2, 0xE4, 0x03, 0x02, 0x02};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -34,12 +34,72 @@ const uint8_t MacAddr[6] = {0x84, 0xC2, 0xE4, 0x03, 0x02, 0x02};
|
||||||
* @return none
|
* @return none
|
||||||
*/
|
*/
|
||||||
__HIGH_CODE
|
__HIGH_CODE
|
||||||
__attribute__((noinline))
|
__attribute__((noinline)) void Main_Circulation()
|
||||||
void Main_Circulation()
|
|
||||||
{
|
{
|
||||||
while(1)
|
while (1)
|
||||||
{
|
{
|
||||||
TMOS_SystemProcess();
|
TMOS_SystemProcess();
|
||||||
|
if (GPIOB_ReadPortPin(GPIO_Pin_14) == 0)
|
||||||
|
{
|
||||||
|
// 12V_EN
|
||||||
|
GPIOA_SetBits(GPIO_Pin_13);
|
||||||
|
GPIOA_ModeCfg(GPIO_Pin_13, GPIO_ModeOut_PP_5mA);
|
||||||
|
PRINT("12V_EN ON\n");
|
||||||
|
|
||||||
|
// LED
|
||||||
|
GPIOA_SetBits(GPIO_Pin_4);
|
||||||
|
GPIOA_ModeCfg(GPIO_Pin_4, GPIO_ModeOut_PP_5mA);
|
||||||
|
DelayMs(50);
|
||||||
|
PRINT("LED ON\n");
|
||||||
|
|
||||||
|
GPIOA_ResetBits(GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_15);
|
||||||
|
GPIOA_ModeCfg(GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_15, GPIO_ModeIN_PD);
|
||||||
|
DelayMs(50);
|
||||||
|
PRINT("LED OFF\n");
|
||||||
|
|
||||||
|
GPIOA_SetBits(GPIO_Pin_5);
|
||||||
|
GPIOA_ModeCfg(GPIO_Pin_5, GPIO_ModeOut_PP_5mA);
|
||||||
|
DelayMs(50);
|
||||||
|
PRINT("LED ON\n");
|
||||||
|
|
||||||
|
GPIOA_ResetBits(GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_15);
|
||||||
|
GPIOA_ModeCfg(GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_15, GPIO_ModeIN_PD);
|
||||||
|
DelayMs(50);
|
||||||
|
PRINT("LED OFF\n");
|
||||||
|
|
||||||
|
GPIOA_SetBits(GPIO_Pin_15);
|
||||||
|
GPIOA_ModeCfg(GPIO_Pin_4, GPIO_ModeOut_PP_5mA);
|
||||||
|
DelayMs(50);
|
||||||
|
PRINT("LED ON\n");
|
||||||
|
|
||||||
|
GPIOA_ResetBits(GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_15);
|
||||||
|
GPIOA_ModeCfg(GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_15, GPIO_ModeIN_PD);
|
||||||
|
DelayMs(50);
|
||||||
|
PRINT("LED OFF\n");
|
||||||
|
|
||||||
|
DelayMs(100);
|
||||||
|
PRINT("DelayMs 700\n");
|
||||||
|
|
||||||
|
// 12V_EN
|
||||||
|
GPIOA_ResetBits(GPIO_Pin_13);
|
||||||
|
GPIOA_ModeCfg(GPIO_Pin_13, GPIO_ModeOut_PP_5mA);
|
||||||
|
PRINT("12V_EN OFF\n");
|
||||||
|
|
||||||
|
DelayMs(1000 * 5);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// EMV_CTRL
|
||||||
|
GPIOB_SetBits(GPIO_Pin_13);
|
||||||
|
GPIOB_ModeCfg(GPIO_Pin_13, GPIO_ModeOut_PP_5mA);
|
||||||
|
PRINT("EMV_CTRL ON\n");
|
||||||
|
DelayMs(100);
|
||||||
|
|
||||||
|
// EMV_CTRL
|
||||||
|
GPIOB_ResetBits(GPIO_Pin_13);
|
||||||
|
GPIOB_ModeCfg(GPIO_Pin_13, GPIO_ModeIN_PD);
|
||||||
|
PRINT("EMV_CTRL OFF\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,11 +112,11 @@ void Main_Circulation()
|
||||||
*/
|
*/
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
#if(defined(DCDC_ENABLE)) && (DCDC_ENABLE == TRUE)
|
#if (defined(DCDC_ENABLE)) && (DCDC_ENABLE == TRUE)
|
||||||
PWR_DCDCCfg(ENABLE);
|
PWR_DCDCCfg(ENABLE);
|
||||||
#endif
|
#endif
|
||||||
SetSysClock(CLK_SOURCE_PLL_60MHz);
|
SetSysClock(CLK_SOURCE_PLL_60MHz);
|
||||||
#if(defined(HAL_SLEEP)) && (HAL_SLEEP == TRUE)
|
#if (defined(HAL_SLEEP)) && (HAL_SLEEP == TRUE)
|
||||||
GPIOA_ModeCfg(GPIO_Pin_All, GPIO_ModeIN_PU);
|
GPIOA_ModeCfg(GPIO_Pin_All, GPIO_ModeIN_PU);
|
||||||
GPIOB_ModeCfg(GPIO_Pin_All, GPIO_ModeIN_PU);
|
GPIOB_ModeCfg(GPIO_Pin_All, GPIO_ModeIN_PU);
|
||||||
#endif
|
#endif
|
||||||
|
@ -75,12 +135,13 @@ int main(void)
|
||||||
|
|
||||||
// KEY
|
// KEY
|
||||||
GPIOB_SetBits(GPIO_Pin_14);
|
GPIOB_SetBits(GPIO_Pin_14);
|
||||||
// 由外部上拉电阻了
|
// ÓÉÍⲿÉÏÀµç×èÁË
|
||||||
GPIOB_ModeCfg(GPIO_Pin_14, GPIO_ModeIN_Floating);
|
GPIOB_ModeCfg(GPIO_Pin_14, GPIO_ModeIN_Floating);
|
||||||
|
|
||||||
// ADC_VBAT
|
// ADC_VBAT
|
||||||
// GPIOAGPPCfg(ENABLE, RB_PIN_PA4_15_DIS);
|
// GPIOAGPPCfg(ENABLE, RB_PIN_PA4_15_DIS);
|
||||||
// R16_PIN_ANALOG_IE != RB_PIN_PA4_15_DIS;
|
// R16_PIN_ANALOG_IE != RB_PIN_PA4_15_DIS;
|
||||||
|
R32_PIN_CONFIG2 |= (1U << 14);
|
||||||
|
|
||||||
// R32_PIN_CONFIG2
|
// R32_PIN_CONFIG2
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue