Пример #1
0
/* This function is called just before a measurement sequence starts.
  Load parameters from a file and initialize library. This function must be
  called when a sequential measurement thread boots up.
  @return The return value is #AKM_SUCCESS.
  @param[in/out] mem A pointer to a handler.
  @param[in] path The path to a setting file to be read out. The path name
  should be terminated with NULL.
 */
int16 AKFS_Start(void *mem, const char *path)
{
    AKMPRMS *prms;
#ifdef AKM_VALUE_CHECK
    if (mem == NULL || path == NULL) {
        AKMDEBUG(AKMDATA_CHECK, "%s: Invalid mem pointer.", __FUNCTION__);
        return AKM_ERROR;
    }
#endif
    AKMDEBUG(AKMDATA_DUMP, "%s: path=%s\n", __FUNCTION__, path);

    /* Copy pointer */
    prms = (AKMPRMS *)mem;

    /* Read setting files from a file */
    if (AKFS_LoadParameters(prms, path) != AKM_SUCCESS) {
        AKMERROR_STR("AKFS_LoadParameters");
    }

    /* Initialize buffer */
    AKFS_InitBuffer(AKFS_HDATA_SIZE, prms->fva_hdata);
    AKFS_InitBuffer(AKFS_HDATA_SIZE, prms->fva_hvbuf);
    AKFS_InitBuffer(AKFS_ADATA_SIZE, prms->fva_avbuf);

    /* Initialize for AOC */
    AKFS_InitAOC(&prms->s_aocv);
    /* Initialize magnetic status */
    prms->i16_hstatus = 0;

    return AKM_SUCCESS;
}
static int cal_init(const struct sensor_cal_module_t *module)
{
	AKMPRMS *prms = &g_prms;

	/* Clear all data. */
	memset(prms, 0, sizeof(AKMPRMS));

	/* Sensitivity */
	prms->fv_hs.u.x = AKM_MAG_SENSE;
	prms->fv_hs.u.y = AKM_MAG_SENSE;
	prms->fv_hs.u.z = AKM_MAG_SENSE;

	/* Initialize buffer */
	AKFS_InitBuffer(AKFS_HDATA_SIZE, prms->fva_hdata);
	AKFS_InitBuffer(AKFS_HDATA_SIZE, prms->fva_hvbuf);
	AKFS_InitBuffer(AKFS_ADATA_SIZE, prms->fva_avbuf);

	/* Initialize for AOC */
	AKFS_InitAOC(&prms->s_aocv);
	/* Initialize magnetic status */
	prms->i16_hstatus = 0;

	return 0;
}
Пример #3
0
/*
  This function is called just before a measurement sequence starts.
  This function reads parameters from file, then initializes algorithm
  parameters.
  @return The return value is #AKM_SUCCESS.
  @param[in] path Specify a path to the settings file.
 */
int16 AKFS_Start(
	const char* path
)
{
	AKMDATA(AKMDATA_DUMP, "%s: path=%s\n", __FUNCTION__, path);

	/* Read setting files from a file */
	if (AKFS_LoadParameters(&g_prms, path) != AKM_SUCCESS) {
		AKMERROR_STR("AKFS_Load");
	}

	/* Initialize buffer */
	AKFS_InitBuffer(AKFS_HDATA_SIZE, g_prms.mfv_hdata);
	AKFS_InitBuffer(AKFS_HDATA_SIZE, g_prms.mfv_hvbuf);
	AKFS_InitBuffer(AKFS_ADATA_SIZE, g_prms.mfv_adata);
	AKFS_InitBuffer(AKFS_ADATA_SIZE, g_prms.mfv_avbuf);

	/* Initialize for AOC */
	AKFS_InitAOC(&g_prms.m_aocv);
	/* Initialize magnetic status */
	g_prms.mi_hstatus = 0;

	return AKM_SUCCESS;
}