本文整理汇总了C++中LIS3DH_WriteReg函数的典型用法代码示例。如果您正苦于以下问题:C++ LIS3DH_WriteReg函数的具体用法?C++ LIS3DH_WriteReg怎么用?C++ LIS3DH_WriteReg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LIS3DH_WriteReg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LIS2DH_SetAct_DUR
/*
* Sleep to Wake, Return to Sleep duration
*/
status_t LIS2DH_SetAct_DUR(u8_t val)
{
if( !LIS3DH_WriteReg(LIS2DH_Act_DUR, val) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
示例2: LIS3DH_SetClickWINDOW
/*******************************************************************************
* Function Name : LIS3DH_SetClickWINDOW
* Description : Set Click Interrupt Time Window
* Input : Click-click Time Window value [0-255]
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_SetClickWINDOW(u8_t t_window) {
if( !LIS3DH_WriteReg(LIS3DH_TIME_WINDOW, t_window) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
示例3: LIS3DH_SetClickLATENCY
/*******************************************************************************
* Function Name : LIS3DH_SetClickLATENCY
* Description : Set Click Interrupt Time Latency
* Input : Click-click Time Latency value [0-255]
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_SetClickLATENCY(u8_t t_latency) {
if( !LIS3DH_WriteReg(LIS3DH_TIME_LATENCY, t_latency) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
示例4: LIS3DH_SetMode
/*******************************************************************************
* Function Name : LIS3DH_SetMode
* Description : Sets LIS3DH Operating Mode
* Input : Modality (LIS3DH_NORMAL, LIS3DH_LOW_POWER, LIS3DH_POWER_DOWN)
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_SetMode(LIS3DH_Mode_t md) {
u8_t value;
u8_t value2;
static u8_t ODR_old_value;
if( !LIS3DH_ReadReg(LIS3DH_CTRL_REG1, &value) )
return MEMS_ERROR;
if( !LIS3DH_ReadReg(LIS3DH_CTRL_REG4, &value2) )
return MEMS_ERROR;
if((value & 0xF0)==0)
value = value | (ODR_old_value & 0xF0); //if it comes from POWERDOWN
switch(md) {
case LIS3DH_POWER_DOWN:
ODR_old_value = value;
value &= 0x0F;
break;
case LIS3DH_NORMAL:
value &= 0xF7;
value |= (MEMS_RESET<<LIS3DH_LPEN);
value2 &= 0xF7;
value2 |= (MEMS_SET<<LIS3DH_HR); //set HighResolution_BIT
break;
case LIS3DH_LOW_POWER:
value &= 0xF7;
value |= (MEMS_SET<<LIS3DH_LPEN);
value2 &= 0xF7;
value2 |= (MEMS_RESET<<LIS3DH_HR); //reset HighResolution_BIT
break;
default:
return MEMS_ERROR;
}
if( !LIS3DH_WriteReg(LIS3DH_CTRL_REG1, value) )
return MEMS_ERROR;
if( !LIS3DH_WriteReg(LIS3DH_CTRL_REG4, value2) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
示例5: LIS3DH_SetInt1Threshold
/*******************************************************************************
* Function Name : LIS3DH_SetInt1Threshold
* Description : Sets Interrupt 1 Threshold
* Input : Threshold = [0,31]
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_SetInt1Threshold(u8_t ths) {
if (ths > 127)
return MEMS_ERROR;
if( !LIS3DH_WriteReg(LIS3DH_INT1_THS, ths) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
示例6: LIS3DH_SetInt1Duration
/*******************************************************************************
* Function Name : LIS3DH_SetInt1Duration
* Description : Sets Interrupt 1 Duration
* Input : Duration value
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_SetInt1Duration(LIS3DH_Int1Conf_t id) {
if (id > 127)
return MEMS_ERROR;
if( !LIS3DH_WriteReg(LIS3DH_INT1_DURATION, id) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
示例7: LIS2DH_SetAct_THS
/*
* Sleep to wake, return to Sleep activation threshold
*/
status_t LIS2DH_SetAct_THS(u8_t val)
{
if (val > 127)
return MEMS_ERROR;
if( !LIS3DH_WriteReg(LIS2DH_Act_THS, val) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
示例8: LIS3DH_SetClickTHS
/*******************************************************************************
* Function Name : LIS3DH_SetClickTHS
* Description : Set Click Interrupt threshold
* Input : Click-click Threshold value [0-127]
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_SetClickTHS(u8_t ths) {
if(ths>127)
return MEMS_ERROR;
if( !LIS3DH_WriteReg(LIS3DH_CLICK_THS, ths) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
示例9: LIS3DH_SetClickLIMIT
/*******************************************************************************
* Function Name : LIS3DH_SetClickLIMIT
* Description : Set Click Interrupt Time Limit
* Input : Click-click Time Limit value [0-127]
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_SetClickLIMIT(u8_t t_limit) {
if(t_limit>127)
return MEMS_ERROR;
if( !LIS3DH_WriteReg(LIS3DH_TIME_LIMIT, t_limit) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
示例10: LIS3DH_SetAxis
/*******************************************************************************
* Function Name : LIS3DH_SetAxis
* Description : Enable/Disable LIS3DH Axis
* Input : LIS3DH_X_ENABLE/DISABLE | LIS3DH_Y_ENABLE/DISABLE | LIS3DH_Z_ENABLE/DISABLE
* Output : None
* Note : You MUST use all input variable in the argument, as example
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_SetAxis(LIS3DH_Axis_t axis) {
u8_t value;
if( !LIS3DH_ReadReg(LIS3DH_CTRL_REG1, &value) )
return MEMS_ERROR;
value &= 0xF8;
value |= (0x07 & axis);
if( !LIS3DH_WriteReg(LIS3DH_CTRL_REG1, value) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
示例11: LIS3DH_SetInt2Pin
/*******************************************************************************
* Function Name : LIS3DH_SetInt2Pin
* Description : Set Interrupt2 pin Function
* Input : LIS3DH_CLICK_ON_PIN_INT2_ENABLE/DISABLE | LIS3DH_I2_INT1_ON_PIN_INT2_ENABLE/DISABLE |
LIS3DH_I2_INT2_ON_PIN_INT2_ENABLE/DISABLE | LIS3DH_I2_BOOT_ON_INT2_ENABLE/DISABLE |
LIS3DH_INT_ACTIVE_HIGH/LOW
* example : LIS3DH_SetInt2Pin(LIS3DH_CLICK_ON_PIN_INT2_ENABLE/DISABLE | LIS3DH_I2_INT1_ON_PIN_INT2_ENABLE/DISABLE |
LIS3DH_I2_INT2_ON_PIN_INT2_ENABLE/DISABLE | LIS3DH_I2_BOOT_ON_INT2_ENABLE/DISABLE |
LIS3DH_INT_ACTIVE_HIGH/LOW)
* Note : To enable Interrupt signals on INT2 Pad (You MUST use all input variable in the argument, as example)
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_SetInt2Pin(LIS3DH_IntPinConf_t pinConf) {
u8_t value;
if( !LIS3DH_ReadReg(LIS3DH_CTRL_REG6, &value) )
return MEMS_ERROR;
value &= 0x00;
value |= pinConf;
if( !LIS3DH_WriteReg(LIS3DH_CTRL_REG6, value) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
示例12: LIS3DH_SetHPFMode
/*******************************************************************************
* Function Name : LIS3DH_SetHPFMode
* Description : Set High Pass Filter Modality
* Input : LIS3DH_HPM_NORMAL_MODE_RES/LIS3DH_HPM_REF_SIGNAL/
LIS3DH_HPM_NORMAL_MODE/LIS3DH_HPM_AUTORESET_INT
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_SetHPFMode(LIS3DH_HPFMode_t hpm) {
u8_t value;
if( !LIS3DH_ReadReg(LIS3DH_CTRL_REG2, &value) )
return MEMS_ERROR;
value &= 0x3F;
value |= (hpm<<LIS3DH_HPM);
if( !LIS3DH_WriteReg(LIS3DH_CTRL_REG2, value) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
示例13: LIS3DH_HPFAOI2Enable
/*******************************************************************************
* Function Name : LIS3DH_HPFAOI2
* Description : Enable/Disable High Pass Filter for AOI on INT_2
* Input : MEMS_ENABLE/MEMS_DISABLE
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_HPFAOI2Enable(State_t hpfe) {
u8_t value;
if( !LIS3DH_ReadReg(LIS3DH_CTRL_REG2, &value) )
return MEMS_ERROR;
value &= 0xFD;
value |= (hpfe<<LIS3DH_HPIS2);
if( !LIS3DH_WriteReg(LIS3DH_CTRL_REG2, value) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
示例14: LIS3DH_SetSelfTest
/*******************************************************************************
* Function Name : LIS3DH_SetSelfTest
* Description : Set Self Test Modality
* Input : LIS3DH_SELF_TEST_DISABLE/ST_0/ST_1
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_SetSelfTest(LIS3DH_SelfTest_t st) {
u8_t value;
if( !LIS3DH_ReadReg(LIS3DH_CTRL_REG4, &value) )
return MEMS_ERROR;
value &= 0xF9;
value |= (st<<LIS3DH_ST);
if( !LIS3DH_WriteReg(LIS3DH_CTRL_REG4, value) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
示例15: LIS3DH_SetTriggerInt
/*******************************************************************************
* Function Name : LIS3DH_SetTriggerInt
* Description : Trigger event liked to trigger signal INT1/INT2
* Input : LIS3DH_TRIG_INT1/LIS3DH_TRIG_INT2
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_SetTriggerInt(LIS3DH_TrigInt_t tr) {
u8_t value;
if( !LIS3DH_ReadReg(LIS3DH_FIFO_CTRL_REG, &value) )
return MEMS_ERROR;
value &= 0xDF;
value |= (tr<<LIS3DH_TR);
if( !LIS3DH_WriteReg(LIS3DH_FIFO_CTRL_REG, value) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}