diff --git a/.vscode/settings.json b/.vscode/settings.json
index a0adfb0..a1e24f1 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -48,6 +48,10 @@
"nrf_drv_pwm.h": "c",
"nrfx_config.h": "c",
"nrf_drv_wdt.h": "c",
- "app_sdcard.h": "c"
+ "app_sdcard.h": "c",
+ "diskio_blkdev.h": "c",
+ "three_conduction_main.h": "c",
+ "one_conduction_main.h": "c",
+ "one_conduction_board.h": "c"
}
}
\ No newline at end of file
diff --git a/app/app.uvoptx b/app/app.uvoptx
index 43be657..72e05c0 100644
--- a/app/app.uvoptx
+++ b/app/app.uvoptx
@@ -177,7 +177,7 @@
0
0
1
- .\src\board.c
+ D:\workspace\nordic_wp\conduction1_dynamic_electrocardiograph\app\src\board.c
\\nrf52833_xxaa\src/board.c\275
@@ -193,7 +193,7 @@
0
0
1
- .\src\board.c
+ D:\workspace\nordic_wp\conduction1_dynamic_electrocardiograph\app\src\board.c
\\nrf52833_xxaa\src/board.c\279
@@ -447,7 +447,7 @@
0
0
0
- .\src\zble_module.c
+ .\src\basic\zble_module.c
zble_module.c
0
0
@@ -459,8 +459,8 @@
0
0
0
- .\src\board.c
- board.c
+ .\src\basic\zdatachannel_service.c
+ zdatachannel_service.c
0
0
@@ -471,8 +471,20 @@
0
0
0
- .\src\zdatachannel_service.c
- zdatachannel_service.c
+ .\src\one_conduction\one_conduction_board.c
+ one_conduction_board.c
+ 0
+ 0
+
+
+ 1
+ 6
+ 1
+ 0
+ 0
+ 0
+ .\src\one_conduction\one_conduction_main.c
+ one_conduction_main.c
0
0
@@ -486,7 +498,7 @@
0
2
- 6
+ 7
1
0
0
@@ -506,7 +518,7 @@
0
3
- 7
+ 8
1
0
0
@@ -518,7 +530,7 @@
3
- 8
+ 9
1
0
0
@@ -538,7 +550,7 @@
0
4
- 9
+ 10
1
0
0
@@ -558,7 +570,7 @@
0
5
- 10
+ 11
1
0
0
@@ -570,7 +582,7 @@
5
- 11
+ 12
1
0
0
@@ -582,7 +594,7 @@
5
- 12
+ 13
1
0
0
@@ -594,7 +606,7 @@
5
- 13
+ 14
1
0
0
@@ -606,7 +618,7 @@
5
- 14
+ 15
1
0
0
@@ -618,7 +630,7 @@
5
- 15
+ 16
1
0
0
@@ -630,7 +642,7 @@
5
- 16
+ 17
1
0
0
@@ -642,7 +654,7 @@
5
- 17
+ 18
1
0
0
@@ -662,7 +674,7 @@
0
6
- 18
+ 19
1
0
0
@@ -682,7 +694,7 @@
0
7
- 19
+ 20
1
0
0
@@ -694,7 +706,7 @@
7
- 20
+ 21
1
0
0
@@ -706,7 +718,7 @@
7
- 21
+ 22
1
0
0
@@ -718,7 +730,7 @@
7
- 22
+ 23
1
0
0
@@ -730,7 +742,7 @@
7
- 23
+ 24
1
0
0
@@ -742,7 +754,7 @@
7
- 24
+ 25
1
0
0
@@ -754,7 +766,7 @@
7
- 25
+ 26
1
0
0
@@ -766,7 +778,7 @@
7
- 26
+ 27
1
0
0
@@ -778,7 +790,7 @@
7
- 27
+ 28
1
0
0
@@ -790,7 +802,7 @@
7
- 28
+ 29
1
0
0
@@ -802,7 +814,7 @@
7
- 29
+ 30
1
0
0
@@ -814,7 +826,7 @@
7
- 30
+ 31
1
0
0
@@ -826,7 +838,7 @@
7
- 31
+ 32
1
0
0
@@ -838,7 +850,7 @@
7
- 32
+ 33
1
0
0
@@ -850,7 +862,7 @@
7
- 33
+ 34
1
0
0
@@ -862,7 +874,7 @@
7
- 34
+ 35
1
0
0
@@ -874,7 +886,7 @@
7
- 35
+ 36
1
0
0
@@ -886,7 +898,7 @@
7
- 36
+ 37
1
0
0
@@ -906,7 +918,7 @@
0
8
- 37
+ 38
1
0
0
@@ -918,7 +930,7 @@
8
- 38
+ 39
1
0
0
@@ -930,7 +942,7 @@
8
- 39
+ 40
1
0
0
@@ -942,7 +954,7 @@
8
- 40
+ 41
1
0
0
@@ -954,7 +966,7 @@
8
- 41
+ 42
1
0
0
@@ -966,7 +978,7 @@
8
- 42
+ 43
1
0
0
@@ -978,7 +990,7 @@
8
- 43
+ 44
1
0
0
@@ -990,7 +1002,7 @@
8
- 44
+ 45
1
0
0
@@ -1002,7 +1014,7 @@
8
- 45
+ 46
1
0
0
@@ -1014,7 +1026,7 @@
8
- 46
+ 47
1
0
0
@@ -1026,7 +1038,7 @@
8
- 47
+ 48
1
0
0
@@ -1038,7 +1050,7 @@
8
- 48
+ 49
1
0
0
@@ -1050,7 +1062,7 @@
8
- 49
+ 50
1
0
0
@@ -1062,7 +1074,7 @@
8
- 50
+ 51
1
0
0
@@ -1074,7 +1086,7 @@
8
- 51
+ 52
1
0
0
@@ -1086,7 +1098,7 @@
8
- 52
+ 53
1
0
0
@@ -1098,7 +1110,7 @@
8
- 53
+ 54
1
0
0
@@ -1110,7 +1122,7 @@
8
- 54
+ 55
1
0
0
@@ -1122,7 +1134,7 @@
8
- 55
+ 56
1
0
0
@@ -1134,7 +1146,7 @@
8
- 56
+ 57
1
0
0
@@ -1146,7 +1158,7 @@
8
- 57
+ 58
1
0
0
@@ -1158,7 +1170,7 @@
8
- 58
+ 59
1
0
0
@@ -1170,7 +1182,7 @@
8
- 59
+ 60
1
0
0
@@ -1182,7 +1194,7 @@
8
- 60
+ 61
1
0
0
@@ -1194,7 +1206,7 @@
8
- 61
+ 62
1
0
0
@@ -1206,7 +1218,7 @@
8
- 62
+ 63
1
0
0
@@ -1218,7 +1230,7 @@
8
- 63
+ 64
1
0
0
@@ -1238,7 +1250,7 @@
0
9
- 64
+ 65
1
0
0
@@ -1250,7 +1262,7 @@
9
- 65
+ 66
1
0
0
@@ -1262,7 +1274,7 @@
9
- 66
+ 67
1
0
0
@@ -1274,7 +1286,7 @@
9
- 67
+ 68
1
0
0
@@ -1286,7 +1298,7 @@
9
- 68
+ 69
1
0
0
@@ -1298,7 +1310,7 @@
9
- 69
+ 70
1
0
0
@@ -1318,7 +1330,7 @@
0
10
- 70
+ 71
1
0
0
@@ -1330,7 +1342,7 @@
10
- 71
+ 72
1
0
0
@@ -1342,7 +1354,7 @@
10
- 72
+ 73
1
0
0
@@ -1362,7 +1374,7 @@
0
11
- 73
+ 74
1
0
0
@@ -1374,7 +1386,7 @@
11
- 74
+ 75
1
0
0
@@ -1386,7 +1398,7 @@
11
- 75
+ 76
1
0
0
@@ -1406,7 +1418,7 @@
0
12
- 76
+ 77
1
0
0
@@ -1426,7 +1438,7 @@
0
13
- 77
+ 78
1
0
0
@@ -1438,7 +1450,7 @@
13
- 78
+ 79
1
0
0
diff --git a/app/app.uvprojx b/app/app.uvprojx
index 445f198..98703d6 100644
--- a/app/app.uvprojx
+++ b/app/app.uvprojx
@@ -396,17 +396,22 @@
zble_module.c
1
- .\src\zble_module.c
+ .\src\basic\zble_module.c
- board.c
+ zdatachannel_service.c
1
- .\src\board.c
+ .\src\basic\zdatachannel_service.c
- zdatachannel_service.c
+ one_conduction_board.c
+ 1
+ .\src\one_conduction\one_conduction_board.c
+
+
+ one_conduction_main.c
1
- .\src\zdatachannel_service.c
+ .\src\one_conduction\one_conduction_main.c
@@ -4140,17 +4145,22 @@
zble_module.c
1
- .\src\zble_module.c
+ .\src\basic\zble_module.c
- board.c
+ zdatachannel_service.c
1
- .\src\board.c
+ .\src\basic\zdatachannel_service.c
- zdatachannel_service.c
+ one_conduction_board.c
+ 1
+ .\src\one_conduction\one_conduction_board.c
+
+
+ one_conduction_main.c
1
- .\src\zdatachannel_service.c
+ .\src\one_conduction\one_conduction_main.c
diff --git a/app/main.c b/app/main.c
index 1c2a5d5..3a9bb5c 100644
--- a/app/main.c
+++ b/app/main.c
@@ -1,29 +1,9 @@
-#if 1
-#include "board.h"
-#include "diskio_blkdev.h"
-#include "ff.h"
-#include "nrf_block_dev_sdc.h"
-#include "nrf_delay.h"
-#include "project_cfg.h"
-#include "sys.h"
-#include "version.h"
-#include "zble_module.h"
-#include "zdatachannel_service.h"
-#include "diskio_blkdev.h"
+#include "one_conduction/one_conduction_main.h"
+#include "three_conduction/three_conduction_main.h"
-#if 0
-void qingfengboard_test(void) {
- // 测试LED
- debug_light_init(15);
-
- // 测试BUTTON
- // static uint8_t io_index[] = {ZPIN(0, 5), ZPIN(1, 9)};
- // zbsp_gpio_state_monitor(1000, (uint8_t*)io_index, ZARRAY_SIZE(io_index));
+int main(void) { one_conduction_main(); }
- // 测试睡眠唤醒
- zbsp_enter_sleep(3000, 5, true);
-}
-#endif
+#if 0
ZDATACHANNEL_DEF(m_zhrs, 2 /*回调事件优先级*/, 1 /*client num*/);
APP_TIMER_DEF(m_test_tx_timer);
diff --git a/app/src/board.c b/app/src/basic/board.c
similarity index 100%
rename from app/src/board.c
rename to app/src/basic/board.c
diff --git a/app/src/board.h b/app/src/basic/board.h
similarity index 100%
rename from app/src/board.h
rename to app/src/basic/board.h
diff --git a/app/src/project_cfg.h b/app/src/basic/project_cfg.h
similarity index 100%
rename from app/src/project_cfg.h
rename to app/src/basic/project_cfg.h
diff --git a/app/src/version.h b/app/src/basic/version.h
similarity index 100%
rename from app/src/version.h
rename to app/src/basic/version.h
diff --git a/app/src/zble_module.c b/app/src/basic/zble_module.c
similarity index 100%
rename from app/src/zble_module.c
rename to app/src/basic/zble_module.c
diff --git a/app/src/zble_module.h b/app/src/basic/zble_module.h
similarity index 100%
rename from app/src/zble_module.h
rename to app/src/basic/zble_module.h
diff --git a/app/src/zdatachannel_service.c b/app/src/basic/zdatachannel_service.c
similarity index 99%
rename from app/src/zdatachannel_service.c
rename to app/src/basic/zdatachannel_service.c
index 7a9e2af..876d8cf 100644
--- a/app/src/zdatachannel_service.c
+++ b/app/src/basic/zdatachannel_service.c
@@ -4,6 +4,7 @@
#include "ble_srv_common.h"
#include "nrf_log.h"
#include "sdk_common.h"
+#include "sys.h"
#define ZDATACHANNEL_UUID_NUS_SERVICE 0x0001 /**< The UUID of the Nordic UART Service. */
#define ZDATACHANNEL_TX_CHARACTERISTIC 0x0003 /**< The UUID of the TX Characteristic. */
@@ -59,7 +60,7 @@ static void on_write(zdatachannel_t *p_nus, ble_evt_t const *p_ble_evt) {
} else {
p_nus->datablock_tx_channel_is_notification_enabled = false;
}
- } else if ((p_evt_write->handle == p_nus->cmd_tx_handles.value_handle) && (p_nus->data_handler != NULL)) {
+ } else if ((p_evt_write->handle == p_nus->cmd_rx_handles.value_handle) && (p_nus->data_handler != NULL)) {
evt.type = ZDATACHANNEL_EVT_RX_DATA;
evt.params.rx_data.p_data = p_evt_write->data;
evt.params.rx_data.length = p_evt_write->len;
diff --git a/app/src/zdatachannel_service.h b/app/src/basic/zdatachannel_service.h
similarity index 100%
rename from app/src/zdatachannel_service.h
rename to app/src/basic/zdatachannel_service.h
diff --git a/app/src/one_conduction/one_conduction_board.c b/app/src/one_conduction/one_conduction_board.c
new file mode 100644
index 0000000..e69de29
diff --git a/app/src/one_conduction/one_conduction_board.h b/app/src/one_conduction/one_conduction_board.h
new file mode 100644
index 0000000..95300f1
--- /dev/null
+++ b/app/src/one_conduction/one_conduction_board.h
@@ -0,0 +1,4 @@
+#pragma once
+#define VERSION 1
+#define MANUFACTURER_NAME "iflytop"
+#define BLE_NAME "iflytop_test"
\ No newline at end of file
diff --git a/app/src/one_conduction/one_conduction_main.c b/app/src/one_conduction/one_conduction_main.c
new file mode 100644
index 0000000..d4955c4
--- /dev/null
+++ b/app/src/one_conduction/one_conduction_main.c
@@ -0,0 +1,73 @@
+#include "basic/zble_module.h"
+#include "basic/zdatachannel_service.h"
+#include "one_conduction_board.h"
+#include "sys.h"
+
+ZDATACHANNEL_DEF(m_zhrs, 2 /*回调事件优先级*/, 1 /*client num*/);
+
+/*******************************************************************************
+ * TOOLS *
+ *******************************************************************************/
+static const char* hex2str(const uint8_t* data, int32_t len) {
+ static char rx[64] = {0};
+ memset(rx, 0, sizeof(rx));
+ for (int32_t i = 0; i < len; i++) {
+ sprintf(rx + i * 2, "%02X", data[i]);
+ }
+ return rx;
+}
+
+/*******************************************************************************
+ * CB *
+ *******************************************************************************/
+
+// static void ble_evt_handler(ble_evt_t const* p_ble_evt, void* p_context) {
+// switch (p_ble_evt->header.evt_id) {
+// case BLE_GAP_EVT_CONNECTED:
+// ZLOGI("Connected");
+// break;
+
+// case BLE_GAP_EVT_DISCONNECTED:
+// ZLOGI("Disconnected");
+// break;
+// }
+// }
+
+void zdatachannel_data_handler(zdatachannel_evt_t* p_evt) {
+ /**
+ * @brief 接收到指令数据
+ */
+ if (p_evt->type == ZDATACHANNEL_EVT_RX_DATA) {
+ ZLOGI("rx:%s", hex2str(p_evt->params.rx_data.p_data, p_evt->params.rx_data.length));
+ }
+}
+/*******************************************************************************
+ * INIT *
+ *******************************************************************************/
+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 one_conduction_main() {
+ zsys_init();
+ NRF_LOG_INFO("compile time :%s", __TIME__);
+ NRF_LOG_INFO("Version :%d", VERSION);
+ NRF_LOG_INFO("Manufacturer :%s", MANUFACTURER_NAME);
+
+ static zble_module_cfg_t cfg = //
+ {
+ .deviceName = BLE_NAME,
+ .on_service_init = on_service_init,
+ };
+ zble_module_init(&cfg);
+
+ zble_module_start_adv();
+ zsys_loop();
+}
diff --git a/app/src/one_conduction/one_conduction_main.h b/app/src/one_conduction/one_conduction_main.h
new file mode 100644
index 0000000..92c6329
--- /dev/null
+++ b/app/src/one_conduction/one_conduction_main.h
@@ -0,0 +1,3 @@
+#pragma once
+
+void one_conduction_main();
\ No newline at end of file
diff --git a/app/src/three_conduction/three_conduction_board.c b/app/src/three_conduction/three_conduction_board.c
new file mode 100644
index 0000000..e69de29
diff --git a/app/src/three_conduction/three_conduction_board.h b/app/src/three_conduction/three_conduction_board.h
new file mode 100644
index 0000000..e69de29
diff --git a/app/src/three_conduction/three_conduction_main.c b/app/src/three_conduction/three_conduction_main.c
new file mode 100644
index 0000000..e69de29
diff --git a/app/src/three_conduction/three_conduction_main.h b/app/src/three_conduction/three_conduction_main.h
new file mode 100644
index 0000000..e69de29
diff --git a/libznordic b/libznordic
index dea8cb2..e20cb4c 160000
--- a/libznordic
+++ b/libznordic
@@ -1 +1 @@
-Subproject commit dea8cb28511e92e1566da73974a24f74ec9bcab6
+Subproject commit e20cb4c21a5a95b8b60d76d29156faba65246b67