/*!
  If this program run as console mode, measurement result will be displayed
   on console terminal.
  @return If this function succeeds, the return value is #AKM_SUCCESS.
   Otherwise the return value is #AKM_FAIL.
 */
void AKFS_OutputResult(
	const	uint16			flag,
	const	AKSENSOR_DATA*	acc,
	const	AKSENSOR_DATA*	mag,
	const	AKSENSOR_DATA*	ori
)
{
	int buf[YPR_DATA_SIZE];

	/* Store to buffer */
	buf[0] = flag;					/* Data flag */
	buf[1] = CONVERT_ACC(acc->x);	/* Ax */
	buf[2] = CONVERT_ACC(acc->y);	/* Ay */
	buf[3] = CONVERT_ACC(acc->z);	/* Az */
	buf[4] = acc->status;			/* Acc status */
	buf[5] = CONVERT_MAG(mag->x);	/* Mx */
	buf[6] = CONVERT_MAG(mag->y);	/* My */
	buf[7] = CONVERT_MAG(mag->z);	/* Mz */
	buf[8] = mag->status;			/* Mag status */
	buf[9] = CONVERT_ORI(ori->x);	/* yaw */
	buf[10] = CONVERT_ORI(ori->y);	/* pitch */
	buf[11] = CONVERT_ORI(ori->z);	/* roll */

	if (g_opmode & OPMODE_CONSOLE) {
		/* Console mode */
		Disp_Result(buf);
	}

	/* Set result to driver */
		AKD_SetYPR(buf);
}
Пример #2
0
/*!
 Output measurement result. If this application is run as ConsoleMode,
 the measurement result is output to console. If this application is run as
 DaemonMode, the measurement result is written to device driver.
 @param[in] prms pointer to #AKSCPRMS structure.
 @param[in] flag This flag shows which data contains the valid data.
 The device driver will report only the valid data to HAL layer.
 */
void Disp_MeasurementResultHook(AKSCPRMS* prms, const uint16 flag)
{
	int rbuf[AKM_YPR_DATA_SIZE] = { 0 };
	/* Coordinate system is already converted to Android */
	rbuf[0] = flag;				/* Data flag */
	rbuf[1] = prms->m_avec.u.x;	/* Ax */
	rbuf[2] = prms->m_avec.u.y;	/* Ay */
	rbuf[3] = prms->m_avec.u.z;	/* Az */
	rbuf[4] = 3;				/* Acc status */
	rbuf[5] = prms->m_hvec.u.x;	/* Mx */
	rbuf[6] = prms->m_hvec.u.y;	/* My */
	rbuf[7] = prms->m_hvec.u.z;	/* Mz */
	rbuf[8] = prms->m_hdst;		/* Mag status */
	/* Orientation (Q6 format)*/
	rbuf[9] = prms->m_theta;	/* yaw	(deprecate) */
	rbuf[10] = prms->m_phi180;	/* pitch (deprecate) */
	rbuf[11] = prms->m_eta90;	/* roll  (deprecate) */
	/* Axis conversion, from AKSC to Android is done here */
	/* RotVec (AKSC Q4 format deg/sec ) */
	rbuf[12] = prms->m_quat.u.y;
	rbuf[13] = prms->m_quat.u.x * (-1);
	rbuf[14] = prms->m_quat.u.z * (-1);
	rbuf[15] = prms->m_quat.u.w;
	AKD_SetYPR(rbuf);

	if (g_opmode & OPMODE_CONSOLE) {
		Disp_MeasurementResult(prms);
	}
}
Пример #3
0
/*!
 Output measurement result. If this application is run as ConsoleMode,
 the measurement result is output to console. If this application is run as
 DaemonMode, the measurement result is written to device driver.
 @param[in] prms pointer to #AK8963PRMS structure.
 @param[in] flag This flag shows which data contains the valid data.
 The device driver will report only the valid data to HAL layer.
 */
void Disp_MeasurementResultHook(AK8963PRMS* prms, const uint16 flag)
{
	if (!g_opmode) {
		int rbuf[YPR_DATA_SIZE] = { 0 };
		rbuf[0] = flag;				/* Data flag */
		rbuf[1] = prms->m_avec.u.x;	/* Ax */
		rbuf[2] = prms->m_avec.u.y;	/* Ay */
		rbuf[3] = prms->m_avec.u.z;	/* Az */
		rbuf[4] = 3;					/* Acc status */
		rbuf[5] = prms->m_hvec.u.x;	/* Mx */
		rbuf[6] = prms->m_hvec.u.y;	/* My */
		rbuf[7] = prms->m_hvec.u.z;	/* Mz */
		rbuf[8] = prms->m_hdst;		/* Mag status */
		rbuf[9] = prms->m_theta;		/* yaw	(deprecate) */
		rbuf[10] = prms->m_phi180;	/* pitch (deprecate) */
		rbuf[11] = prms->m_eta90;		/* roll  (deprecate) */
		AKD_SetYPR(rbuf);
	} else {
		Disp_MeasurementResult(prms);
	}
}
Пример #4
0
/*!
  If this program run as console mode, measurement result will be displayed
   on console terminal.
  @return None.
 */
void AKFS_OutputResult(
	const	uint16			flag,
	const	AKSENSOR_DATA*	acc,
	const	AKSENSOR_DATA*	mag,
	const	AKSENSOR_DATA*	ori
)
{
	int buf[AKM_YPR_DATA_SIZE];

#ifdef AKM_VALUE_CHECK
	if (AKM_YPR_DATA_SIZE < 12) {
		AKMERROR_STR("You may refer invalid header file.");
		return;
	}
#endif
	/* Store to buffer */
	buf[0] = flag;					/* Data flag */
	buf[1] = CONVERT_ACC(acc->x);	/* Ax */
	buf[2] = CONVERT_ACC(acc->y);	/* Ay */
	buf[3] = CONVERT_ACC(acc->z);	/* Az */
	buf[4] = acc->status;			/* Acc status */
	buf[5] = CONVERT_MAG(mag->x);	/* Mx */
	buf[6] = CONVERT_MAG(mag->y);	/* My */
	buf[7] = CONVERT_MAG(mag->z);	/* Mz */
	buf[8] = mag->status;			/* Mag status */
	buf[9] = CONVERT_ORI(ori->x);	/* yaw */
	buf[10] = CONVERT_ORI(ori->y);	/* pitch */
	buf[11] = CONVERT_ORI(ori->z);	/* roll */

	if (g_opmode & OPMODE_CONSOLE) {
		/* Console mode */
		Disp_Result(buf);
	}

	/* Set result to driver */
	AKD_SetYPR(buf);
}