#include "app_backup_pwr.h"
#include "hc32_ll_gpio.h"

#include "FreeRTOS.h"
#include "timers.h"

#define BAT_PWR_ON 	GPIO_SetPins(GPIO_PORT_C,GPIO_PIN_13)
#define BAT_PWR_OFF GPIO_ResetPins(GPIO_PORT_C,GPIO_PIN_13)

void backup_power_manage_timer_callback(TimerHandle_t pxTimer)
{
	uint32_t ulTimerID;
	
	ulTimerID = (uint32_t)pvTimerGetTimerID(pxTimer);
	
	if(ulTimerID==0)
	{
		//power_on();
	}
}


void gpio_output_init(void)
{
    stc_gpio_init_t stcGpioInit;

    (void)GPIO_StructInit(&stcGpioInit);
    stcGpioInit.u16PinState = PIN_STAT_SET;
    stcGpioInit.u16PinDir = PIN_DIR_OUT;
    (void)GPIO_Init(GPIO_PORT_C, GPIO_PIN_13,&stcGpioInit);			
}



void power_manage(void *argv)
{
	TimerHandle_t backup_power_manage_timer = NULL;
	
	backup_power_manage_timer = xTimerCreate("backup_power_manage_timer",1000,pdFALSE,(void *)0,backup_power_manage_timer_callback);//开机定时器
	
	BAT_PWR_ON;
	while(1)
	{
		vTaskDelay(1000);
	}
}

