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

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year 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();
  37. NRF_LOG_INFO("compile time :%s", __TIME__);
  38. /*******************************************************************************
  39. * ʼ *
  40. *******************************************************************************/
  41. static zble_module_cfg_t cfg;
  42. cfg.deviceName = device_info_read_sn_str();
  43. cfg.on_service_init = on_service_init;
  44. zble_module_init(&cfg);
  45. ble_cmder_init();
  46. /*******************************************************************************
  47. * Ʒʼ *
  48. *******************************************************************************/
  49. one_conduction_main();
  50. /*******************************************************************************
  51. * LOOP *
  52. *******************************************************************************/
  53. znordic_loop();
  54. }
  55. #else
  56. #include "ads1293_simple_tester.c"
  57. #endif