func_wireless.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #include "include.h"
  2. #include "func.h"
  3. #include "wireless_service.h"
  4. #if FUNC_WIRELESS_EN
  5. AT(.text.app.proc.bt)
  6. void func_wireless_sub_process(void)
  7. {
  8. ble_app_proc();
  9. }
  10. AT(.text.app.proc.bt)
  11. void func_wireless_process(void)
  12. {
  13. func_process();
  14. if (bTransmitEn)
  15. {
  16. func_wireless_sub_process();
  17. }
  18. else
  19. {
  20. wireless_service_proc();
  21. }
  22. #if SYS_OFF_TIME
  23. if(sys_cb.pwroff_delay == 0) {
  24. func_cb.sta = FUNC_PWROFF;
  25. return;
  26. }
  27. #endif
  28. #if SYS_SLEEP_LEVEL
  29. if(sleep_process(bt_is_sleep)) {
  30. }
  31. #endif
  32. }
  33. AT(.text.func.bt)
  34. void func_wireless_init(void)
  35. {
  36. bsp_wireless_init();
  37. }
  38. AT(.text.func.bt)
  39. void func_wireless_enter(void)
  40. {
  41. msg_queue_clear();
  42. ble_set_work_mode(MODE_WIRELESS);
  43. func_wireless_init();
  44. }
  45. AT(.text.func.bt)
  46. void func_wireless_exit(void)
  47. {
  48. wireless_off();
  49. func_cb.last = FUNC_WIRELESS;
  50. }
  51. AT(.text.func.bt)
  52. void func_wireless(void)
  53. {
  54. printf("%s\n", __func__);
  55. func_wireless_enter();
  56. while (func_cb.sta == FUNC_WIRELESS) {
  57. func_wireless_process();
  58. if (bTransmitEn)
  59. {
  60. func_wireless_message(msg_dequeue());
  61. }
  62. }
  63. func_wireless_exit();
  64. }
  65. #endif