• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ MLSLSerialWriteSingle函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MLSLSerialWriteSingle函数的典型用法代码示例。如果您正苦于以下问题:C++ MLSLSerialWriteSingle函数的具体用法?C++ MLSLSerialWriteSingle怎么用?C++ MLSLSerialWriteSingle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了MLSLSerialWriteSingle函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: lis331dlh_set_fsr

/**
 * Set the full scale range of the accels
 *
 * @param config pointer to configuration
 * @param fsr requested full scale range
 */
static int lis331dlh_set_fsr(void *mlsl_handle,
			struct ext_slave_platform_data *pdata,
			struct lis331dlh_config *config,
			int apply,
			long fsr)
{
	unsigned char reg1 = 0x40;
	int result = ML_SUCCESS;

	if (fsr <= 2048) {
		config->fsr = 2048;
	} else if (fsr <= 4096) {
		reg1 |= 0x30;
		config->fsr = 4096;
	} else {
		reg1 |= 0x10;
		config->fsr = 8192;
	}

	lis331dlh_set_ths(mlsl_handle, pdata,
			config, apply, config->ths);
	MPL_LOGV("FSR: %d\n", config->fsr);
	if (apply)
		result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
					LIS331_CTRL_REG4, reg1);

	return result;
}
开发者ID:amuxtux,项目名称:exynos4210,代码行数:34,代码来源:lis331.c


示例2: bma250_set_fsr

/**
 *  @brief Set the full scale range of the accels
 *
 *  @param mlsl_handle
 *             the handle to the serial channel the device is connected to.
 *  @param pdata
 *             a pointer to the slave platform data.
 *  @param config
 *             pointer to configuration.
 *  @param apply
 *             whether to apply immediately or save the settings to be applied
 *             at the next resume.
 *  @param fsr
 *             requested full scale range.
 *
 *  @return ML_SUCCESS if successful or a non-zero error code.
 */
static int bma250_set_fsr(void *mlsl_handle,
			  struct ext_slave_platform_data *pdata,
			  struct bma250_config *config,
			  int apply,
			  long fsr)
{
	int result = ML_SUCCESS;
	unsigned char reg_fsr_mask;

	if (fsr <= 2000) {
		reg_fsr_mask = 0x03;
		config->fsr = 2000;
	} else if (fsr <= 4000) {
		reg_fsr_mask = 0x05;
		config->fsr = 4000;
	} else if (fsr <= 8000) {
		reg_fsr_mask = 0x08;
		config->fsr = 8000;
	} else { /* 8001 -> oo */
		reg_fsr_mask = 0x0C;
		config->fsr = 16000;
	}

	if (apply) {
		MPL_LOGV("FSR: %d\n", config->fsr);
		result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
				BMA250_FSR_REG, reg_fsr_mask);
		ERROR_CHECK(result);
	}
	return result;
}
开发者ID:Amin-jkr,项目名称:android_kernel_semc_msm8660-1,代码行数:48,代码来源:bma250.c


示例3: ami30x_read

int ami30x_read(void *mlsl_handle,
		struct ext_slave_descr *slave,
		struct ext_slave_platform_data *pdata, unsigned char *data)
{
	unsigned char stat;
	int result = ML_SUCCESS;

	/* Read status reg and check if data ready (DRDY) */
	result =
	    MLSLSerialRead(mlsl_handle, pdata->address, AMI30X_REG_STAT1,
			   1, &stat);
	ERROR_CHECK(result);

	if (stat & 0x40) {
		result =
		    MLSLSerialRead(mlsl_handle, pdata->address,
				   AMI30X_REG_DATAX, 6,
				   (unsigned char *) data);
		ERROR_CHECK(result);
		/* start another measurement */
		result =
			MLSLSerialWriteSingle(mlsl_handle, pdata->address,
					      AMI30X_REG_CNTL3,
					      AMI30X_BIT_CNTL3_F0RCE);
		ERROR_CHECK(result);

		return ML_SUCCESS;
	}

	return ML_ERROR_COMPASS_DATA_NOT_READY;
}
开发者ID:Aaroneke,项目名称:galaxy-2636,代码行数:31,代码来源:ami30x.c


示例4: hscdtd004a_read

