static int yas_bma250_init(void)
{
	struct yas_acc_filter filter;
	int err;
	int id;

	/* Check intialize */
	if (acc_data.initialize == 1)
		return YAS_ERROR_NOT_INITIALIZED;

	/* Init data */
	yas_bma250_init_data();

	/* Open i2c */
	err = yas_bma250_i2c_open();
	if (err != YAS_NO_ERROR)
		return err;

	/* Check id */
	id = yas_bma250_read_reg_byte(YAS_BMA250_CHIP_ID_REG);
	if (!((id == YAS_BMA250_CHIP_ID_250)  ||
	      (id == YAS_BMA250_CHIP_ID_250E) ||
	      (id == YAS_BMA250_CHIP_ID_254))) {
		yas_bma250_i2c_close();
		return YAS_ERROR_CHIP_ID;
	}

	/* Reset chip */
	yas_bma250_write_reg_byte(YAS_BMA250_SOFT_RESET_REG,
				  YAS_BMA250_SOFT_RESET_VAL);
	yas_bma250_msleep(3);

	/* Set axes range*/
	yas_bma250_update_bits(YAS_BMA250_RANGE, YAS_BMA250_RANGE_2G);

	acc_data.chip_id = (uint8_t)id;
	acc_data.initialize = 1;

	yas_bma250_set_delay(YAS_BMA250_DEFAULT_DELAY);
	yas_bma250_set_position(YAS_BMA250_DEFAULT_POSITION);
	filter.threshold = YAS_ACC_DEFAULT_FILTER_THRESH;
	yas_bma250_set_filter(&filter);
	yas_bma250_power_down();

	return YAS_NO_ERROR;
}
static int yas_set_position(int position)
{
    int err;

    /* Check intialize */
    if (pcb == NULL) {
        return YAS_ERROR_NOT_INITIALIZED;
    }

    if (!((position >= 0) && (position <= 7))) {
        return YAS_ERROR_ARG;
    }

    yas_bma250_lock();
    err = yas_bma250_set_position(position);
    yas_bma250_unlock();

    return err;
}