zhaohe 1 year ago
parent
commit
707e49fbb1
  1. 4
      README.md
  2. 22
      app/src/app_ble_service.c
  3. 8
      app/src/basic/device_version_info_mgr.c
  4. 2
      app/src/basic/device_version_info_mgr.h
  5. 2
      app/src/basic/version.h
  6. 26
      app/src/heart_wave_sample_service.c
  7. 3
      app/src/heart_wave_sample_service.h
  8. 2
      ify_hrs_protocol
  9. 15558
      release/V18/three_lead_ecg_v18.hex
  10. BIN
      release/V18/three_lead_ecg_v18.zip

4
README.md

@ -1,6 +1,10 @@
# three_lead_ecg_v2 # three_lead_ecg_v2
``` ```
V18:
1.支持直接读取ads1293 LOD信息
V17: V17:
1.支持从文件中读取ECG配置 1.支持从文件中读取ECG配置
2.修改当设备ID和批次为0时的蓝牙名称 2.修改当设备ID和批次为0时的蓝牙名称

22
app/src/app_ble_service.c

@ -523,6 +523,28 @@ static void prvf_process_ble_rx_data(void* p_event_data, uint16_t len) {
else if (cmd == ify_hrs_cmd_reset) { else if (cmd == ify_hrs_cmd_reset) {
NVIC_SystemReset(); NVIC_SystemReset();
} }
else if (cmd == ify_hrs_cmd_ads1293_error_detail_info) {
txheader->data[0] = hwss_get_original_drop_state0();
txheader->data[1] = hwss_get_original_drop_state1();
uint16_t sendlen = sizeof(ify_hrs_packet_t) + 2;
zdatachannel_data_send2(m_txbuf, sendlen);
}
else if (cmd == ify_hrs_cmd_change_sn) {
if (paramLen < 8) {
send_error_receipt(rxheader, kifyhrs_ecode_parameter_error);
return;
}
uint32_t lot = *(uint32_t*)(&rxheader->data[0]);
uint32_t sn = *(uint32_t*)(&rxheader->data[4]);
device_info_change_sn(lot, sn);
send_success_receipt(rxheader, 0);
}
// //
else { else {
send_error_receipt(rxheader, kifyhrs_ecode_cmd_not_support); send_error_receipt(rxheader, kifyhrs_ecode_cmd_not_support);

8
app/src/basic/device_version_info_mgr.c

@ -16,7 +16,7 @@ void device_info_read_sn(sn_t *sn) {
static char sn_str[15]; static char sn_str[15];
sprintf(sn_str, CATEGORY "%04d%05d", lot, id); sprintf(sn_str, CATEGORY "%04d%05d", lot, id);
if (lot == 0 || id == 0 || lot == 0xffffffff || id == 0xffffffff) { if (lot == 0 || id == 0 || lot == 0xffffffff || id == 0xffffffff) {
sprintf(sn_str, CATEGORY"000000000");
sprintf(sn_str, CATEGORY "000000000");
} }
memcpy(sn->sn, sn_str, sizeof(sn->sn)); memcpy(sn->sn, sn_str, sizeof(sn->sn));
} }
@ -31,3 +31,9 @@ uint16_t device_info_read_blestack_version(void) { return BLESTACK_VERSION; }
uint16_t device_info_read_bootloader_version(void) { return BOOTLOADER_VERSION; } uint16_t device_info_read_bootloader_version(void) { return BOOTLOADER_VERSION; }
uint16_t device_info_read_firmware_version(void) { return FIRMWARE_VERSION; } uint16_t device_info_read_firmware_version(void) { return FIRMWARE_VERSION; }
uint16_t device_info_read_hardware_version(void) { return HARDWARE_VERSION; } uint16_t device_info_read_hardware_version(void) { return HARDWARE_VERSION; }
static void uict_write_test(void) {}
void device_info_change_sn(uint32_t lot, uint32_t id) {
// ZLOGI("sn to %d %d", NRF_UICR->CUSTOMER[0], NRF_UICR->CUSTOMER[1]);
}

2
app/src/basic/device_version_info_mgr.h

@ -12,3 +12,5 @@ uint16_t device_info_read_blestack_version(void);
uint16_t device_info_read_bootloader_version(void); uint16_t device_info_read_bootloader_version(void);
uint16_t device_info_read_firmware_version(void); uint16_t device_info_read_firmware_version(void);
uint16_t device_info_read_hardware_version(void); uint16_t device_info_read_hardware_version(void);
void device_info_change_sn(uint32_t lot, uint32_t id);

2
app/src/basic/version.h

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

26
app/src/heart_wave_sample_service.c

@ -89,6 +89,9 @@ static uint32_t m_little_frame_index;
static uint8_t m_lodstate0; static uint8_t m_lodstate0;
static uint8_t m_lodstate1; static uint8_t m_lodstate1;
static uint8_t m_ads1293_raw_lod_state0;
static uint8_t m_ads1293_raw_lod_state1;
volatile static bool m_drop_state_triggered = false; volatile static bool m_drop_state_triggered = false;
static uint32_t m_capture_start_s; static uint32_t m_capture_start_s;
@ -295,20 +298,17 @@ static void ads1293_load_cfg(ads1293_t *ads) {
uint16_t cfgsize = 0; uint16_t cfgsize = 0;
tryloadcfg_from_fatfs(cfgfile, cfg_cache, ZARRAY_SIZE(cfg_cache), &cfgsize); tryloadcfg_from_fatfs(cfgfile, cfg_cache, ZARRAY_SIZE(cfg_cache), &cfgsize);
if (cfgsize != defaultCfgSize) {
if (cfgsize != 0) {
ZLOGI("ads_%d load %s from fatfs\n", ads->id, cfgfile); ZLOGI("ads_%d load %s from fatfs\n", ads->id, cfgfile);
if (memcmp(cfg_cache, defaultCfg, defaultCfgSize) != 0) {
ZLOGI("ads_%d %s is different from default", ads->id, cfgfile);
} else {
ZLOGI("ads_%d %s is same as default", ads->id, cfgfile);
}
ZASSERT(cfgsize == defaultCfgSize);
for (uint16_t i = 0; i < cfgsize; i++) { for (uint16_t i = 0; i < cfgsize; i++) {
ads1293_spi_writereg_and_check(&m_ads1293_0, cfg_cache[i].add, cfg_cache[i].data);
ZASSERT(cfg_cache[i].add == defaultCfg[i].add);
ads1293_spi_writereg_and_check(ads, cfg_cache[i].add, cfg_cache[i].data);
} }
} else { } else {
ZLOGI("ads_%d load cfg from default\n", ads->id); ZLOGI("ads_%d load cfg from default\n", ads->id);
for (uint16_t i = 0; i < ZARRAY_SIZE(m_prvads0cfg); i++) {
ads1293_spi_writereg_and_check(&m_ads1293_0, m_prvads0cfg[i].add, m_prvads0cfg[i].data);
for (uint16_t i = 0; i < defaultCfgSize; i++) {
ads1293_spi_writereg_and_check(ads, defaultCfg[i].add, defaultCfg[i].data);
} }
} }
} }
@ -346,6 +346,9 @@ static void update_lod_error() {
m_lodstate0 = 0; m_lodstate0 = 0;
m_lodstate1 = 0; m_lodstate1 = 0;
m_ads1293_raw_lod_state0 = loderror0;
m_ads1293_raw_lod_state1 = loderror1;
byte_set_bit(&m_lodstate0, 0, byte16_get_bit(loderror16, SENSOR_LOD_ERROR_OFF_00)); byte_set_bit(&m_lodstate0, 0, byte16_get_bit(loderror16, SENSOR_LOD_ERROR_OFF_00));
byte_set_bit(&m_lodstate0, 1, byte16_get_bit(loderror16, SENSOR_LOD_ERROR_OFF_01)); byte_set_bit(&m_lodstate0, 1, byte16_get_bit(loderror16, SENSOR_LOD_ERROR_OFF_01));
byte_set_bit(&m_lodstate0, 2, byte16_get_bit(loderror16, SENSOR_LOD_ERROR_OFF_10)); byte_set_bit(&m_lodstate0, 2, byte16_get_bit(loderror16, SENSOR_LOD_ERROR_OFF_10));
@ -599,3 +602,8 @@ uint8_t hwss_get_drop_state0() { return m_lodstate0; }
uint8_t hwss_get_drop_state1() { return m_lodstate1; } uint8_t hwss_get_drop_state1() { return m_lodstate1; }
bool hwss_line_detect_get_state() { return !nrf_gpio_pin_read(LINE_DET_PIN); } bool hwss_line_detect_get_state() { return !nrf_gpio_pin_read(LINE_DET_PIN); }
uint8_t hwss_get_original_drop_state0() { return m_ads1293_raw_lod_state0; }
uint8_t hwss_get_original_drop_state1() { return m_ads1293_raw_lod_state1; }

3
app/src/heart_wave_sample_service.h

@ -37,3 +37,6 @@ uint8_t hwss_get_drop_state0();
uint8_t hwss_get_drop_state1(); uint8_t hwss_get_drop_state1();
bool hwss_line_detect_get_state(); bool hwss_line_detect_get_state();
uint8_t hwss_get_original_drop_state0();
uint8_t hwss_get_original_drop_state1();

2
ify_hrs_protocol

@ -1 +1 @@
Subproject commit f2eae40f67048820f37dc5dd3585ca9a75156dfc
Subproject commit a6a574153392f38ed65b6d8190b06bb93c82049c

15558
release/V18/three_lead_ecg_v18.hex
File diff suppressed because it is too large
View File

BIN
release/V18/three_lead_ecg_v18.zip

Loading…
Cancel
Save