int hscdtd004a_read(void *mlsl_handle,
		    struct ext_slave_descr *slave,
		    struct ext_slave_platform_data *pdata,
		    unsigned char *data)
{
	unsigned char stat;
	tMLError result = ML_SUCCESS;
	int status = ML_SUCCESS;

	/* Read status reg. to check if data is ready */
	result =
		MLSLSerialRead(mlsl_handle, pdata->address,
			   COMPASS_HSCDTD004A_STAT, 1, &stat);
	ERROR_CHECK(result);
	if (stat & 0x48) {
		result =
			 MLSLSerialRead(mlsl_handle, pdata->address,
				   COMPASS_HSCDTD004A_DATAX, 6,
				   (unsigned char *) data);
		ERROR_CHECK(result);
		status = ML_SUCCESS;
	} else if (stat & 0x68) {
		status = ML_ERROR_COMPASS_DATA_OVERFLOW;
	} else {
		status = ML_ERROR_COMPASS_DATA_NOT_READY;
	}
	/* trigger next measurement read */
	result =
		MLSLSerialWriteSingle(mlsl_handle, pdata->address,
			COMPASS_HSCDTD004A_CTRL3, 0x40);
	ERROR_CHECK(result);
	return status;

}
开发者ID:amuxtux,项目名称:exynos4210,代码行数:34,代码来源:hscdtd004a.c


示例5: ak8975_read

int ak8975_read(void *mlsl_handle,
		struct ext_slave_descr *slave,
		struct ext_slave_platform_data *pdata, unsigned char *data)
{
	unsigned char regs[6];
	int result = ML_SUCCESS;
	int status = ML_SUCCESS;

	mpu_dbg("%s\n", __func__);

	result = MLSLSerialRead(mlsl_handle, pdata->address,
				 AK8975_REG_HXL, 6, regs);
	ERROR_CHECK(result);

	memcpy(data, &regs[0], 6);
	status = ML_SUCCESS;
	/*
	 * trigger next measurement if:
	 *    - stat is non zero;
	 *    - if stat is zero and stat2 is non zero.
	 * Won't trigger if data is not ready and there was no error.
	 */

	result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
				  AK8975_REG_CNTL,
				  AK8975_CNTL_MODE_SINGLE_MEASUREMENT);
	ERROR_CHECK(result);

	return status;
}
开发者ID:Amin-jkr,项目名称:android_kernel_semc_msm8660-1,代码行数:30,代码来源:ak8975.c


示例6: bma250_suspend

static int bma250_suspend(void *mlsl_handle,
			  struct ext_slave_descr *slave,
			  struct ext_slave_platform_data *pdata)
{

	int result = 0;
	unsigned char ctrl_reg;
	unsigned char int_reg;

	struct bma250_private_data *private_data = pdata->private_data;
	ctrl_reg = private_data->suspend.ctrl_reg;
	int_reg = private_data->suspend.int_reg;

	private_data->state = 1;

	
	

	

	if (!private_data->suspend.power_mode) {
		result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
			BOSCH_PWR_REG, 0x80);
		ERROR_CHECK(result);
	}

	return result;
}
开发者ID:Albinoman887,项目名称:pyramid-3.4.10,代码行数:28,代码来源:bma250.c


示例7: bma250_resume

static int bma250_resume(void *mlsl_handle,
			 struct ext_slave_descr *slave,
			 struct ext_slave_platform_data *pdata)
{

	int result;
	unsigned char ctrl_reg;
	unsigned char bw_reg;
	unsigned char int_reg;

	struct bma250_private_data *private_data = pdata->private_data;
	ctrl_reg = private_data->resume.ctrl_reg;
	bw_reg = private_data->resume.bw_reg;
	int_reg = private_data->resume.int_reg;

	private_data->state = 0;

