zhaohe 1 year ago
parent
commit
5f14c93b2f
  1. 3
      README.md
  2. 2
      app/src/basic/version.h
  3. 2
      app/src/board/board_sdcard_driver.c
  4. 60
      app/src/heart_wave_sample_service.c
  5. 15442
      release/V16/three_lead_ecg_v16.hex
  6. BIN
      release/V16/three_lead_ecg_v16.zip

3
README.md

@ -1,6 +1,9 @@
# three_lead_ecg_v2
```
V16:
1.修改心率采样IO init,和IO uinit的位置
V15:
1.继续优化功耗到3.1ma

2
app/src/basic/version.h

@ -2,7 +2,7 @@
#define CATEGORY "M1002" // Èýµ¼Áª
#define MANUFACTURER_NAME "iflytop"
#define FIRMWARE_VERSION (15)
#define FIRMWARE_VERSION (16)
#define BLESTACK_VERSION 1
#define BOOTLOADER_VERSION 1
#define HARDWARE_VERSION (1)

2
app/src/board/board_sdcard_driver.c

@ -182,7 +182,7 @@ void Board_sdcardUnInit() {
nrf_gpio_cfg_default(SDCARD_USBDRIVER_IC_JUNCTION_CTRL_NOE_PIN);
nrf_gpio_cfg_default(SDCARD_USBDRIVER_IC_RESET_PIN);
nrf_gpio_cfg_default(SDCARD_POWER_CTRL_PIN);
// nrf_gpio_cfg_default(SDCARD_POWER_CTRL_PIN);
znrf_gpio_cfg_output(SDCARD_POWER_CTRL_PIN, NRF_GPIO_PIN_PULLUP);
nrf_gpio_pin_write(SDCARD_POWER_CTRL_PIN, 1);

60
app/src/heart_wave_sample_service.c

@ -501,51 +501,30 @@ static void ads1293_uninit() {
nrf_drv_spi_uninit(&spi);
}
void hwss_init(void) {
#if GPIO_IRQ_TRIGGER_MODE
void hwss_init(void) {}
void hwss_load(void) {
ZERROR_CHECK(nrfx_gpiote_init());
{
nrf_gpio_cfg_input(ADS1293_READY_PIN, NRF_GPIO_PIN_PULLUP);
ZERROR_CHECK(nrfx_gpiote_init());
nrf_drv_gpiote_in_config_t inConfig = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false); // 沿
nrf_drv_gpiote_in_config_t inConfig = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false); //
inConfig.pull = NRF_GPIO_PIN_PULLUP; //
inConfig.sense = NRF_GPIOTE_POLARITY_HITOLO; // 沿
ZERROR_CHECK(nrfx_gpiote_in_init(ADS1293_READY_PIN, &inConfig, ads1293_ready_pin_irq));
}
nrf_gpio_cfg_input(LINE_DET_PIN, NRF_GPIO_PIN_PULLUP);
#else
/**
* @brief
*/
nrfx_err_t err;
nrfx_timer_config_t timer_cfg = {
.frequency = NRF_TIMER_FREQ_250kHz,
.mode = NRF_TIMER_MODE_TIMER,
.bit_width = NRF_TIMER_BIT_WIDTH_24,
.p_context = NULL,
.interrupt_priority = NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY,
};
err = nrfx_timer_init(&m_timer, &timer_cfg, nrfx_timer_event_handler);
if (err != NRFX_SUCCESS) {
NRF_LOG_ERROR("nrfx_timer_init failed with: %d\n", err);
}
ZASSERT(SAMPLE_RATE == 400);
uint32_t timer_ticks = nrfx_timer_ms_to_ticks(&m_timer, 5); // 200HZ
ZLOGI("timer_ticks:%d\n", timer_ticks);
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);
#endif
ads1293_init();
}
void hwss_unload(void) {
ads1293_uninit();
nrfx_gpiote_uninit();
nrf_gpio_cfg_default(ADS1293_READY_PIN);
}
void hwss_load(void) { ads1293_init(); }
void hwss_unload(void) { ads1293_uninit(); }
uint32_t hwss_started_has_passed_s(void) { return znordic_getpower_on_s() - m_capture_start_s; }
void hwss_start_capture(void) {
nrf_gpio_cfg_input(LINE_DET_PIN, NRF_GPIO_PIN_PULLUP);
m_drop_state_triggered = false;
m_work_flag = true;
m_frame_index = 0;
@ -567,9 +546,7 @@ void hwss_start_capture(void) {
{
//
nrf_gpio_pin_clear(ADS1293_SPI_CS0_PIN);
#if CHANNEL_NUM == 2
nrf_gpio_pin_clear(ADS1293_SPI_CS1_PIN);
#endif
uint8_t txcache[2];
txcache[0] = ADS1293_WRITE_BIT & TI_ADS1293_CONFIG_REG;
@ -577,23 +554,13 @@ void hwss_start_capture(void) {
nrf_drv_spi_transfer(&spi, txcache, 2, NULL, 0);
nrf_gpio_pin_set(ADS1293_SPI_CS0_PIN);
#if CHANNEL_NUM == 2
nrf_gpio_pin_set(ADS1293_SPI_CS1_PIN);
#endif
}
#if GPIO_IRQ_TRIGGER_MODE
nrfx_gpiote_in_event_enable(ADS1293_READY_PIN, true);
#else
nrfx_timer_enable(&m_timer);
#endif
}
void hwss_stop_capture(void) {
#if GPIO_IRQ_TRIGGER_MODE
nrfx_gpiote_in_event_enable(ADS1293_READY_PIN, false);
#else
nrfx_timer_disable(&m_timer);
#endif
m_work_flag = false;
m_frame_index = 0;
@ -621,7 +588,6 @@ void hwss_stop_capture(void) {
#endif
}
nrf_gpio_cfg_default(ADS1293_READY_PIN);
nrf_gpio_cfg_default(LINE_DET_PIN);
}

15442
release/V16/three_lead_ecg_v16.hex
File diff suppressed because it is too large
View File

BIN
release/V16/three_lead_ecg_v16.zip

Loading…
Cancel
Save