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.

100 lines
2.7 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. #include "zble_module.h"
  2. #include "zdatachannel_service.h"
  3. #include "znordic.h"
  4. //
  5. #include <stdarg.h>
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9. //
  10. #include <math.h>
  11. #include "app_scheduler.h"
  12. #include "znordic.h"
  13. #if defined(UART_PRESENT)
  14. #include "nrf_uart.h"
  15. #endif
  16. #if defined(UARTE_PRESENT)
  17. #include "nrf_uarte.h"
  18. #endif
  19. #if 1
  20. int main() {
  21. one_conduction_main();
  22. return 0;
  23. }
  24. #endif
  25. #if 0
  26. extern uint32_t g_nrf_log_tx_pin;
  27. APP_TIMER_DEF(m_report_timer); //
  28. static void tmr_cb(void* p_context) { //
  29. ZLOGI("%d", SingleLeadECG_ecg_plod_get_ecg_val());
  30. }
  31. void main() {
  32. APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20);
  33. g_nrf_log_tx_pin = 41;
  34. znordic_init();
  35. NRF_LOG_INFO("compile time :%s", __TIME__);
  36. SingleLeadECG_adc_module_init();
  37. ZERROR_CHECK(app_timer_create(&m_report_timer, APP_TIMER_MODE_REPEATED, tmr_cb));
  38. ZERROR_CHECK(app_timer_start(m_report_timer, APP_TIMER_TICKS(5), NULL));
  39. znordic_loop();
  40. }
  41. #endif
  42. /*******************************************************************************
  43. * 3-ADS1293- *
  44. *******************************************************************************/
  45. #if 0
  46. extern uint32_t g_nrf_log_tx_pin;
  47. APP_TIMER_DEF(m_test_tx_timer);
  48. ZDATACHANNEL_DEF(m_zhrs, 2 /*�ص��¼�����??*/, 1 /*client num*/);
  49. static void zdatachannel_data_handler(zdatachannel_evt_t* p_evt) {}
  50. static void zdatachanel_send_log(const char* fmt, ...) {
  51. static char tx[256] = {0};
  52. static uint16_t len = 0;
  53. va_list args;
  54. va_start(args, fmt);
  55. len = vsprintf(tx, fmt, args);
  56. zdatachannel_data_send((uint8_t*)tx, &len);
  57. va_end(args);
  58. }
  59. static void test_tx_timer_cb(void* p_context) {
  60. zdatachanel_send_log("%d\n", SingleLeadECG_ecg_plod_get_ecg_val());
  61. }
  62. static void on_service_init(void) {
  63. /**
  64. * @brief ͨʼ
  65. */
  66. ZLOGI("init zdatachannel service");
  67. zdatachannel_init_t zdatachannle_init;
  68. memset(&zdatachannle_init, 0, sizeof(zdatachannle_init));
  69. zdatachannle_init.data_handler = zdatachannel_data_handler;
  70. ZERROR_CHECK(zdatachannel_init(&m_zhrs, &zdatachannle_init));
  71. }
  72. void main() {
  73. APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20);
  74. znordic_init(0, 20);
  75. NRF_LOG_INFO("compile time :%s", __TIME__);
  76. static zble_module_cfg_t cfg = //
  77. {
  78. .deviceName = "ecg_test",
  79. .on_service_init = on_service_init,
  80. };
  81. zble_module_init(&cfg);
  82. SingleLeadECG_adc_module_init();
  83. ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb));
  84. ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(5), NULL));
  85. zble_module_start_adv();
  86. znordic_loop();
  87. }
  88. #endif