my_xmotion_sleep_suspend();
xmotion_send_message(XMOTION_MSG_PROCESS_DATA,0);
}
+ //cplog_printf("xmotion_timer_callback:!!!!!!\n");
}
#if (USE_POLLING_MODE == POLLING_MODE_INT)
static void xmotion_hisr_callback(void)
short Gsensor_y[32];
short Gsensor_z[32];
int Gsensor_xyz_len = 0;
+#define ACC_0G_X 8192 //4096
+#define ACC_0G_Y 8192
+#define ACC_0G_Z 8192
#define FALL_DETECH_LOW_THRESHOLD 45
#define FALL_COUNTER_THRESHOLD 5
typedef struct
gpio_enable_edge_detect(my_xm_info.irq_pin, EDGE_FLAG_FALL);
#endif
Gsensor_xyz_len = xMotion_FIFO_Read_XYZ(Gsensor_x,Gsensor_y,Gsensor_z);
+ //cplog_printf("xMotion_FIFO_Read_XYZ:Gsensor_xyz_len%d\n",Gsensor_xyz_len);
for(int i = 0;i< Gsensor_xyz_len;i++)
{
- s_acc.x= Gsensor_x[i];
- s_acc.y= Gsensor_y[i];
- s_acc.z= Gsensor_z[i];
+ // s_acc.x= Gsensor_x[i];
+ // s_acc.y= Gsensor_y[i];
+ // s_acc.z= Gsensor_z[i];
+ s_acc.x = (float)((Gsensor_x[i]*9.8f)/((uint16_t)ACC_0G_X));
+ s_acc.y = (float)((Gsensor_y[i]*9.8f)/((uint16_t)ACC_0G_Y));
+ s_acc.z = (float)((Gsensor_z[i]*9.8f)/((uint16_t)ACC_0G_Z));
if(gsensor_sc7a20_fall_detect(&s_acc) == 1)//跌倒报警
mmi_gsensor_sensor_fall_alarm();
}
mfp_config((uint32_t *)my_xm_mfp_cfgs);
//xMotion Init
ret = xMotion_Init(&ops_handle);
- printf("xMotion_Init ret =%d\n",ret);
+ //cplog_printf("xMotion_Init ret =%d\n",ret);
if(ret){
printf("xMotion init fail\n");
uos_timer_create(&pptimer);
uos_timer_start(pptimer, XMOTION_TIME, XMOTION_TIME, xmotion_timer_callback, NULL);
xmotion_timer_start_flag = true;
+ //cplog_printf("uos_timer_start(pptimer, XMOTION_TIME, XMOTION_TIME, xmotion_timer_callback, NULL);\n");
}
#endif