	result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
		BMA250_REG_SOFT_RESET, 0xB6);  /* BMA250: Software reset */
	ERROR_CHECK(result);
	MLOSSleep(1);

	result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
		BOSCH_CTRL_REG, ctrl_reg);
	ERROR_CHECK(result);

	result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
		BMA250_BW_REG, bw_reg);
	ERROR_CHECK(result);

	/* TODO Use irq when necessary */
	/*result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
		BOSCH_INT_REG, int_reg);
	ERROR_CHECK(result);*/

	if (!private_data->resume.power_mode) {
		result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
			BOSCH_PWR_REG, 0x80);
		ERROR_CHECK(result);
	} else {
		result = set_normal_mode(mlsl_handle, pdata);
		ERROR_CHECK(result);
	}

	return result;
}
开发者ID:frankoid,项目名称:kernel-enrc2b,代码行数:46,代码来源:bma250.c


示例8: bma250_suspend

static int bma250_suspend(void *mlsl_handle,
                          struct ext_slave_descr *slave,
                          struct ext_slave_platform_data *pdata)
{
    int result;
    result = MLSLSerialWriteSingle(mlsl_handle, pdata->address, 0x14, 0xb6); /* BMA250 : Software reset */
    return result;
}
开发者ID:amuxtux,项目名称:exynos4210,代码行数:8,代码来源:bma250.c


示例9: dmp_start

/**
 * @brief Starts the DMP running
 *
 * @return ML_SUCCESS or non-zero error code
 */
static int dmp_start(struct mldl_cfg *pdata, void *mlsl_handle)
{
	unsigned char userCtrlReg;
	int result;

	if (pdata->dmp_is_running == pdata->dmp_enable)
		return ML_SUCCESS;

	result = MLSLSerialRead(mlsl_handle, pdata->addr,
				MPUREG_USER_CTRL, 1, &userCtrlReg);
	ERROR_CHECK(result);

	result = MLSLSerialWriteSingle(mlsl_handle, pdata->addr,
				       MPUREG_USER_CTRL,
				       ((userCtrlReg & (~BIT_FIFO_EN))
						|   BIT_FIFO_RST));
	ERROR_CHECK(result);

	result = MLSLSerialWriteSingle(mlsl_handle, pdata->addr,
				       MPUREG_USER_CTRL, userCtrlReg);
	ERROR_CHECK(result);

	result = MLSLSerialRead(mlsl_handle, pdata->addr,
				MPUREG_USER_CTRL, 1, &userCtrlReg);
	ERROR_CHECK(result);

	if (pdata->dmp_enable)
		userCtrlReg |= BIT_DMP_EN;
	else
		userCtrlReg &= ~BIT_DMP_EN;

	if (pdata->fifo_enable)
		userCtrlReg |= BIT_FIFO_EN;
	else
		userCtrlReg &= ~BIT_FIFO_EN;

	userCtrlReg |= BIT_DMP_RST;

	result = MLSLSerialWriteSingle(mlsl_handle, pdata->addr,
				       MPUREG_USER_CTRL, userCtrlReg);
	ERROR_CHECK(result);
	pdata->dmp_is_running = pdata->dmp_enable;

	return result;
}
开发者ID:Amin-jkr,项目名称:android_kernel_semc_msm8660-1,代码行数:50,代码来源:mldl_cfg.c


示例10: lsm303dlha_resume

int lsm303dlha_resume(void *mlsl_handle,
		      struct ext_slave_descr *slave,
		      struct ext_slave_platform_data *pdata)
{
	int result = ML_SUCCESS;
	unsigned char reg;

	result =
	    MLSLSerialRead(mlsl_handle, pdata->address, ACCEL_ST_SLEEP_REG,
			   1, &reg);
	ERROR_CHECK(result);
	reg |= 0x27;
	/*wake up if sleeping */
	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address,
				  ACCEL_ST_SLEEP_REG, reg);
	ERROR_CHECK(result);

	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address, 0x20, 0x37);
	ERROR_CHECK(result);
	MLOSSleep(500);

	reg = 0x40;

	/* Full Scale */
	reg &= ~ACCEL_ST_CTRL_MASK;
	if (slave->range.mantissa == 2
	    && slave->range.fraction == 480) {
		reg |= 0x00;
	} else if (slave->range.mantissa == 4
		   && slave->range.fraction == 960) {
		reg |= 0x10;
	} else if (slave->range.mantissa == 8
		   && slave->range.fraction == 1920) {
		reg |= 0x30;
	}
	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address, 0x23, reg);
	ERROR_CHECK(result);

	/* Configure high pass filter */
	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address, 0x21, 0x0F);
	ERROR_CHECK(result);
	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address, 0x32, 0x00);
	ERROR_CHECK(result);
	/* Configure INT1_DURATION */
	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address, 0x33, 0x7F);
	ERROR_CHECK(result);
	/* Configure INT1_CFG */
	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address, 0x30, 0x95);
	ERROR_CHECK(result);
	MLOSSleep(50);
	return result;
}
开发者ID:KaZoom,项目名称:buildroot-linux-kernel-m3,代码行数:59,代码来源:lsm303a.c


