app_backup_pwr.c 944 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include "app_backup_pwr.h"
  2. #include "hc32_ll_gpio.h"
  3. #include "FreeRTOS.h"
  4. #include "timers.h"
  5. #define BAT_PWR_ON GPIO_SetPins(GPIO_PORT_C,GPIO_PIN_13)
  6. #define BAT_PWR_OFF GPIO_ResetPins(GPIO_PORT_C,GPIO_PIN_13)
  7. void backup_power_manage_timer_callback(TimerHandle_t pxTimer)
  8. {
  9. uint32_t ulTimerID;
  10. ulTimerID = (uint32_t)pvTimerGetTimerID(pxTimer);
  11. if(ulTimerID==0)
  12. {
  13. //power_on();
  14. }
  15. }
  16. void gpio_output_init(void)
  17. {
  18. stc_gpio_init_t stcGpioInit;
  19. (void)GPIO_StructInit(&stcGpioInit);
  20. stcGpioInit.u16PinState = PIN_STAT_SET;
  21. stcGpioInit.u16PinDir = PIN_DIR_OUT;
  22. (void)GPIO_Init(GPIO_PORT_C, GPIO_PIN_13,&stcGpioInit);
  23. }
  24. void power_manage(void *argv)
  25. {
  26. TimerHandle_t backup_power_manage_timer = NULL;
  27. backup_power_manage_timer = xTimerCreate("backup_power_manage_timer",1000,pdFALSE,(void *)0,backup_power_manage_timer_callback);//开机定时器
  28. BAT_PWR_ON;
  29. while(1)
  30. {
  31. vTaskDelay(1000);
  32. }
  33. }