app_charge.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. break;
  24. case BLE_CHARGE_INSERT:
  25. LED_Start(LED_CHARGE,COLOR_ORANGE);
  26. break;
  27. case BLE_CHARGE_DONE:
  28. LED_Start(LED_CHARGE,COLOR_GREEN);
  29. break;
  30. default:
  31. break;
  32. }
  33. app_charge_state = charge_state_c;
  34. }
  35. }
  36. void app_charge_Init(void)
  37. {
  38. Process_Start(1000,"app_charge",app_charge_Process);
  39. }