Browse Source

update

master
zhaohe 1 year ago
parent
commit
e925a9bd99
  1. 2
      app/app.uvoptx
  2. 21
      app/src/device_ctrl_service.c
  3. 3
      app/src/heart_wave_sample_service.c

2
app/app.uvoptx

@ -73,7 +73,7 @@
<LExpSel>0</LExpSel>
</OPTXL>
<OPTFL>
<tvExp>1</tvExp>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>

21
app/src/device_ctrl_service.c

@ -56,8 +56,8 @@ static void zble_event_listener(zble_event_t* ble_event) { //
/*******************************************************************************
* *
*******************************************************************************/
static bool m_ispoweron = false;
//static bool m_drop_state_triggered = false;
static bool m_ispoweron = false;
// static bool m_drop_state_triggered = false;
static void poweroff() {
if (!m_ispoweron) return;
BoardBeepCtrl_unload();
@ -139,12 +139,12 @@ static void prvf_change_to_sample_state() { //
static void app_event_listener(void* p_event_data, uint16_t event_size) { //
app_event_t* event = (app_event_t*)p_event_data;
//static bool inited;
// if (!inited) {
// nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_NOPULL);
// inited = true;
// }
// ZLOGI("button %d", nrf_gpio_pin_read(BUTTON_PIN));
// static bool inited;
// if (!inited) {
// nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_NOPULL);
// inited = true;
// }
// ZLOGI("button %d", nrf_gpio_pin_read(BUTTON_PIN));
/*******************************************************************************
* *
@ -167,10 +167,15 @@ static void app_event_listener(void* p_event_data, uint16_t event_size) { //
//
else if (m_device_state == kdevice_state_ready) {
/*******************************************************************************
* *
*******************************************************************************/
#if 0
if (!zble_module_is_connected() && DeviceCtrl_cur_state_haspassed_ms() > APP_AUTO_SLEEP_TIMEOUT_MS) {
ZLOGI("auto sleep");
prvf_change_to_standby_state();
}
#endif
if (event->eventType == kevent_start_sample_cmd_event) {
ZLOGI("start sample");

3
app/src/heart_wave_sample_service.c

@ -403,7 +403,7 @@ void hwss_init(void) {
*/
nrfx_err_t err;
nrfx_timer_config_t timer_cfg = {
.frequency = NRF_TIMER_FREQ_125kHz,
.frequency = NRF_TIMER_FREQ_250kHz,
.mode = NRF_TIMER_MODE_TIMER,
.bit_width = NRF_TIMER_BIT_WIDTH_24,
.p_context = NULL,
@ -417,6 +417,7 @@ void hwss_init(void) {
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);

Loading…
Cancel
Save