示例11: cma3000_suspend

int cma3000_suspend(void *mlsl_handle,
			struct ext_slave_descr *slave,
			struct ext_slave_platform_data *pdata)
{
	int result;
	/* RAM reset */
	result =
		MLSLSerialWriteSingle(mlsl_handle, pdata->address, 0x1d, 0xcd);
	return result;
}
开发者ID:marcOcram,项目名称:Acer-Liquid-MT-Gingerbread-Kernel,代码行数:10,代码来源:cma3000.c


示例12: bma250_resume

static int bma250_resume(void * mlsl_handle,
		struct ext_slave_descr *slave,
		struct ext_slave_platform_data *pdata)
{

	int result;
	unsigned char reg = 0;

	/* Soft reset */
	result = MLSLSerialWriteSingle(mlsl_handle, pdata->address, 0x14, 0xb6 );		  /* BMA250 : Software reset */
	ERROR_CHECK(result);
	MLOSSleep(10);

	result = MLSLSerialRead(mlsl_handle, pdata->address, ACCEL_BMA250_CTRL_REG, 1, &reg);
	ERROR_CHECK(result);

	/* BMA250 : Full Scale */
	reg &= ~ACCEL_BMA250_CTRL_MASK;
	reg |= 0x00;

	if (slave->range.mantissa==2) {
		reg |= 0x03;
	} else if (slave->range.mantissa==4) {
		reg |= 0x05;
	} else if (slave->range.mantissa==8) {
		reg |= 0x08;
	}

	result = MLSLSerialWriteSingle(mlsl_handle, pdata->address, ACCEL_BMA250_CTRL_REG, reg );
	ERROR_CHECK(result);

	result = MLSLSerialRead(mlsl_handle, pdata->address, ACCEL_BMA250_BW_REG, 1, &reg);
	ERROR_CHECK(result);
	reg &= ~ACCEL_BMA250_BW_MASK;
	reg |= 0x00;

	/* BMA250: Bandwidth */
	reg |= 0x0d;	  // bw=250
	result = MLSLSerialWriteSingle(mlsl_handle, pdata->address, ACCEL_BMA250_BW_REG, reg );
	ERROR_CHECK(result);

	return result;
}
开发者ID:SerenityS,项目名称:IM-A800S_Kernel,代码行数:43,代码来源:bma250.c


示例13: kxtf9_resume

static int kxtf9_resume(void *mlsl_handle,
			struct ext_slave_descr *slave,
			struct ext_slave_platform_data *pdata)
{
	int result = ML_SUCCESS;
	unsigned char reg;

	printk("accelerometer sensor resume : kxtf9_resume\n");

	/* RAM reset */
	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address, 0x1d, 0xcd);
	ERROR_CHECK(result);
	MLOSSleep(10);
	/* Wake up */
	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address, 0x1b, 0x42);
	ERROR_CHECK(result);
	/* INT_CTRL_REG1: */
	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address, 0x1e, 0x14);
	ERROR_CHECK(result);
	/* WUF_THRESH: */
	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address, 0x5a, 0x00);
	ERROR_CHECK(result);
	/* DATA_CTRL_REG */
	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address, 0x21, 0x04);
	ERROR_CHECK(result);
	/* WUF_TIMER */
	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address, 0x29, 0x02);
	ERROR_CHECK(result);

	/* Full Scale */
	reg = 0xc2;
	reg &= ~ACCEL_KIONIX_CTRL_MASK;
	reg |= 0x00;
	if (slave->range.mantissa == 4)
		reg |= 0x08;
	else if (slave->range.mantissa == 8)
		reg |= 0x10;
	else {
		slave->range.mantissa = 2;
		reg |= 0x00;
	}
	slave->range.fraction = 0;

	/* Normal operation  */
	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address, 0x1b, reg);
	ERROR_CHECK(result);
	MLOSSleep(50);

	return ML_SUCCESS;
}
开发者ID:Jb2005,项目名称:SamSung-Galaxy-Tab-10.1-Model-GT-P7510,代码行数:57,代码来源:kxtf9.c


