|
|
@ -89,6 +89,9 @@ static uint32_t m_little_frame_index; |
|
|
|
static uint8_t m_lodstate0; |
|
|
|
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; |
|
|
|
|
|
|
|
static uint32_t m_capture_start_s; |
|
|
@ -295,20 +298,17 @@ static void ads1293_load_cfg(ads1293_t *ads) { |
|
|
|
|
|
|
|
uint16_t cfgsize = 0; |
|
|
|
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); |
|
|
|
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++) { |
|
|
|
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 { |
|
|
|
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_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, 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)); |
|
|
@ -599,3 +602,8 @@ uint8_t hwss_get_drop_state0() { return m_lodstate0; } |
|
|
|
uint8_t hwss_get_drop_state1() { return m_lodstate1; } |
|
|
|
|
|
|
|
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; } |