You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
986 B

1 year ago
  1. #include "device_state.h"
  2. #include "znordic.h"
  3. static device_state_t m_device_state = kdevice_state_standby; // �豸״̬
  4. static uint32_t m_change_to_cur_state_tp = 0; // �л�����ǰ״̬��ʱ����
  5. void ds_change_to_state(device_state_t state) {
  6. ZLOGI("change state from %s to %s", device_state_to_str(m_device_state), device_state_to_str(state));
  7. m_device_state = state;
  8. m_change_to_cur_state_tp = znordic_getpower_on_ms();
  9. }
  10. uint32_t ds_cur_state_haspassed_ms() { return znordic_haspassed_ms(m_change_to_cur_state_tp); }
  11. device_state_t ds_now_state() { return m_device_state; }
  12. static sample_capture_state_t m_sample_capture_state;
  13. sample_capture_state_t* sample_capture_state_get() { //
  14. return &m_sample_capture_state;
  15. }
  16. void sample_capture_state_reset() { //
  17. m_sample_capture_state.is_over30s = false;
  18. };
  19. void sample_capture_state_set_is_over30s(bool over30s) { //
  20. m_sample_capture_state.is_over30s = over30s;
  21. }