示例14: kxsd9_suspend

static int kxsd9_suspend(void *mlsl_handle,
			 struct ext_slave_descr *slave,
			 struct ext_slave_platform_data *pdata)
{
	int result;
	/* CTRL_REGB: low-power standby mode */
	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address, 0x0d, 0x0);
	ERROR_CHECK(result);
	return result;
}
开发者ID:1yankeedt,项目名称:D710BST_FL24_Kernel,代码行数:11,代码来源:kxsd9.c


示例15: bma150_suspend

static int bma150_suspend(void *mlsl_handle,
			struct ext_slave_descr *slave,
			struct ext_slave_platform_data *pdata)
{
	int result;
	result =
		MLSLSerialWriteSingle(mlsl_handle, pdata->address, 0x0a, 0x01);
	MLOSSleep(3); /* 3 ms powerup time maximum */
	ERROR_CHECK(result);
	return result;
}
开发者ID:marcOcram,项目名称:Acer-Liquid-MT-Gingerbread-Kernel,代码行数:11,代码来源:bma150.c


示例16: lsm303dlhm_resume

int lsm303dlhm_resume(void *mlsl_handle,
		      struct ext_slave_descr *slave,
		      struct ext_slave_platform_data *pdata)
{
	int result = ML_SUCCESS;

#ifdef CONFIG_INPUT_LSM303DLH
	if (!lsm303dlh_mag_misc_data)
	{
		lsm303dlh_mag_misc_data = lsm303dlh_mag_get_instance_ext();
	}
	if (lsm303dlh_mag_misc_data)
	{
		lsm303dlh_mag_misc_data->ext_handle=mlsl_handle;
		result = lsm303dlh_mag_enable_ext(lsm303dlh_mag_misc_data);
		MLOSSleep(50);
	}
	else
	{
		pr_err("%s: lsm303dlh_mag_misc_data is NULL\n", __func__);
	}
#endif

	/* Use single measurement mode. Start at sleep state. */
	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address,
				  LSM_REG_MODE, LSM_MODE_SLEEP);
	ERROR_CHECK(result);
	/* Config normal measurement */
	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address,
				  LSM_REG_CONF_A, 0);
	ERROR_CHECK(result);
	/* Adjust gain to 320 LSB/Gauss */
	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address,
				  LSM_REG_CONF_B, LSM_CONF_B_GAIN_5_5);
	ERROR_CHECK(result);

	return result;
}
开发者ID:ibnsllam,项目名称:UbuntuTouch,代码行数:41,代码来源:lsm303m.c


示例17: ak8975_resume

int ak8975_resume(void *mlsl_handle,
		  struct ext_slave_descr *slave,
		  struct ext_slave_platform_data *pdata)
{
	int result = ML_SUCCESS;
	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address,
				  AK8975_REG_CNTL,
				  AK8975_CNTL_MODE_SINGLE_MEASUREMENT);
	ERROR_CHECK(result);
	return result;
}
开发者ID:Aaroneke,项目名称:galaxy-2636,代码行数:12,代码来源:ak8975.c


示例18: bma222_resume

static int bma222_resume(void *mlsl_handle,
			 struct ext_slave_descr *slave,
			 struct ext_slave_platform_data *pdata)
{
	int result;
	unsigned char reg = 0;

	/* Soft reset */
	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address,
				  ACCEL_BMA222_SFT_RST_REG, 0xB6);
	ERROR_CHECK(result);
	MLOSSleep(10);

	/*Bandwidth */
	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address,
				  ACCEL_BMA222_BW_REG, 0x0C);
	ERROR_CHECK(result);

	/* Full Scale */
	if (slave->range.mantissa == 4)
		reg |= 0x05;
	else if (slave->range.mantissa == 8)
		reg |= 0x08;
	else if (slave->range.mantissa == 16)
		reg |= 0x0C;
	else {
		slave->range.mantissa = 2;
		reg |= 0x03;
	}
	slave->range.fraction = 0;

	result =
	    MLSLSerialWriteSingle(mlsl_handle, pdata->address,
				  ACCEL_BMA222_RANGE_REG, reg);
	ERROR_CHECK(result);

	return result;
}
开发者ID:1yankeedt,项目名称:D710BST_FL24_Kernel,代码行数:40,代码来源:bma222.c


