#define __HB_ADT_CONFIRM_THR_CNT__ (20)
/* hb and spo2 */
-#define __HR_SPO2_DET_SUPPORT__ (1)
+#define __HR_SPO2_DET_SUPPORT__ (0)
/// hr spo2 fifo thr cnt config
#define __HR_SPO2_FIFO_THR_CNT_CONFIG__ (100)
/* delay */
/// delay us
+#include "helios_os.h"
void hal_gh30x_delay_us(uint16_t us_cnt)
{
- int cnt = 26;
- volatile int i = 0;
- while (us_cnt--) {
- i = cnt;
- while (i--);
- }
- // code implement by user
+ // int cnt = 26;
+ // volatile int i = 0;
+ // while (us_cnt--) {
+ // i = cnt;
+ // while (i--);
+ // }
+ Helios_msleep(us_cnt/1000);
+ //code implement by user
}
/* gsensor driver */
extern signed char SL_SC7A20_PEDO_KCAL_WRIST_SLEEP_SWAY_L_ALGO(void);
extern unsigned char Gsensor_init_flag ;
extern void hal_gh30x_int_handler(void);
+char GH3018_irq_lock = 0;
// int test_count1 = 0;
// int test_count2 = 0;
{
if(GH3018_irq_flag)
{
+ GH3018_irq_lock = 1;
hal_gh30x_int_handler();
+ GH3018_irq_lock = 0;
//GH3018_LOG("hal_gh30x_int_handler:test_count1:%d test_count2:%d\r\n",test_count1,test_count2);
GH3018_irq_flag = 0;
}
STATIC mp_obj_t mp_GH3018_deinit(mp_obj_t self_in)
{
GH3018_obj_t *self = MP_OBJ_TO_PTR(self_in);
+ while(GH3018_irq_lock)
+ {
+ Helios_msleep(1);
+ }
gh30x_module_stop();
Helios_GPIO_Deinit((Helios_GPIONum)self->irq);
Helios_ExtInt_Deinit(self->irq);
GH3018_LOG("mp_GH3018_open_heart gh30x_module_init:ret:%d\r\n",ret);
if(ret == 1)
{
- gh30x_module_stop();
+ //gh30x_module_stop();
Helios_msleep(10);
gh30x_module_start_without_adt(mode);
//gh30x_module_start(gh3018_run_mode);
GH3018_obj_t *self = MP_OBJ_TO_PTR(self_in);
if(is_open_gh3018 == 1)
{
+
+ while(GH3018_irq_lock)
+ {
+ Helios_msleep(1);
+ }
gh30x_module_stop();
if(sensor_timer != 0)
{
}
}
is_open_gh3018 = 0;
+ Helios_GPIO_SetLevel(self->power, HELIOS_LVL_LOW);
+ Helios_msleep(5);
+ Helios_GPIO_SetLevel(self->power, HELIOS_LVL_HIGH);
+ Helios_msleep(20);
+ gh30x_module_init();
//Helios_GPIO_SetLevel(self->power, HELIOS_LVL_LOW);
return mp_obj_new_int(1);
}