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.

567 lines
17 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 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 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 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 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 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 "basic/zble_module.h"
  2. #include "basic/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 "app_uart.h"
  11. #include "basic/ssd1306/driver_ssd1306_basic.h"
  12. #include "basic\zdatachannel_service.h"
  13. #include "one_conduction/one_conduction_board.h"
  14. #include "three_lead\three_lead_board.h"
  15. #if defined(UART_PRESENT)
  16. #include "nrf_uart.h"
  17. #endif
  18. #if defined(UARTE_PRESENT)
  19. #include "nrf_uarte.h"
  20. #endif
  21. #if 0
  22. static void test_tx_timer_cb(void* p_context) {
  23. static uint32_t data;
  24. data++;
  25. ZLOGI("tim cb %d", data);
  26. // ThreeLeadECG_sdcard_connect2_ext_usb_sdcard_driver_ic_reset();
  27. }
  28. extern uint32_t g_nrf_log_tx_pin;
  29. APP_TIMER_DEF(m_test_tx_timer);
  30. void main() {
  31. APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20);
  32. ThreeLeadECG_beep_init();
  33. ThreeLeadECG_sdcard_base_init();
  34. znordic_init();
  35. NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100));
  36. ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb));
  37. ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(3000), NULL));
  38. znordic_loop();
  39. }
  40. #endif
  41. // EEPROM_TEST
  42. #if 0
  43. static void test_tx_timer_cb(void* p_context) {
  44. static uint32_t data;
  45. data++;
  46. // ZLOGI("test_tx_timer_cb %d", data);
  47. static uint8_t eepromw_test_data[256];
  48. static uint8_t eepromw_rx_data[256];
  49. for (size_t i = 0; i < 256; i++) {
  50. eepromw_test_data[i] = i;
  51. }
  52. // SingleLeadECG_eeprom_write(0, eepromw_test_data, 256);
  53. SingleLeadECG_eeprom_read(0, eepromw_rx_data, 256);
  54. // for (size_t i = 0; i < 256; i++) {
  55. // ZLOGI("eepromw_rx_data[%d] = %d", i, eepromw_rx_data[i]);
  56. // NRF_LOG_INTERNAL_FLUSH();
  57. // }
  58. }
  59. extern uint32_t g_nrf_log_tx_pin;
  60. APP_TIMER_DEF(m_test_tx_timer);
  61. void main() {
  62. APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20);
  63. znordic_init();
  64. // SingleLeadECG_beep_init();
  65. // SingleLeadECG_beep_set_state(false);
  66. NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100));
  67. NRF_LOG_INTERNAL_FLUSH();
  68. SingleLeadECG_eeprom_init();
  69. // nrf_delay_ms(20);
  70. // SingleLeadECG_eeprom_read(0, eepromw_rx_data, 256);
  71. // for (size_t i = 0; i < 256; i++) {
  72. // ZLOGI("eepromw_rx_data[%d] = %d", i, eepromw_rx_data[i]);
  73. // NRF_LOG_INTERNAL_FLUSH();
  74. // }
  75. ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb));
  76. ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(100), NULL));
  77. znordic_loop();
  78. }
  79. #endif
  80. /*******************************************************************************
  81. * +LED测试 *
  82. *******************************************************************************/
  83. #if 1
  84. static void test_tx_timer_cb(void* p_context) {
  85. static uint32_t data;
  86. data++;
  87. ZLOGI("test_tx_timer_cb %d", data);
  88. SingleLeadECG_led_green_set_state(data % 2 == 0);
  89. SingleLeadECG_led_blue_set_state(data % 3 == 0);
  90. }
  91. extern uint32_t g_nrf_log_tx_pin;
  92. APP_TIMER_DEF(m_test_tx_timer);
  93. int main() {
  94. APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20);
  95. znordic_init();
  96. NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100));
  97. NRF_LOG_INTERNAL_FLUSH();
  98. SingleLeadECG_screen_init();
  99. ssd1306_basic_init(SSD1306_INTERFACE_SPI, SSD1306_ADDR_SA0_0);
  100. ssd1306_basic_display_on();
  101. // ssd1306_basic_string(0, 0, "123456789123456789123", 21, 0, SSD1306_FONT_12);
  102. // ssd1306_basic_string(0, 16, "123456789123456789123", 21, 0, SSD1306_FONT_12);
  103. // ssd1306_basic_string(0, 32, "123456789123456789123", 21, 0, SSD1306_FONT_12);
  104. // ssd1306_basic_string(0, 48, "123456789123456789123", 21, 0, SSD1306_FONT_12);
  105. for (size_t i = 0; i < 127; i++) {
  106. for (size_t j = 0; j < 64; j++)
  107. {
  108. ssd1306_basic_write_point(i, j, 1);
  109. }
  110. }
  111. // ssd1306_gram_update(ssd1306_handler());
  112. SingleLeadECG_led_init();
  113. ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb));
  114. ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(100), NULL));
  115. znordic_loop();
  116. }
  117. #endif
  118. /*******************************************************************************
  119. * ECG *
  120. *******************************************************************************/
  121. #if 0
  122. #define UART_TX_BUF_SIZE 256 /**< UART TX buffer size. */
  123. #define UART_RX_BUF_SIZE 256 /**< UART RX buffer size. */
  124. uint32_t err_code;
  125. app_uart_comm_params_t const comm_params = //
  126. {
  127. .rx_pin_no = UART_PIN_DISCONNECTED,
  128. .tx_pin_no = 41,
  129. .rts_pin_no = UART_PIN_DISCONNECTED,
  130. .cts_pin_no = UART_PIN_DISCONNECTED,
  131. .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
  132. .use_parity = false,
  133. .baud_rate = NRF_UARTE_BAUDRATE_921600,
  134. };
  135. void uart_error_handle(app_uart_evt_t* p_event) {}
  136. void uartinit() {
  137. APP_UART_FIFO_INIT(&comm_params, UART_RX_BUF_SIZE, UART_TX_BUF_SIZE, uart_error_handle, APP_IRQ_PRIORITY_LOWEST, err_code);
  138. APP_ERROR_CHECK(err_code);
  139. }
  140. void zchip_log(const char* fmt, ...) {
  141. static char tx[256] = {0};
  142. va_list args;
  143. va_start(args, fmt);
  144. vsprintf(tx, fmt, args);
  145. for (size_t i = 0; i < strlen(tx); i++) {
  146. app_uart_put(tx[i]);
  147. }
  148. va_end(args);
  149. }
  150. static void test_tx_timer_cb(void* p_context) {
  151. static uint32_t data;
  152. data++;
  153. // SingleLeadECG_ecg_nlod_get_connected_state();
  154. // SingleLeadECG_ecg_plod_get_connected_state();
  155. // SingleLeadECG_ecg_plod_get_ecg_val();
  156. // ZLOGI("%d nlod %d plod %d ecg:%d", data, SingleLeadECG_ecg_nlod_get_connected_state(), SingleLeadECG_ecg_plod_get_connected_state(), SingleLeadECG_ecg_plod_get_ecg_val());
  157. // ZLOGI("%d,%d,%d", SingleLeadECG_ecg_nlod_get_connected_state(), SingleLeadECG_ecg_plod_get_connected_state(), SingleLeadECG_ecg_plod_get_ecg_val());
  158. zchip_log("%d,%d,%d\n", SingleLeadECG_ecg_nlod_get_connected_state(), SingleLeadECG_ecg_plod_get_connected_state(), SingleLeadECG_ecg_plod_get_ecg_val());
  159. // app_uart_put('c');
  160. // app_uart_put('c');
  161. // app_uart_put('c');
  162. // app_uart_put('c');
  163. // app_uart_put('c');
  164. // NRF_LOG_INFO("......");
  165. }
  166. extern uint32_t g_nrf_log_tx_pin;
  167. APP_TIMER_DEF(m_test_tx_timer);
  168. void main() {
  169. // g_nrf_log_tx_pin = 41;
  170. APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20);
  171. znordic_init();
  172. SingleLeadECG_adc_module_init();
  173. uartinit();
  174. NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100));
  175. NRF_LOG_INTERNAL_FLUSH();
  176. SingleLeadECG_ecg_init();
  177. ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb));
  178. ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(5), NULL));
  179. znordic_loop();
  180. }
  181. #endif
  182. /*******************************************************************************
  183. * *
  184. *******************************************************************************/
  185. #if 0
  186. extern uint32_t g_nrf_log_tx_pin;
  187. APP_TIMER_DEF(m_test_tx_timer);
  188. ZDATACHANNEL_DEF(m_zhrs, 2 /*回调事件优先级*/, 1 /*client num*/);
  189. static const char* hex2str(const uint8_t* data, int32_t len) {
  190. static char rx[64] = {0};
  191. memset(rx, 0, sizeof(rx));
  192. for (int32_t i = 0; i < len; i++) {
  193. sprintf(rx + i * 2, "%02X", data[i]);
  194. }
  195. return rx;
  196. }
  197. static void zdatachannel_data_handler(zdatachannel_evt_t* p_evt) {
  198. /**
  199. * @brief
  200. */
  201. if (p_evt->type == ZDATACHANNEL_EVT_RX_DATA) {
  202. ZLOGI("rx:%s", hex2str(p_evt->params.rx_data.p_data, p_evt->params.rx_data.length));
  203. }
  204. }
  205. static void on_service_init(void) {
  206. /**
  207. * @brief
  208. */
  209. ZLOGI("init zdatachannel service");
  210. zdatachannel_init_t zdatachannle_init;
  211. memset(&zdatachannle_init, 0, sizeof(zdatachannle_init));
  212. zdatachannle_init.data_handler = zdatachannel_data_handler;
  213. ZERROR_CHECK(zdatachannel_init(&m_zhrs, &zdatachannle_init));
  214. }
  215. void main() {
  216. APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20);
  217. ThreeLeadECG_sdcard_base_init();
  218. znordic_init(0, 20);
  219. NRF_LOG_INFO("compile time :%s", __TIME__);
  220. NRF_LOG_INFO("Version :%d", VERSION);
  221. NRF_LOG_INFO("Manufacturer :%s", MANUFACTURER_NAME);
  222. static zble_module_cfg_t cfg = //
  223. {
  224. .deviceName = BLE_NAME,
  225. .on_service_init = on_service_init,
  226. };
  227. zble_module_init(&cfg);
  228. zble_module_start_adv();
  229. znordic_loop();
  230. }
  231. #endif
  232. #if 0
  233. /*******************************************************************************
  234. * ADCTEST *
  235. *******************************************************************************/
  236. static void test_tx_timer_cb(void* p_context) {
  237. static uint32_t data;
  238. data++;
  239. // ZLOGI("test_tx_timer_cb %d", data);
  240. static uint8_t eepromw_test_data[256];
  241. static uint8_t eepromw_rx_data[256];
  242. for (size_t i = 0; i < 256; i++) {
  243. eepromw_test_data[i] = i;
  244. }
  245. int16_t adc = SingleLeadECG_battery_get_adc_val();
  246. int16_t mv = adc * 1.0 / 4096 * 3.6 * 1000 / 2.0 * 3;
  247. ZLOGI("battery:%d", mv);
  248. }
  249. extern uint32_t g_nrf_log_tx_pin;
  250. APP_TIMER_DEF(m_test_tx_timer);
  251. void main() {
  252. APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20);
  253. znordic_init();
  254. SingleLeadECG_adc_module_init();
  255. SingleLeadECG_battery_init();
  256. // SingleLeadECG_beep_init();
  257. // SingleLeadECG_beep_set_state(false);
  258. NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100));
  259. NRF_LOG_INTERNAL_FLUSH();
  260. // nrf_delay_ms(20);
  261. // SingleLeadECG_eeprom_read(0, eepromw_rx_data, 256);
  262. // for (size_t i = 0; i < 256; i++) {
  263. // ZLOGI("eepromw_rx_data[%d] = %d", i, eepromw_rx_data[i]);
  264. // NRF_LOG_INTERNAL_FLUSH();
  265. // }
  266. ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb));
  267. ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(100), NULL));
  268. znordic_loop();
  269. }
  270. #endif
  271. #if 0
  272. /*******************************************************************************
  273. * 3-ADS1293- *
  274. *******************************************************************************/
  275. extern uint32_t g_nrf_log_tx_pin;
  276. APP_TIMER_DEF(m_test_tx_timer);
  277. static void zdatachanel_send_log(const char* fmt, ...) {
  278. static char tx[256] = {0};
  279. static uint16_t len = 0;
  280. va_list args;
  281. va_start(args, fmt);
  282. len = vsprintf(tx, fmt, args);
  283. zdatachannel_data_send((uint8_t*)tx, &len);
  284. va_end(args);
  285. }
  286. static const char* dumplodstate(uint16_t lodstate) {
  287. static char buf[64];
  288. memset(buf, 0, sizeof(buf));
  289. /**
  290. * @brief
  291. * 1111_0000_0000_0000
  292. */
  293. sprintf(buf, "%d%d%d%d_%d%d%d%d_%d%d%d%d_%d%d%d%d", //
  294. lodstate >> 15 & 0x1, lodstate >> 14 & 0x1, lodstate >> 13 & 0x1, lodstate >> 12 & 0x1, //
  295. lodstate >> 11 & 0x1, lodstate >> 10 & 0x1, lodstate >> 9 & 0x1, lodstate >> 8 & 0x1, //
  296. lodstate >> 7 & 0x1, lodstate >> 6 & 0x1, lodstate >> 5 & 0x1, lodstate >> 4 & 0x1, //
  297. lodstate >> 3 & 0x1, lodstate >> 2 & 0x1, lodstate >> 1 & 0x1, lodstate >> 0 & 0x1);
  298. return buf;
  299. }
  300. static void test_tx_timer_cb(void* p_context) {
  301. static uint32_t data;
  302. data++;
  303. uint16_t val;
  304. ThreeLeadECG_ads1293_get_lod_state(&val);
  305. #if 0
  306. uint32_t sample0;
  307. uint32_t sample1;
  308. uint32_t sample2;
  309. ThreeLeadECG_ads1293_sample(&sample0, &sample1, &sample2);
  310. zdatachanel_send_log("%d,%d,%d\n", sample0, sample1, sample2);
  311. #endif
  312. uint32_t sample0;
  313. uint32_t sample1;
  314. uint32_t sample2;
  315. uint32_t sample10;
  316. uint32_t sample11;
  317. uint32_t sample12;
  318. ThreeLeadECG_ads1293_sample_all(&sample0, &sample1, &sample2, &sample10, &sample11, &sample12);
  319. zdatachanel_send_log("%d,%d,%d,%d,%d,%d\n", sample0, sample1, sample2, sample10, sample11, sample12);
  320. // zdatachanel_send_log("%d,%d\n", sample0, sample1);
  321. // zdatachanel_send_log("%d,%d,%d\n", data, data, data);
  322. // zdatachanel_send_log("%d %d %s\n", ThreeLeadECG_ready_pin_state_get(), ThreeLeadECG_LineInputDet_get_state(), dumplodstate(val));
  323. // zdatachannel_data_send(tx, &p_length);
  324. }
  325. ZDATACHANNEL_DEF(m_zhrs, 2 /*回调事件优先级*/, 1 /*client num*/);
  326. static const char* hex2str(const uint8_t* data, int32_t len) {
  327. static char rx[64] = {0};
  328. memset(rx, 0, sizeof(rx));
  329. for (int32_t i = 0; i < len; i++) {
  330. sprintf(rx + i * 2, "%02X", data[i]);
  331. }
  332. return rx;
  333. }
  334. char cmdcache[256] = {0};
  335. static void zdatachannel_data_handler(zdatachannel_evt_t* p_evt) {
  336. /**
  337. * @brief
  338. */
  339. if (p_evt->type == ZDATACHANNEL_EVT_RX_DATA) {
  340. }
  341. }
  342. static void on_service_init(void) {
  343. /**
  344. * @brief
  345. */
  346. ZLOGI("init zdatachannel service");
  347. zdatachannel_init_t zdatachannle_init;
  348. memset(&zdatachannle_init, 0, sizeof(zdatachannle_init));
  349. zdatachannle_init.data_handler = zdatachannel_data_handler;
  350. ZERROR_CHECK(zdatachannel_init(&m_zhrs, &zdatachannle_init));
  351. }
  352. void main() {
  353. APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20);
  354. ThreeLeadECG_sdcard_base_init();
  355. znordic_init(0, 20);
  356. NRF_LOG_INFO("compile time :%s", __TIME__);
  357. NRF_LOG_INFO("Version :%d", VERSION);
  358. NRF_LOG_INFO("Manufacturer :%s", MANUFACTURER_NAME);
  359. static zble_module_cfg_t cfg = //
  360. {
  361. .deviceName = BLE_NAME,
  362. .on_service_init = on_service_init,
  363. };
  364. zble_module_init(&cfg);
  365. ThreeLeadECG_ecg_init();
  366. ThreeLeadECG_LineInputDet_init();
  367. ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb));
  368. ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(5), NULL));
  369. zble_module_start_adv();
  370. znordic_loop();
  371. }
  372. #endif
  373. #if 0
  374. /*******************************************************************************
  375. * 3-led测试 *
  376. *******************************************************************************/
  377. static void test_tx_timer_cb(void* p_context) {
  378. static uint32_t data;
  379. data++;
  380. ZLOGI("test_tx_timer_cb %d", data);
  381. ThreeLeadECG_led_green_set_state(data % 2 == 0);
  382. }
  383. extern uint32_t g_nrf_log_tx_pin;
  384. APP_TIMER_DEF(m_test_tx_timer);
  385. void main() {
  386. APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20);
  387. znordic_init();
  388. NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100));
  389. NRF_LOG_INTERNAL_FLUSH();
  390. ThreeLeadECG_led_init();
  391. ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb));
  392. ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(100), NULL));
  393. znordic_loop();
  394. }
  395. #endif
  396. #if 0
  397. /*******************************************************************************
  398. * 3- *
  399. *******************************************************************************/
  400. static void test_tx_timer_cb(void* p_context) {
  401. static uint32_t data;
  402. data++;
  403. int16_t mv = ThreeLeadECG_battery_get_adc_val() * 1.0 / 4096 * 3.3 * 1000 / 2.0 * 3;
  404. ZLOGI("battery:%d", mv);
  405. }
  406. extern uint32_t g_nrf_log_tx_pin;
  407. APP_TIMER_DEF(m_test_tx_timer);
  408. void main() {
  409. APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20);
  410. znordic_init();
  411. NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100));
  412. NRF_LOG_INTERNAL_FLUSH();
  413. ThreeLeadECG_adc_module_init();
  414. ThreeLeadECG_battery_init();
  415. ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb));
  416. ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(100), NULL));
  417. znordic_loop();
  418. }
  419. #endif
  420. #if 0
  421. /*******************************************************************************
  422. * 3-flash测试 *
  423. *******************************************************************************/
  424. static void test_tx_timer_cb(void* p_context) {
  425. static uint32_t data;
  426. data++;
  427. }
  428. extern uint32_t g_nrf_log_tx_pin;
  429. APP_TIMER_DEF(m_test_tx_timer);
  430. void main() {
  431. APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20);
  432. znordic_init();
  433. NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100));
  434. NRF_LOG_INTERNAL_FLUSH();
  435. ThreeLeadECG_sdcard_base_init();
  436. ThreeLeadECG_sdcard_mount();
  437. ThreeLeadECG_sdcard_umount();
  438. ThreeLeadECG_sdcard_mount();
  439. ThreeLeadECG_sdcard_umount();
  440. ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb));
  441. ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(100), NULL));
  442. znordic_loop();
  443. }
  444. #endif
  445. #if 0
  446. /*******************************************************************************
  447. * 3-flash测试 *
  448. *******************************************************************************/
  449. static void test_tx_timer_cb(void* p_context) {
  450. static uint32_t data;
  451. data++;
  452. ZLOGI("button %d", ThreeLeadECG_button_get_state());
  453. }
  454. extern uint32_t g_nrf_log_tx_pin;
  455. APP_TIMER_DEF(m_test_tx_timer);
  456. void main() {
  457. APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20);
  458. znordic_init();
  459. NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100));
  460. NRF_LOG_INTERNAL_FLUSH();
  461. ThreeLeadECG_button_init();
  462. ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb));
  463. ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(300), NULL));
  464. znordic_loop();
  465. }
  466. #endif