From e83ea1c4b36d05a838dde8ea81c4e2df0e0c87af Mon Sep 17 00:00:00 2001 From: zhaohe Date: Thu, 25 Jan 2024 10:07:27 +0800 Subject: [PATCH] update --- app/main.c | 32 ++++++++++++++++++++++++++++++++ app/src/three_lead/three_lead_board.c | 20 +++++++++++++------- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/app/main.c b/app/main.c index 9d05891..dca68c9 100644 --- a/app/main.c +++ b/app/main.c @@ -423,9 +423,41 @@ void main() { ThreeLeadECG_sdcard_base_init(); ThreeLeadECG_sdcard_mount(); + ThreeLeadECG_sdcard_umount(); + ThreeLeadECG_sdcard_mount(); + ThreeLeadECG_sdcard_umount(); + 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(); } +#endif + +#if 0 +/******************************************************************************* + * 3导联-flash测试 * + *******************************************************************************/ +static void test_tx_timer_cb(void* p_context) { + static uint32_t data; + data++; + ZLOGI("button %d", ThreeLeadECG_button_get_state()); +} + +extern uint32_t g_nrf_log_tx_pin; +APP_TIMER_DEF(m_test_tx_timer); + +void main() { + APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20); + znordic_init(); + + NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100)); + NRF_LOG_INTERNAL_FLUSH(); + + ThreeLeadECG_button_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(300), NULL)); + znordic_loop(); +} #endif \ No newline at end of file diff --git a/app/src/three_lead/three_lead_board.c b/app/src/three_lead/three_lead_board.c index 69e2de8..734efd6 100644 --- a/app/src/three_lead/three_lead_board.c +++ b/app/src/three_lead/three_lead_board.c @@ -200,10 +200,10 @@ void ThreeLeadECG_sdcard_init() { * 4. 打开flash电源 * */ - ThreeLeadECG_sdcard_base_init(); // 必要引脚初始化 - ThreeLeadECG_sdcard_spi_umount(); // - ThreeLeadECG_sdcard_connect2_ext_usb_sdcard_driver_ic(true); - ThreeLeadECG_sdcard_flash_power_ctrl(true); + ThreeLeadECG_sdcard_base_init(); // 必要引脚初始化 + // ThreeLeadECG_sdcard_spi_umount(); // + // ThreeLeadECG_sdcard_connect2_ext_usb_sdcard_driver_ic(true); + // ThreeLeadECG_sdcard_flash_power_ctrl(true); } NRF_BLOCK_DEV_SDC_DEFINE(m_block_dev_sdc, // @@ -374,9 +374,15 @@ void ThreeLeadECG_sdcard_umount() { f_mount(NULL, "", 1); disk_uninitialize(0); ThreeLeadECG_sdcard_spi_umount(); - ThreeLeadECG_sdcard_flash_power_ctrl(false); - ThreeLeadECG_sdcard_connect2_ext_usb_sdcard_driver_ic(true); - ThreeLeadECG_sdcard_flash_power_ctrl(true); + + nrf_gpio_pin_write(SDCARD_POWER_CTRL_PIN, 1); // 关 + nrf_gpio_pin_write(SDCARD_USBDRIVER_IC_JUNCTION_CTRL_NOE_PIN, 0); + nrf_delay_ms(100); + nrf_gpio_pin_write(SDCARD_POWER_CTRL_PIN, 0); // 开 + + nrf_gpio_pin_write(SDCARD_USBDRIVER_IC_RESET_PIN, 0); + nrf_delay_ms(10); + nrf_gpio_pin_write(SDCARD_USBDRIVER_IC_RESET_PIN, 1); } /*******************************************************************************