app_charge.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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_ble_uart0.h"
  13. #include "hal_charge.h"
  14. /************************ º¯ÊýÉùÃ÷ ***********************************/
  15. /********************************************************/
  16. static void app_charge_Process(void)
  17. {
  18. static uint8_t app_charge_state = BLE_CHARGE_PULLOUT;
  19. uint8_t charge_state_c = hal_charge_Getstate();
  20. if(charge_state_c != app_charge_state){
  21. switch(charge_state_c){
  22. case BLE_CHARGE_PULLOUT:
  23. LED_Stop(LED_CHARGE);
  24. break;
  25. case BLE_CHARGE_INSERT:
  26. LED_Start(LED_CHARGE,COLOR_ORANGE);
  27. break;
  28. case BLE_CHARGE_DONE:
  29. LED_Start(LED_CHARGE,COLOR_GREEN);
  30. break;
  31. default:
  32. break;
  33. }
  34. app_charge_state = charge_state_c;
  35. }
  36. }
  37. void app_charge_Init(void)
  38. {
  39. Process_Start(1000,"app_charge",app_charge_Process);
  40. }