diff --git a/app/app.uvoptx b/app/app.uvoptx index d69b009..5527a63 100644 --- a/app/app.uvoptx +++ b/app/app.uvoptx @@ -503,7 +503,7 @@ 1 12 1 - 1 + 0 0 0 .\src\basic\ads1293\ads1293.c @@ -583,6 +583,18 @@ 0 0 + + 1 + 19 + 1 + 0 + 0 + 0 + .\src\one_conduction\heart_wave_sample_service.c + heart_wave_sample_service.c + 0 + 0 + @@ -593,7 +605,7 @@ 0 2 - 19 + 20 1 0 0 @@ -613,7 +625,7 @@ 0 3 - 20 + 21 1 0 0 @@ -625,7 +637,7 @@ 3 - 21 + 22 1 0 0 @@ -645,7 +657,7 @@ 0 4 - 22 + 23 1 0 0 @@ -665,7 +677,7 @@ 0 5 - 23 + 24 1 0 0 @@ -677,7 +689,7 @@ 5 - 24 + 25 1 0 0 @@ -689,7 +701,7 @@ 5 - 25 + 26 1 0 0 @@ -701,7 +713,7 @@ 5 - 26 + 27 1 0 0 @@ -713,7 +725,7 @@ 5 - 27 + 28 1 0 0 @@ -725,7 +737,7 @@ 5 - 28 + 29 1 0 0 @@ -737,7 +749,7 @@ 5 - 29 + 30 1 0 0 @@ -749,7 +761,7 @@ 5 - 30 + 31 1 0 0 @@ -769,7 +781,7 @@ 0 6 - 31 + 32 1 0 0 @@ -789,7 +801,7 @@ 0 7 - 32 + 33 1 0 0 @@ -801,7 +813,7 @@ 7 - 33 + 34 1 0 0 @@ -813,7 +825,7 @@ 7 - 34 + 35 1 0 0 @@ -825,7 +837,7 @@ 7 - 35 + 36 1 0 0 @@ -837,7 +849,7 @@ 7 - 36 + 37 1 0 0 @@ -849,7 +861,7 @@ 7 - 37 + 38 1 0 0 @@ -861,7 +873,7 @@ 7 - 38 + 39 1 0 0 @@ -873,7 +885,7 @@ 7 - 39 + 40 1 0 0 @@ -885,7 +897,7 @@ 7 - 40 + 41 1 0 0 @@ -897,7 +909,7 @@ 7 - 41 + 42 1 0 0 @@ -909,7 +921,7 @@ 7 - 42 + 43 1 0 0 @@ -921,7 +933,7 @@ 7 - 43 + 44 1 0 0 @@ -933,7 +945,7 @@ 7 - 44 + 45 1 0 0 @@ -945,7 +957,7 @@ 7 - 45 + 46 1 0 0 @@ -957,7 +969,7 @@ 7 - 46 + 47 1 0 0 @@ -969,7 +981,7 @@ 7 - 47 + 48 1 0 0 @@ -981,7 +993,7 @@ 7 - 48 + 49 1 0 0 @@ -993,7 +1005,7 @@ 7 - 49 + 50 1 0 0 @@ -1005,7 +1017,7 @@ 7 - 50 + 51 1 0 0 @@ -1015,6 +1027,18 @@ 0 0 + + 7 + 52 + 1 + 0 + 0 + 0 + ..\sdk\modules\nrfx\drivers\src\nrfx_timer.c + nrfx_timer.c + 0 + 0 + @@ -1025,7 +1049,7 @@ 0 8 - 51 + 53 1 0 0 @@ -1037,7 +1061,7 @@ 8 - 52 + 54 1 0 0 @@ -1049,7 +1073,7 @@ 8 - 53 + 55 1 0 0 @@ -1061,7 +1085,7 @@ 8 - 54 + 56 1 0 0 @@ -1073,7 +1097,7 @@ 8 - 55 + 57 1 0 0 @@ -1085,7 +1109,7 @@ 8 - 56 + 58 1 0 0 @@ -1097,7 +1121,7 @@ 8 - 57 + 59 1 0 0 @@ -1109,7 +1133,7 @@ 8 - 58 + 60 1 0 0 @@ -1121,7 +1145,7 @@ 8 - 59 + 61 1 0 0 @@ -1133,7 +1157,7 @@ 8 - 60 + 62 1 0 0 @@ -1145,7 +1169,7 @@ 8 - 61 + 63 1 0 0 @@ -1157,7 +1181,7 @@ 8 - 62 + 64 1 0 0 @@ -1169,7 +1193,7 @@ 8 - 63 + 65 1 0 0 @@ -1181,7 +1205,7 @@ 8 - 64 + 66 1 0 0 @@ -1193,7 +1217,7 @@ 8 - 65 + 67 1 0 0 @@ -1205,7 +1229,7 @@ 8 - 66 + 68 1 0 0 @@ -1217,7 +1241,7 @@ 8 - 67 + 69 1 0 0 @@ -1229,7 +1253,7 @@ 8 - 68 + 70 1 0 0 @@ -1241,7 +1265,7 @@ 8 - 69 + 71 1 0 0 @@ -1253,7 +1277,7 @@ 8 - 70 + 72 1 0 0 @@ -1265,7 +1289,7 @@ 8 - 71 + 73 1 0 0 @@ -1277,7 +1301,7 @@ 8 - 72 + 74 1 0 0 @@ -1289,7 +1313,7 @@ 8 - 73 + 75 1 0 0 @@ -1301,7 +1325,7 @@ 8 - 74 + 76 1 0 0 @@ -1313,7 +1337,7 @@ 8 - 75 + 77 1 0 0 @@ -1325,7 +1349,7 @@ 8 - 76 + 78 1 0 0 @@ -1337,7 +1361,7 @@ 8 - 77 + 79 1 0 0 @@ -1357,7 +1381,7 @@ 0 9 - 78 + 80 1 0 0 @@ -1369,7 +1393,7 @@ 9 - 79 + 81 1 0 0 @@ -1381,7 +1405,7 @@ 9 - 80 + 82 1 0 0 @@ -1393,7 +1417,7 @@ 9 - 81 + 83 1 0 0 @@ -1405,7 +1429,7 @@ 9 - 82 + 84 1 0 0 @@ -1417,7 +1441,7 @@ 9 - 83 + 85 1 0 0 @@ -1437,7 +1461,7 @@ 0 10 - 84 + 86 1 0 0 @@ -1449,7 +1473,7 @@ 10 - 85 + 87 1 0 0 @@ -1461,7 +1485,7 @@ 10 - 86 + 88 1 0 0 @@ -1481,7 +1505,7 @@ 0 11 - 87 + 89 1 0 0 @@ -1493,7 +1517,7 @@ 11 - 88 + 90 1 0 0 @@ -1505,7 +1529,7 @@ 11 - 89 + 91 1 0 0 @@ -1525,7 +1549,7 @@ 0 12 - 90 + 92 1 0 0 @@ -1545,7 +1569,7 @@ 0 13 - 91 + 93 1 0 0 @@ -1557,7 +1581,7 @@ 13 - 92 + 94 1 0 0 diff --git a/app/app.uvprojx b/app/app.uvprojx index 74de99b..bf5b41b 100644 --- a/app/app.uvprojx +++ b/app/app.uvprojx @@ -473,6 +473,11 @@ 1 .\src\one_conduction\zeeprom_fs.c + + heart_wave_sample_service.c + 1 + .\src\one_conduction\heart_wave_sample_service.c + @@ -1734,6 +1739,11 @@ 1 ..\sdk\modules\nrfx\drivers\src\nrfx_rtc.c + + nrfx_timer.c + 1 + ..\sdk\modules\nrfx\drivers\src\nrfx_timer.c + @@ -4287,6 +4297,11 @@ 1 .\src\one_conduction\zeeprom_fs.c + + heart_wave_sample_service.c + 1 + .\src\one_conduction\heart_wave_sample_service.c + @@ -5548,6 +5563,11 @@ 1 ..\sdk\modules\nrfx\drivers\src\nrfx_rtc.c + + nrfx_timer.c + 1 + ..\sdk\modules\nrfx\drivers\src\nrfx_timer.c + diff --git a/app/config/sdk_config.h b/app/config/sdk_config.h index 9311c24..1154922 100644 --- a/app/config/sdk_config.h +++ b/app/config/sdk_config.h @@ -3979,13 +3979,13 @@ // NRFX_TIMER_ENABLED - nrfx_timer - TIMER periperal driver //========================================================== #ifndef NRFX_TIMER_ENABLED -#define NRFX_TIMER_ENABLED 0 +#define NRFX_TIMER_ENABLED 1 #endif // NRFX_TIMER0_ENABLED - Enable TIMER0 instance #ifndef NRFX_TIMER0_ENABLED -#define NRFX_TIMER0_ENABLED 0 +#define NRFX_TIMER0_ENABLED 1 #endif // NRFX_TIMER1_ENABLED - Enable TIMER1 instance @@ -5698,7 +5698,7 @@ // TIMER_ENABLED - nrf_drv_timer - TIMER periperal driver - legacy layer //========================================================== #ifndef TIMER_ENABLED -#define TIMER_ENABLED 0 +#define TIMER_ENABLED 1 #endif // TIMER_DEFAULT_CONFIG_FREQUENCY - Timer frequency if in Timer mode @@ -5758,14 +5758,14 @@ #ifndef TIMER0_ENABLED -#define TIMER0_ENABLED 0 +#define TIMER0_ENABLED 1 #endif // TIMER1_ENABLED - Enable TIMER1 instance #ifndef TIMER1_ENABLED -#define TIMER1_ENABLED 0 +#define TIMER1_ENABLED 1 #endif // TIMER2_ENABLED - Enable TIMER2 instance diff --git a/app/src/one_conduction/app_event.h b/app/src/one_conduction/app_event.h new file mode 100644 index 0000000..fbdaf37 --- /dev/null +++ b/app/src/one_conduction/app_event.h @@ -0,0 +1,25 @@ +#pragma once +#include + +typedef enum { + kplod_connected_event = 0, // 导联连接事件 + kplod_disconnected_event, // 导联断开事件 + kplod_connecting_event, // 导联连接中事件 + + kplod_start_charge_event, // 充电事件 + kplod_charging_event, // 充电中 + kplod_end_charge_event, // 充电结束事件 + + kevent_tmr_scheduler_event, // 定时器调度事件 + kevent_capture_data_event, // 采样数据回调 +} app_event_type_t; + +typedef struct { + app_event_type_t eventType; + union { + uint32_t plod_connected_accumulation_time; // 导联连接累计时间 + uint8_t* capture_data_cache; // 实时采样数据,数据长度为256字节 + } val; +} app_event_t; + +void app_event_process_cb(void* p_event_data, uint16_t event_size); diff --git a/app/src/one_conduction/display_manager.c b/app/src/one_conduction/display_manager.c index 0336a3e..10ea968 100644 --- a/app/src/one_conduction/display_manager.c +++ b/app/src/one_conduction/display_manager.c @@ -8,6 +8,7 @@ #include "basic/ssd1306/driver_ssd1306_basic.h" #include "basic/ssd1306/wave_drawer.h" #include "font.h" +#include "heart_wave_sample_service.h" #include "one_conduction_board.h" PageState_t g_pageState; @@ -269,6 +270,9 @@ typedef struct { int heartrate_x; int heartrate_y; + bool in30spage; + bool hasover30s; + } sample_page_state_t; sample_page_state_t m_sample_page_state; @@ -280,13 +284,15 @@ void dsp_mgr_change_to_sampling() { // sps->wave_drawser_hight = 40; sps->wave_drawser_width = 120; - sps->progress_x = SMAPLE_PAGE_START_X+1; + sps->progress_x = SMAPLE_PAGE_START_X + 1; sps->progress_y = SMAPLE_PAGE_START_Y + sps->wave_drawser_hight + 3 + 4; sps->progress_width = 80; sps->progress_hight = 8; sps->heartrate_x = sps->progress_x + sps->progress_width + 2; sps->heartrate_y = sps->progress_y - 4; + sps->in30spage = false; + sps->hasover30s = false; ssd1306_basic_clear_gram(); @@ -301,19 +307,60 @@ void dsp_mgr_change_to_sampling() { // dsp_mgr_change_to_page(kPage_sampling); } +void samplePage_set_in30s_page() { + /** + * @brief + * 不足30秒[X] + */ + ssd1306_basic_clear(); + uint8_t x = 20; + uint8_t y = 32 - font24x24_zh_lib.heightPixel / 2; // 12*4 +12 + uint8_t xchange, ychange; + + // ssd1306_basic_draw_str(&x, &y, "123", &fontclocklib); + + ssd1306_basic_draw_str(x, y, &xchange, &ychange, "不足", &font24x24_zh_lib); + x = x + xchange; + ssd1306_basic_draw_str(x, y, &xchange, &ychange, "30", &font12x24_asiic_lib); + x = x + xchange; + ssd1306_basic_draw_str(x, y, &xchange, &ychange, "秒", &font24x24_zh_lib); + x = x + xchange; + + ssd1306_basic_gram_update(); + dsp_mgr_change_to_page(kPage_samplingError); +} + void samplePage_update_state(int progress_s, int wave_y, int heartrate) { // + sample_page_state_t* sps = &m_sample_page_state; uint8_t xchange, ychange; - // 25 <=> 30 - int progress = progress_s / 30.0 * 25; - wave_drawer_draw_next_point(&sps->wave_drawer, wave_y); - ssd1306_basic_draw_progress(sps->progress_x, sps->progress_y, sps->progress_width, sps->progress_hight, 25, progress); - if (heartrate <= 0) { - ssd1306_basic_draw_str(sps->heartrate_x, sps->heartrate_y, &xchange, &ychange, "<>--", &font_asicc16x8_lib); + if (!sps->in30spage) { + if (!sps->hasover30s && progress_s > 30) { + // 切换到30s页面 + + } else { + // 25 <=> 30 + int progress = progress_s / 30.0 * 25; + wave_drawer_draw_next_point(&sps->wave_drawer, wave_y); + ssd1306_basic_draw_progress(sps->progress_x, sps->progress_y, sps->progress_width, sps->progress_hight, 25, progress); + if (heartrate <= 0) { + ssd1306_basic_draw_str(sps->heartrate_x, sps->heartrate_y, &xchange, &ychange, "<>--", &font_asicc16x8_lib); + } + ssd1306_basic_gram_update(); + } + } else { } } +void samplePage_schedule() { + int capturetime = hwss_has_captured_time_ms(); + int wave_y = (int)hwss_read_val(); + int heartrate = (int)hwss_read_heart_rate(); + // ZLOGI("samplePage_schedule %d %d %d", capturetime, wave_y, heartrate); + samplePage_update_state(capturetime / 1000, wave_y, heartrate); +} + /******************************************************************************* * SCHEDULE * *******************************************************************************/ @@ -326,6 +373,10 @@ static void dsp_mgr_schedule_tmr_cb(void* p_context) { // welcomePage_schedule(); } else if (g_pageState.page == kPage_main) { mainPage_schedule(); + } else if (g_pageState.page == kPage_preparePage) { + PreparePage_schedule(); + } else if (g_pageState.page == kPage_sampling) { + samplePage_schedule(); } } @@ -335,7 +386,7 @@ void dsp_mgr_init(void) { if (!timer_inited) { ZERROR_CHECK(app_timer_create(&m_dsp_mgr_schedule_tmr, APP_TIMER_MODE_REPEATED, dsp_mgr_schedule_tmr_cb)); } - ZERROR_CHECK(app_timer_start(m_dsp_mgr_schedule_tmr, APP_TIMER_TICKS(101), NULL)); + ZERROR_CHECK(app_timer_start(m_dsp_mgr_schedule_tmr, APP_TIMER_TICKS(30), NULL)); timer_inited = true; } void dsp_mgr_uninit(void) { diff --git a/app/src/one_conduction/heart_wave_sample_service.c b/app/src/one_conduction/heart_wave_sample_service.c new file mode 100644 index 0000000..d0d6744 --- /dev/null +++ b/app/src/one_conduction/heart_wave_sample_service.c @@ -0,0 +1,97 @@ +#include "heart_wave_sample_service.h" + +#include "app_event.h" +#include "nrfx_timer.h" +#include "one_conduction_board.h" + +static const nrfx_timer_t m_timer = NRFX_TIMER_INSTANCE(1); /**< Timer used for channel sweeps and tx with duty cycle. */ +static bool m_timer_started = false; /**< True if timer is running. */ + +static uint16_t m_capture_buffer_a[128]; +static uint16_t m_capture_buffer_b[128]; + +static uint16_t* m_capture_buffer; +static uint16_t m_capture_buffer_index = 0; + +volatile static float m_real_time_data = 0; // 0->100 +static uint32_t m_start_capture_tp; + +static void swap_buffer() { + if (m_capture_buffer == NULL) { + m_capture_buffer = m_capture_buffer_a; + m_capture_buffer_index = 0; + return; + } + + if (m_capture_buffer == m_capture_buffer_a) { + m_capture_buffer = m_capture_buffer_b; + } else { + m_capture_buffer = m_capture_buffer_a; + } + m_capture_buffer_index = 0; + return; +} + +void nrfx_timer_event_handler(nrf_timer_event_t event_type, void* p_context) { // + uint16_t val = SingleLeadECG_battery_get_adc_val(); // 12bit + + m_real_time_data = (float)val / 4096.0f * 100; + + if (m_capture_buffer == NULL) { + swap_buffer(); + } + + if (m_capture_buffer_index < 128) { + m_capture_buffer[m_capture_buffer_index++] = val; + } + + if (m_capture_buffer_index == 128) { + app_event_t evt; + evt.eventType = kevent_capture_data_event; + evt.val.capture_data_cache = (uint8_t*)m_capture_buffer; + swap_buffer(); + app_sched_event_put(&evt, sizeof(evt), app_event_process_cb); + } +} + +void hwss_init(void) { + if (m_timer_started) { + return; + } + /** + * @brief 初始化定时器 + */ + nrfx_err_t err; + nrfx_timer_config_t timer_cfg = { + .frequency = NRF_TIMER_FREQ_125kHz, + .mode = NRF_TIMER_MODE_TIMER, + .bit_width = NRF_TIMER_BIT_WIDTH_24, + .p_context = NULL, + .interrupt_priority = NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY, + }; + + err = nrfx_timer_init(&m_timer, &timer_cfg, nrfx_timer_event_handler); + if (err != NRFX_SUCCESS) { + NRF_LOG_ERROR("nrfx_timer_init failed with: %d\n", err); + } + uint32_t timer_ticks = nrfx_timer_ms_to_ticks(&m_timer, 5); // 200HZ + nrfx_timer_extended_compare(&m_timer, NRF_TIMER_CC_CHANNEL0, timer_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true); + m_timer_started = true; +} +void hwss_uninit(void) { nrfx_timer_disable(&m_timer); } + +void hwss_start_capture(void) { + m_start_capture_tp = znordic_getpower_on_s(); + nrfx_timer_enable(&m_timer); +} +void hwss_stop_capture(void) { nrfx_timer_disable(&m_timer); } + +float hwss_read_val(void) { + __disable_irq(); + float val = m_real_time_data; + __enable_irq(); + return val; +} +float hwss_read_heart_rate(void) { return 0; } + +int hwss_has_captured_time_ms() { return (znordic_getpower_on_s() - m_start_capture_tp) * 1000; } diff --git a/app/src/one_conduction/heart_wave_sample_service.h b/app/src/one_conduction/heart_wave_sample_service.h new file mode 100644 index 0000000..65e18dc --- /dev/null +++ b/app/src/one_conduction/heart_wave_sample_service.h @@ -0,0 +1,15 @@ +#pragma once +#include "one_conduction_board.h" + +// 每256个字节触发一次回调 +typedef void (*heart_wave_sample_service_callback_t)(uint16_t *p_data, uint16_t length); + +void hwss_init(void); +void hwss_uninit(void); + +void hwss_start_capture(void); +void hwss_stop_capture(void); + +float hwss_read_val(void); +float hwss_read_heart_rate(void); +int hwss_has_captured_time_ms(); diff --git a/app/src/one_conduction/one_conduction_board.c b/app/src/one_conduction/one_conduction_board.c index 0561847..6a75d7c 100644 --- a/app/src/one_conduction/one_conduction_board.c +++ b/app/src/one_conduction/one_conduction_board.c @@ -228,6 +228,7 @@ void SingleLeadECG_battery_deinit() { nrfx_saadc_channel_uninit(BATTERY_ADC_CHAN int16_t SingleLeadECG_battery_get_adc_val() { int16_t val = znrf_adc_channel_read_val(BATTERY_ADC_CHANNEL); + if (val < 0) val = 0; return val; } diff --git a/app/src/one_conduction/one_conduction_main.c b/app/src/one_conduction/one_conduction_main.c index c1f31ac..6e5f66e 100644 --- a/app/src/one_conduction/one_conduction_main.c +++ b/app/src/one_conduction/one_conduction_main.c @@ -1,25 +1,15 @@ #include +#include "app_event.h" #include "basic/zble_module.h" #include "basic/zdatachannel_service.h" #include "display_manager.h" +#include "heart_wave_sample_service.h" #include "one_conduction_board.h" #include "sample_data_manager.h" #include "znordic.h" typedef enum { - kplod_connected_event = 0, // 导联连接事件 - kplod_disconnected_event, // 导联断开事件 - kplod_connecting_event, // 导联连接中事件 - - kplod_start_charge_event, // 充电事件 - kplod_charging_event, // 充电中 - kplod_end_charge_event, // 充电结束事件 - - kevent_tmr_scheduler_event, // 定时器调度事件 -} app_event_type_t; - -typedef enum { // 待机 kdevice_state_standby = 0, // 开机 @@ -69,13 +59,6 @@ static const char* device_state_to_str(device_state_t ds) { } } -typedef struct { - app_event_type_t eventType; - union { - uint32_t plod_connected_accumulation_time; // 导联连接累计时间 - } val; -} app_event_t; - /******************************************************************************* * GLOBAL * *******************************************************************************/ @@ -95,7 +78,6 @@ static uint32_t m_change_to_cur_state_tp = 0; // *******************************************************************************/ // 业务事件处理函数 -static void app_event_process_cb(void* p_event_data, uint16_t event_size); /******************************************************************************* * 事件生成器 * @@ -106,7 +88,9 @@ static uint32_t m_plod_state_disconnect_timepoint = 0; static uint32_t m_plod_state_connect_timepoint = 0; static bool m_plod_state_connected_state = false; static uint32_t plod_state_has_disconnected_ms() { return znordic_haspassed_ms(m_plod_state_disconnect_timepoint); } -static bool plod_state_is_connected() {} +static bool plod_state_is_connected() { + return m_plod_state_connected_state; +} static void m_plod_state_event_detect_tmr_cb(void* p_context) { // static uint32_t connecte_state_trigger_cnt = 0; static uint32_t connecte_state_trigger_cnt_last_val = 0; @@ -186,15 +170,17 @@ static void power_on() { SingleLeadECG_led_init(); SingleLeadECG_ecg_init(); SingleLeadECG_battery_init(); - + hwss_init(); sample_data_mgr_init(); dsp_mgr_init(); + m_poweronflag = true; - ZERROR_CHECK(app_timer_start(m_state_machine_driver_tmr, APP_TIMER_TICKS(5), NULL)); // 200HZ采样 + ZERROR_CHECK(app_timer_start(m_state_machine_driver_tmr, APP_TIMER_TICKS(100), NULL)); // 200HZ采样 } static void power_off() { dsp_mgr_uninit(); sample_data_mgr_uninit(); + hwss_uninit(); SingleLeadECG_battery_deinit(); SingleLeadECG_ecg_deinit(); @@ -248,8 +234,7 @@ static void state_machine__change_to_home_state() { state_machine_change_to_state(kdevice_state_home); dsp_mgr_change_to_main(); } - -static void app_event_process_cb(void* p_event_data, uint16_t event_size) { +void app_event_process_cb(void* p_event_data, uint16_t event_size) { if (!p_event_data) return; app_event_t* p_event = (app_event_t*)p_event_data; @@ -307,8 +292,15 @@ static void app_event_process_cb(void* p_event_data, uint16_t event_size) { * 页面加载中 * *******************************************************************************/ if (cur_state_haspassed_ms() >= (500 * 5)) { + /** + * @brief + * 1. 启动采样定时器 + * 2. 切换状态 + * 3. 切换页面 + */ state_machine_change_to_state(kdevice_state_sampling); dsp_mgr_change_to_sampling(); + hwss_start_capture(); } else if (cur_state_haspassed_ms() >= (500 * 4)) { if (dsp_mgr_preparePage_get_progress() != 4) { dsp_mgr_preparePage_set_progress(4); @@ -394,6 +386,7 @@ void one_conduction_main() { .on_service_init = on_service_init, }; zble_module_init(&cfg); + hwss_init(); #if 1 SingleLeadECG_ecg_io_init(); @@ -405,6 +398,7 @@ void one_conduction_main() { ZERROR_CHECK(app_timer_start(m_plod_state_event_detect_tmr, APP_TIMER_TICKS(100), NULL)); ZERROR_CHECK(app_timer_start(m_charge_event_detect_tmr, APP_TIMER_TICKS(100), NULL)); #endif + // ZERROR_CHECK(); while (true) { app_sched_execute();