From 1e4f670d8fb589c85a974953e53e48cb4883aacf Mon Sep 17 00:00:00 2001 From: zhaohe Date: Tue, 30 Jan 2024 22:48:22 +0800 Subject: [PATCH] update --- .vscode/settings.json | 3 +- app/app.uvoptx | 6 ++-- app/config/sdk_config.h | 2 +- app/main.c | 85 ++++++++++++++++++++++++++++++++++++++++++++----- 4 files changed, 83 insertions(+), 13 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 4ceff36..40a35db 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -90,7 +90,8 @@ "nrf_uarte.h": "c", "heart_rate_sensor_protocol.h": "c", "ble_cmd_process_service.h": "c", - "heart_wave_sample_service.h": "c" + "heart_wave_sample_service.h": "c", + "device_info_mgr.h": "c" }, "files.encoding": "gbk" } \ No newline at end of file diff --git a/app/app.uvoptx b/app/app.uvoptx index 2b07cb9..9b36964 100644 --- a/app/app.uvoptx +++ b/app/app.uvoptx @@ -75,7 +75,7 @@ 1 0 - 1 + 0 5 @@ -255,7 +255,7 @@ 0 0 - 0 + 1 5 @@ -300,7 +300,7 @@ 0 JL2CM3 - -U685384569 -O78 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC4000 -FN2 -FF0nrf52xxx.flm -FS00 -FL0200000 -FP0($$Device:nRF52833_xxAA$Flash\nrf52xxx.flm) -FF1nrf52xxx_uicr.flm -FS110001000 -FL11000 -FP1($$Device:nRF52833_xxAA$Flash\nrf52xxx_uicr.flm) + -U150710864 -O78 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC4000 -FN2 -FF0nrf52xxx.flm -FS00 -FL0200000 -FP0($$Device:nRF52833_xxAA$Flash\nrf52xxx.flm) -FF1nrf52xxx_uicr.flm -FS110001000 -FL11000 -FP1($$Device:nRF52833_xxAA$Flash\nrf52xxx_uicr.flm) 0 diff --git a/app/config/sdk_config.h b/app/config/sdk_config.h index 01a6f84..1afb65e 100644 --- a/app/config/sdk_config.h +++ b/app/config/sdk_config.h @@ -7794,7 +7794,7 @@ // <268435456=> 1000000 baud #ifndef NRF_LOG_BACKEND_UART_BAUDRATE -#define NRF_LOG_BACKEND_UART_BAUDRATE 251658240 +#define NRF_LOG_BACKEND_UART_BAUDRATE 30801920 #endif // NRF_LOG_BACKEND_UART_TEMP_BUFFER_SIZE - Size of buffer for partially processed strings. diff --git a/app/main.c b/app/main.c index 9dec738..d461909 100644 --- a/app/main.c +++ b/app/main.c @@ -8,12 +8,10 @@ #include #include // -#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 + +#include "app_scheduler.h" +#include "znordic.h" #if defined(UART_PRESENT) #include "nrf_uart.h" @@ -22,10 +20,81 @@ #include "nrf_uarte.h" #endif -#if 1 - +#if 0 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-测试 * + *******************************************************************************/ + +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(); +}