You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.1 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. #if 1
  2. #include "znordic.h"
  3. //
  4. #include <stdarg.h>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8. //
  9. #include "app_event.h"
  10. #include "app_event_distribute.h"
  11. #include "basic/device_version_info_mgr.h"
  12. #include "board/board.h"
  13. #include "zble_module.h"
  14. #include "zdatachannel_service.h"
  15. //
  16. #define SCHED_MAX_EVENT_DATA_SIZE MAX(sizeof(app_event_t), APP_TIMER_SCHED_EVENT_DATA_SIZE)
  17. ZDATACHANNEL_DEF(m_zhrs, 2 /*���ȼ�*/, 1 /*client num*/); // ��������
  18. /**
  19. * @brief Ϣ
  20. */
  21. void zdatachannel_data_handler(zdatachannel_evt_t* p_evt) {
  22. if (p_evt->type == ZDATACHANNEL_EVT_RX_DATA) {
  23. ble_cmder_process_rx((uint8_t*)p_evt->params.rx_data.p_data, p_evt->params.rx_data.length);
  24. }
  25. }
  26. void on_service_init(void) {
  27. ZLOGI("init zdatachannel service");
  28. zdatachannel_init_t zdatachannle_init;
  29. memset(&zdatachannle_init, 0, sizeof(zdatachannle_init));
  30. zdatachannle_init.data_handler = zdatachannel_data_handler;
  31. ZERROR_CHECK(zdatachannel_init(&m_zhrs, &zdatachannle_init));
  32. }
  33. extern void one_conduction_main();
  34. int main() {
  35. APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, 20);
  36. znordic_init_without_wd();
  37. /*******************************************************************************
  38. * ʼ *
  39. *******************************************************************************/
  40. static zble_module_cfg_t cfg;
  41. cfg.deviceName = device_info_read_sn_str();
  42. cfg.on_service_init = on_service_init;
  43. zble_module_init(&cfg);
  44. ble_cmder_init();
  45. /*******************************************************************************
  46. * Ʒʼ *
  47. *******************************************************************************/
  48. one_conduction_main();
  49. /*******************************************************************************
  50. * LOOP *
  51. *******************************************************************************/
  52. znordic_loop();
  53. }
  54. #else
  55. #include "ads1293_simple_tester.c"
  56. #endif