From 15e74619f0febaee195dd06eeb9fd26b92fb2b45 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sun, 4 Feb 2024 21:14:56 +0800 Subject: [PATCH] update --- app/src/app_event.h | 2 +- app/src/board/board.h | 5 +++-- app/src/heart_wave_sample_service.c | 10 +++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/src/app_event.h b/app/src/app_event.h index 2bf343e..3db6639 100644 --- a/app/src/app_event.h +++ b/app/src/app_event.h @@ -1,8 +1,8 @@ #pragma once #include #include +#include "board/board.h" -#define LITTLE_DATA_BLOCK_FRAME_NUM 4 // 每四帧回调一次 typedef enum { kevent_sensor_drop = 0, // 导联连接事件 diff --git a/app/src/board/board.h b/app/src/board/board.h index e1f7875..005cf65 100644 --- a/app/src/board/board.h +++ b/app/src/board/board.h @@ -60,8 +60,9 @@ #define FILE_MAX_COUNT 1 #define SDCARD_MAX_FILE_SIZE (uint32_t)(3.5 * 1024 * 1024 * 1024) // -#define SAMPLE_RATE 500 -#define SAMPLE_PRECISION 24 +#define SAMPLE_RATE 400 +#define LITTLE_DATA_BLOCK_FRAME_NUM 4 // 每两帧回调一次,对应100HZ +#define SAMPLE_PRECISION 24 #define APP_MAX_EVEN_SIZE MAX(APP_TIMER_SCHED_EVENT_DATA_SIZE, sizeof(app_event_t)) #define APP_EVENT_QUEUE_SIZE 100 diff --git a/app/src/heart_wave_sample_service.c b/app/src/heart_wave_sample_service.c index a792c0c..a3784d8 100644 --- a/app/src/heart_wave_sample_service.c +++ b/app/src/heart_wave_sample_service.c @@ -75,7 +75,7 @@ volatile static bool m_drop_state_triggered = false; *******************************************************************************/ // READY_PIN 中断回调函数 -//static void ads1293_ready_pin_irq(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action); +// static void ads1293_ready_pin_irq(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action); // 缓冲区切换BUFFER static void prvf_buffer_switch(void); @@ -326,7 +326,7 @@ void ads1293_sample_one_frame(); void nrfx_timer_event_handler(nrf_timer_event_t event_type, void* p_context) { // ads1293_sample_one_frame(); } -//static void ads1293_ready_pin_irq(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action) { ads1293_sample_one_frame(); } +// static void ads1293_ready_pin_irq(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action) { ads1293_sample_one_frame(); } static void ads1293_sample_one_frame() { if (!m_work_flag) { return; @@ -414,7 +414,11 @@ void hwss_init(void) { if (err != NRFX_SUCCESS) { NRF_LOG_ERROR("nrfx_timer_init failed with: %d\n", err); } - uint32_t timer_ticks = nrfx_timer_ms_to_ticks(&m_timer, 2); // 500HZ + + ZASSERT(SAMPLE_RATE == 400); + uint32_t timer_ticks = nrfx_timer_ms_to_ticks(&m_timer, 5); // 200HZ + ZASSERT(timer_ticks % 2 == 0); // + timer_ticks = timer_ticks / 2; // 400HZ nrfx_timer_extended_compare(&m_timer, NRF_TIMER_CC_CHANNEL0, timer_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true); }