app_charge.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include "usr_config.h"
  2. #include "bsp_time.h"
  3. #include "system.h"
  4. #include "hal_led.h"
  5. #include "nrf_gpio.h"
  6. #include "hal_ble_client.h"
  7. #include "hal_ble_host.h"
  8. #include "app_charge.h"
  9. #include "app_flash.h"
  10. #include "hal_battery.h"
  11. #include "ble_comm.h"
  12. #include "hal_charge.h"
  13. /************************ º¯ÊýÉùÃ÷ ***********************************/
  14. /********************************************************/
  15. static void app_charge_Process(void)
  16. {
  17. static uint8_t app_charge_state = BLE_CHARGE_PULLOUT;
  18. uint8_t charge_state_c = hal_charge_Getstate();
  19. if(charge_state_c != app_charge_state){
  20. switch(charge_state_c){
  21. case BLE_CHARGE_PULLOUT:
  22. LED_Stop(LED_CHARGE);
  23. Process_SetHoldOn(app_charge_Process,0);
  24. break;
  25. case BLE_CHARGE_INSERT:
  26. Process_SetHoldOn(app_charge_Process,1);
  27. LED_Start(LED_CHARGE,COLOR_ORANGE);
  28. break;
  29. case BLE_CHARGE_DONE:
  30. Process_SetHoldOn(app_charge_Process,1);
  31. LED_Start(LED_CHARGE,COLOR_GREEN);
  32. break;
  33. default:
  34. break;
  35. }
  36. app_charge_state = charge_state_c;
  37. }
  38. }
  39. void app_charge_Init(void)
  40. {
  41. Process_Start(100,"app_charge",app_charge_Process);
  42. }