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.
101 lines
2.7 KiB
101 lines
2.7 KiB
#include "zble_module.h"
|
|
#include "zdatachannel_service.h"
|
|
#include "znordic.h"
|
|
//
|
|
|
|
#include <stdarg.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
//
|
|
#include <math.h>
|
|
|
|
#include "app_scheduler.h"
|
|
#include "znordic.h"
|
|
|
|
#if defined(UART_PRESENT)
|
|
#include "nrf_uart.h"
|
|
#endif
|
|
#if defined(UARTE_PRESENT)
|
|
#include "nrf_uarte.h"
|
|
#endif
|
|
|
|
#if 1
|
|
int main() {
|
|
one_conduction_main();
|
|
return 0;
|
|
}
|
|
#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-测试 *
|
|
*******************************************************************************/
|
|
#if 0
|
|
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();
|
|
}
|
|
#endif
|