示例19: mma8450_resume

int mma8450_resume(void *mlsl_handle,
			struct ext_slave_descr *slave,
			struct ext_slave_platform_data *pdata)
{
	int result = ML_SUCCESS;
	unsigned char reg;

	result =
			MLSLSerialRead(mlsl_handle, pdata->address,
					ACCEL_MMA8450_CTRL_REG, 1, &reg);
	ERROR_CHECK(result);

	/* data rate = 200Hz */
	reg &= 0xE3;
	reg |= 0x4;

	/* Full Scale */
	reg &= ~ACCEL_MMA8450_CTRL_MASK;
	if (slave->range.mantissa == 4)
		reg |= 0x2;
	else if (slave->range.mantissa == 8)
		reg |= 0x3;
	else {
		slave->range.mantissa = 2;
		reg |= 0x1;
	}
	slave->range.fraction = 0;

	/* XYZ_DATA_CFG: event flag enabled on all axis */
	result =
			MLSLSerialWriteSingle(mlsl_handle, pdata->address, 0x16, 0x05);
	ERROR_CHECK(result);
	/* CTRL_REG1: rate + scale config + wakeup */
	result =
			MLSLSerialWriteSingle(mlsl_handle, pdata->address,
				ACCEL_MMA8450_CTRL_REG, reg);
	ERROR_CHECK(result);

	return result;
}
开发者ID:marcOcram,项目名称:Acer-Liquid-MT-Gingerbread-Kernel,代码行数:40,代码来源:mma8450.c


示例20: lis3dh_suspend

static int lis3dh_suspend(void *mlsl_handle,
			struct ext_slave_descr *slave,
			struct ext_slave_platform_data *pdata)
{
	int result = ML_SUCCESS;
	unsigned char reg1;
	unsigned char reg2;
	struct lis3dh_private_data *private_data = pdata->private_data;

	result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
				       LIS3DH_CTRL_REG1,
				       private_data->suspend.ctrl_reg1);

	result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
				       LIS3DH_CTRL_REG2, 0x31);
	reg1 = 0x48;
	if (private_data->suspend.fsr == 16384)
		reg1 |= 0x30;
	else if (private_data->suspend.fsr == 8192)
		reg1 |= 0x20;
	else if (private_data->suspend.fsr == 4096)
		reg1 |= 0x10;
	else if (private_data->suspend.fsr == 2048)
		reg1 |= 0x00;

	result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
				       LIS3DH_CTRL_REG4, reg1);
	result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
				       LIS3DH_INT1_THS,
				       private_data->suspend.reg_ths);
	result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
				       LIS3DH_INT1_DURATION,
				       private_data->suspend.reg_dur);

	if (private_data->suspend.irq_type == MPU_SLAVE_IRQ_TYPE_DATA_READY) {
		reg1 = 0x10;
		reg2 = 0x00;
	} else if (private_data->suspend.irq_type ==
		   MPU_SLAVE_IRQ_TYPE_MOTION) {
		reg1 = 0x40;
		reg2 = private_data->suspend.mot_int1_cfg;
	} else {
		reg1 = 0x00;
		reg2 = 0x00;
	}
	result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
				       LIS3DH_CTRL_REG3, reg1);
	result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
				       LIS3DH_INT1_CFG, reg2);
	result = MLSLSerialRead(mlsl_handle, pdata->address,
				LIS3DH_CTRL_REG6, 1, &reg1);

	return result;

}
开发者ID:amuxtux,项目名称:exynos4210,代码行数:55,代码来源:lis3dh.c



注:本文中的MLSLSerialWriteSingle函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MLT_CONSUMER_PROPERTIES函数代码示例发布时间:2022-05-30
下一篇:
C++ MLIB_IMAGE_CHECK函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap