7 changed files with 37 additions and 148 deletions
-
32app/app.uvoptx
-
2app/app.uvprojx
-
105app/main.c
-
16app/src/one_conduction/one_conduction_main.c
-
26app/src/three_lead/three_lead_board.c
-
2libznordic
-
2sdk
2
app/app.uvprojx
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,103 +1,22 @@ |
|||||
#include "one_conduction/one_conduction_main.h" |
|
||||
|
#include "basic/zble_module.h" |
||||
|
#include "basic/zdatachannel_service.h" |
||||
|
#include "znordic.h" |
||||
|
// |
||||
#include "three_lead\three_lead_board.h" |
#include "three_lead\three_lead_board.h" |
||||
|
|
||||
int main(void) { one_conduction_main(); } |
|
||||
|
|
||||
#if 0 |
|
||||
|
|
||||
ZDATACHANNEL_DEF(m_zhrs, 2 /*回调事件优先级*/, 1 /*client num*/); |
|
||||
APP_TIMER_DEF(m_test_tx_timer); |
|
||||
|
|
||||
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; |
|
||||
} |
|
||||
|
|
||||
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)); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
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"); |
|
||||
// zble_module_start_adv(); |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
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)); |
|
||||
} |
|
||||
|
|
||||
static void test_tx_timer_cb(void* p_context) { |
static void test_tx_timer_cb(void* p_context) { |
||||
// static uint32_t data; |
|
||||
// uint16_t txlen = 4; |
|
||||
// data++; |
|
||||
// zdatachannel_data_send((uint8_t*)&data, &txlen); |
|
||||
|
|
||||
// ZLOGI("adc channel %d %d", adc_module_heart_elect_channel_read_val(), adc_module_battery_channel_read_val()); |
|
||||
ZLOGI("test_tx_timer_cb"); |
ZLOGI("test_tx_timer_cb"); |
||||
NVIC_SystemReset(); |
|
||||
// board_spi_transfer_test(); |
|
||||
// uint8_t data[] = {0xAA, 0xBB}; |
|
||||
// board_i2c_write(0x3C, data, 2); |
|
||||
// fatfs_test_write(); |
|
||||
|
ThreeLeadECG_sdcard_mount(); |
||||
} |
} |
||||
|
|
||||
static void board_init() { |
|
||||
// adc_module_init(); |
|
||||
// adc_module_battery_channel_init(NRF_SAADC_INPUT_VDD); |
|
||||
// adc_module_heart_elect_channel_init(NRF_SAADC_INPUT_AIN2); |
|
||||
|
|
||||
// board_spi_init(); |
|
||||
// board_i2c_init(); |
|
||||
} |
|
||||
|
extern uint32_t g_nrf_log_tx_pin; |
||||
|
APP_TIMER_DEF(m_test_tx_timer); |
||||
|
|
||||
int main(void) { |
|
||||
|
void main() { |
||||
|
g_nrf_log_tx_pin = 2; |
||||
znordic_init(); |
znordic_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 = "iflytop_test_ble", |
|
||||
.on_service_init = on_service_init, |
|
||||
}; |
|
||||
zble_module_init(&cfg); |
|
||||
board_init(); |
|
||||
// fatfs_init(); |
|
||||
|
|
||||
NRF_SDH_BLE_OBSERVER(m_ble_observer, 3, ble_evt_handler, NULL); |
|
||||
|
|
||||
// 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(100), NULL)); |
|
||||
|
|
||||
// pwm_trigger(); |
|
||||
// wd_init(); |
|
||||
|
|
||||
zble_module_start_adv(); |
|
||||
|
NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100)); |
||||
|
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(100), NULL)); |
||||
znordic_loop(); |
znordic_loop(); |
||||
} |
} |
||||
#endif |
|
@ -1 +1 @@ |
|||||
Subproject commit efdb1b55c3432d3b539fb9fcecb14209874dae0d |
|
||||
|
Subproject commit fbcd219fb95c6c1af8a9c2ee62854dd989d941e8 |
@ -1 +1 @@ |
|||||
Subproject commit 9ff458fcdef52d2ff06829ec783406af521844da |
|
||||
|
Subproject commit 65387c8fdeef99d05d9a2fce75a99df87dda4fb8 |
Write
Preview
Loading…
Cancel
Save
Reference in new issue