|
@ -8,12 +8,10 @@ |
|
|
#include <stdlib.h> |
|
|
#include <stdlib.h> |
|
|
#include <string.h> |
|
|
#include <string.h> |
|
|
// |
|
|
// |
|
|
#include "app_uart.h" |
|
|
|
|
|
#include "basic/ssd1306/driver_ssd1306_basic.h" |
|
|
|
|
|
#include "basic\zdatachannel_service.h" |
|
|
|
|
|
#include "one_conduction/one_conduction_board.h" |
|
|
|
|
|
#include "one_conduction/one_conduction_main.h" |
|
|
|
|
|
#include "three_lead\three_lead_board.h" |
|
|
|
|
|
|
|
|
#include <math.h> |
|
|
|
|
|
|
|
|
|
|
|
#include "app_scheduler.h" |
|
|
|
|
|
#include "znordic.h" |
|
|
|
|
|
|
|
|
#if defined(UART_PRESENT) |
|
|
#if defined(UART_PRESENT) |
|
|
#include "nrf_uart.h" |
|
|
#include "nrf_uart.h" |
|
@ -22,10 +20,81 @@ |
|
|
#include "nrf_uarte.h" |
|
|
#include "nrf_uarte.h" |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if 0 |
|
|
int main() { |
|
|
int main() { |
|
|
one_conduction_main(); |
|
|
one_conduction_main(); |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
#if 0 |
|
|
|
|
|
extern uint32_t g_nrf_log_tx_pin; |
|
|
|
|
|
APP_TIMER_DEF(m_report_timer); // |
|
|
|
|
|
static void tmr_cb(void* p_context) { // |
|
|
|
|
|
ZLOGI("%d", SingleLeadECG_ecg_plod_get_ecg_val()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void main() { |
|
|
|
|
|
APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20); |
|
|
|
|
|
g_nrf_log_tx_pin = 41; |
|
|
|
|
|
|
|
|
|
|
|
znordic_init(); |
|
|
|
|
|
NRF_LOG_INFO("compile time :%s", __TIME__); |
|
|
|
|
|
|
|
|
|
|
|
SingleLeadECG_adc_module_init(); |
|
|
|
|
|
|
|
|
|
|
|
ZERROR_CHECK(app_timer_create(&m_report_timer, APP_TIMER_MODE_REPEATED, tmr_cb)); |
|
|
|
|
|
ZERROR_CHECK(app_timer_start(m_report_timer, APP_TIMER_TICKS(5), NULL)); |
|
|
|
|
|
|
|
|
|
|
|
znordic_loop(); |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
|
|
|
/******************************************************************************* |
|
|
|
|
|
* 3导联-ADS1293-测试 * |
|
|
|
|
|
*******************************************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
extern uint32_t g_nrf_log_tx_pin; |
|
|
|
|
|
APP_TIMER_DEF(m_test_tx_timer); |
|
|
|
|
|
ZDATACHANNEL_DEF(m_zhrs, 2 /*回调事件优先??*/, 1 /*client num*/); |
|
|
|
|
|
static void zdatachannel_data_handler(zdatachannel_evt_t* p_evt) {} |
|
|
|
|
|
static void zdatachanel_send_log(const char* fmt, ...) { |
|
|
|
|
|
static char tx[256] = {0}; |
|
|
|
|
|
static uint16_t len = 0; |
|
|
|
|
|
va_list args; |
|
|
|
|
|
va_start(args, fmt); |
|
|
|
|
|
|
|
|
|
|
|
len = vsprintf(tx, fmt, args); |
|
|
|
|
|
zdatachannel_data_send((uint8_t*)tx, &len); |
|
|
|
|
|
va_end(args); |
|
|
|
|
|
} |
|
|
|
|
|
static void test_tx_timer_cb(void* p_context) { |
|
|
|
|
|
zdatachanel_send_log("%d\n", SingleLeadECG_ecg_plod_get_ecg_val()); |
|
|
|
|
|
} |
|
|
|
|
|
static void on_service_init(void) { |
|
|
|
|
|
/** |
|
|
|
|
|
* @brief 数据通道初始 |
|
|
|
|
|
*/ |
|
|
|
|
|
ZLOGI("init zdatachannel service"); |
|
|
|
|
|
zdatachannel_init_t zdatachannle_init; |
|
|
|
|
|
memset(&zdatachannle_init, 0, sizeof(zdatachannle_init)); |
|
|
|
|
|
zdatachannle_init.data_handler = zdatachannel_data_handler; |
|
|
|
|
|
ZERROR_CHECK(zdatachannel_init(&m_zhrs, &zdatachannle_init)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void main() { |
|
|
|
|
|
APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20); |
|
|
|
|
|
znordic_init(0, 20); |
|
|
|
|
|
NRF_LOG_INFO("compile time :%s", __TIME__); |
|
|
|
|
|
static zble_module_cfg_t cfg = // |
|
|
|
|
|
{ |
|
|
|
|
|
.deviceName = "ecg_test", |
|
|
|
|
|
.on_service_init = on_service_init, |
|
|
|
|
|
}; |
|
|
|
|
|
zble_module_init(&cfg); |
|
|
|
|
|
SingleLeadECG_adc_module_init(); |
|
|
|
|
|
|
|
|
|
|
|
ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb)); |
|
|
|
|
|
ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(5), NULL)); |
|
|
|
|
|
|
|
|
|
|
|
zble_module_start_adv(); |
|
|
|
|
|
znordic_loop(); |
|
|
|
|
|
} |