本文整理汇总了C++中LIS3DH_ReadReg函数的典型用法代码示例。如果您正苦于以下问题:C++ LIS3DH_ReadReg函数的具体用法?C++ LIS3DH_ReadReg怎么用?C++ LIS3DH_ReadReg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LIS3DH_ReadReg函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: LIS3DH_GetTempRaw
/*******************************************************************************
* Function Name : LIS3DH_GetTempRaw
* Description : Read the Temperature Values by AUX Output Registers OUT_3_H
* Input : Buffer to empty
* Output : Temperature Values Registers buffer
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_GetTempRaw(i8_t* buff) {
u8_t valueL;
u8_t valueH;
if( !LIS3DH_ReadReg(LIS3DH_OUT_3_L, &valueL) )
return MEMS_ERROR;
if( !LIS3DH_ReadReg(LIS3DH_OUT_3_H, &valueH) )
return MEMS_ERROR;
*buff = (i8_t)( valueH );
return MEMS_SUCCESS;
}
开发者ID:janvdt,项目名称:Dash7,代码行数:21,代码来源:lis3dh_driver.c
示例2: LIS3DH_SetODR
/*******************************************************************************
* Function Name : LIS3DH_SetODR
* Description : Sets LIS3DH Output Data Rate
* Input : Output Data Rate
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_SetODR(LIS3DH_ODR_t ov){
u8_t value,value1 = 0;
if( !LIS3DH_ReadReg(LIS3DH_CTRL_REG1, &value) )
return MEMS_ERROR;
value &= 0x0f;
value |= ov<<LIS3DH_ODR_BIT;
if( !LIS3DH_WriteReg(LIS3DH_CTRL_REG1, value) )
return MEMS_ERROR;
if( !LIS3DH_ReadReg(LIS3DH_CTRL_REG1, &value1) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
开发者ID:PascalSI,项目名称:ampm_car_tracker,代码行数:22,代码来源:lis3dh_driver.c
示例3: LIS3DH_GetWHO_AM_I
/*******************************************************************************
* Function Name : LIS3DH_GetWHO_AM_I
* Description : Read identification code by WHO_AM_I register
* Input : Char to empty by Device identification Value
* Output : None
* Return : Status [value of FSS]
*******************************************************************************/
status_t LIS3DH_GetWHO_AM_I(u8_t* val){
if( !LIS3DH_ReadReg(LIS3DH_WHO_AM_I, val) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
开发者ID:janvdt,项目名称:Dash7,代码行数:14,代码来源:lis3dh_driver.c
示例4: LIS3DH_GetFifoSourceReg
/*******************************************************************************
* Function Name : LIS3DH_GetFifoSourceReg
* Description : Read Fifo source Register
* Input : Byte to empty by FIFO source register value
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_GetFifoSourceReg(u8_t* val) {
if( !LIS3DH_ReadReg(LIS3DH_FIFO_SRC_REG, val) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
开发者ID:janvdt,项目名称:Dash7,代码行数:14,代码来源:lis3dh_driver.c
示例5: LIS3DH_GetInt1Src
/*******************************************************************************
* Function Name : LIS3DH_GetInt1Src
* Description : Reset Interrupt 1 Latching function
* Input : Char to empty by Int1 source value
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_GetInt1Src(u8_t* val) {
if( !LIS3DH_ReadReg(LIS3DH_INT1_SRC, val) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
开发者ID:janvdt,项目名称:Dash7,代码行数:14,代码来源:lis3dh_driver.c
示例6: LIS3DH_Get6DPosition
/*******************************************************************************
* Function Name : LIS3DH_Get6DPosition
* Description : 6D, 4D Interrupt Position Detect
* Input : Byte to empty by POSITION_6D_t Typedef
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_Get6DPosition(u8_t* val){
u8_t value;
if( !LIS3DH_ReadReg(LIS3DH_INT1_SRC, &value) )
return MEMS_ERROR;
value &= 0x7F;
switch (value){
case LIS3DH_UP_SX:
*val = LIS3DH_UP_SX;
break;
case LIS3DH_UP_DX:
*val = LIS3DH_UP_DX;
break;
case LIS3DH_DW_SX:
*val = LIS3DH_DW_SX;
break;
case LIS3DH_DW_DX:
*val = LIS3DH_DW_DX;
break;
case LIS3DH_TOP:
*val = LIS3DH_TOP;
break;
case LIS3DH_BOTTOM:
*val = LIS3DH_BOTTOM;
break;
}
return MEMS_SUCCESS;
}
开发者ID:janvdt,项目名称:Dash7,代码行数:38,代码来源:lis3dh_driver.c
示例7: LIS3DH_GetStatusAUX
/*******************************************************************************
* Function Name : LIS3DH_GetStatusAUX
* Description : Read the AUX status register
* Input : Char to empty by status register buffer
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_GetStatusAUX(u8_t* val) {
if( !LIS3DH_ReadReg(LIS3DH_STATUS_AUX, val) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
开发者ID:janvdt,项目名称:Dash7,代码行数:14,代码来源:lis3dh_driver.c
示例8: 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;
}
开发者ID:janvdt,项目名称:Dash7,代码行数:54,代码来源:lis3dh_driver.c
示例9: LIS3DH_ResetInt1Latch
/*******************************************************************************
* Function Name : LIS3DH_ResetInt1Latch
* Description : Reset Interrupt 1 Latching function
* Input : None
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_ResetInt1Latch(void) {
u8_t value;
if( !LIS3DH_ReadReg(LIS3DH_INT1_SRC, &value) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
开发者ID:janvdt,项目名称:Dash7,代码行数:15,代码来源:lis3dh_driver.c
示例10: LIS3DH_GetFifoSourceFSS
/*******************************************************************************
* Function Name : LIS3DH_GetFifoSourceFSS
* Description : Read current number of unread samples stored in FIFO
* Input : Byte to empty by FIFO unread sample value
* Output : None
* Return : Status [value of FSS]
*******************************************************************************/
status_t LIS3DH_GetFifoSourceFSS(u8_t* val){
u8_t value;
if( !LIS3DH_ReadReg(LIS3DH_FIFO_SRC_REG, &value) )
return MEMS_ERROR;
value &= 0x1F;
*val = value;
return MEMS_SUCCESS;
}
开发者ID:janvdt,项目名称:Dash7,代码行数:19,代码来源:lis3dh_driver.c
示例11: LIS3DH_GetAccAxesRaw
/*******************************************************************************
* Function Name : LIS3DH_GetAccAxesRaw
* Description : Read the Acceleration Values Output Registers
* Input : buffer to empity by AxesRaw_t Typedef
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_GetAccAxesRaw(AxesRaw_t* buff) {
i16_t value;
u8_t *valueL = (u8_t *)(&value);
u8_t *valueH = ((u8_t *)(&value)+1);
if( !LIS3DH_ReadReg(LIS3DH_OUT_X_L, valueL) )
return MEMS_ERROR;
if( !LIS3DH_ReadReg(LIS3DH_OUT_X_H, valueH) )
return MEMS_ERROR;
buff->AXIS_X = value;
if( !LIS3DH_ReadReg(LIS3DH_OUT_Y_L, valueL) )
return MEMS_ERROR;
if( !LIS3DH_ReadReg(LIS3DH_OUT_Y_H, valueH) )
return MEMS_ERROR;
buff->AXIS_Y = value;
if( !LIS3DH_ReadReg(LIS3DH_OUT_Z_L, valueL) )
return MEMS_ERROR;
if( !LIS3DH_ReadReg(LIS3DH_OUT_Z_H, valueH) )
return MEMS_ERROR;
buff->AXIS_Z = value;
return MEMS_SUCCESS;
}
开发者ID:janvdt,项目名称:Dash7,代码行数:38,代码来源:lis3dh_driver.c
示例12: LIS3DH_GetAuxRaw
/*******************************************************************************
* Function Name : LIS3DH_GetAuxRaw
* Description : Read the Aux Values Output Registers
* Input : Buffer to empty
* Output : Aux Values Registers buffer
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_GetAuxRaw(LIS3DH_Aux123Raw_t* buff) {
u8_t valueL;
u8_t valueH;
if( !LIS3DH_ReadReg(LIS3DH_OUT_1_L, &valueL) )
return MEMS_ERROR;
if( !LIS3DH_ReadReg(LIS3DH_OUT_1_H, &valueH) )
return MEMS_ERROR;
buff->AUX_1 = (u16_t)( (valueH << 8) | valueL )/16;
if( !LIS3DH_ReadReg(LIS3DH_OUT_2_L, &valueL) )
return MEMS_ERROR;
if( !LIS3DH_ReadReg(LIS3DH_OUT_2_H, &valueH) )
return MEMS_ERROR;
buff->AUX_2 = (u16_t)( (valueH << 8) | valueL )/16;
if( !LIS3DH_ReadReg(LIS3DH_OUT_3_L, &valueL) )
return MEMS_ERROR;
if( !LIS3DH_ReadReg(LIS3DH_OUT_3_H, &valueH) )
return MEMS_ERROR;
buff->AUX_3 = (u16_t)( (valueH << 8) | valueL )/16;
return MEMS_SUCCESS;
}
开发者ID:janvdt,项目名称:Dash7,代码行数:37,代码来源:lis3dh_driver.c
示例13: 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;
}
开发者ID:janvdt,项目名称:Dash7,代码行数:21,代码来源:lis3dh_driver.c
示例14: 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;
}
开发者ID:janvdt,项目名称:Dash7,代码行数:22,代码来源:lis3dh_driver.c
示例15: LIS3DH_SetIntMode
/*******************************************************************************
* Function Name : LIS3DH_SetIntMode
* Description : Interrupt 1 Configuration mode (OR, 6D Movement, AND, 6D Position)
* Input : LIS3DH_INT_MODE_OR, LIS3DH_INT_MODE_6D_MOVEMENT, LIS3DH_INT_MODE_AND,
LIS3DH_INT_MODE_6D_POSITION
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_SetIntMode(LIS3DH_Int1Mode_t int_mode) {
u8_t value;
if( !LIS3DH_ReadReg(LIS3DH_INT1_CFG, &value) )
return MEMS_ERROR;
value &= 0x3F;
value |= (int_mode<<LIS3DH_INT_6D);
if( !LIS3DH_WriteReg(LIS3DH_INT1_CFG, value) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
开发者ID:janvdt,项目名称:Dash7,代码行数:22,代码来源:lis3dh_driver.c
示例16: LIS3DH_SetIntConfiguration
/*******************************************************************************
* Function Name : LIS3DH_SetIntConfiguration
* Description : Interrupt 1 Configuration (without LIS3DH_6D_INT)
* Input : LIS3DH_INT1_AND/OR | LIS3DH_INT1_ZHIE_ENABLE/DISABLE | LIS3DH_INT1_ZLIE_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_SetIntConfiguration(LIS3DH_Int1Conf_t ic) {
u8_t value;
if( !LIS3DH_ReadReg(LIS3DH_INT1_CFG, &value) )
return MEMS_ERROR;
value &= 0x40;
value |= ic;
if( !LIS3DH_WriteReg(LIS3DH_INT1_CFG, value) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
开发者ID:janvdt,项目名称:Dash7,代码行数:22,代码来源:lis3dh_driver.c
示例17: LIS3DH_SetADCAux
/*******************************************************************************
* Function Name : LIS3DH_SetADCAux
* Description : Sets LIS3DH Output ADC
* Input : MEMS_ENABLE, MEMS_DISABLE
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_SetADCAux(State_t state){
u8_t value;
if( !LIS3DH_ReadReg(LIS3DH_TEMP_CFG_REG, &value) )
return MEMS_ERROR;
value &= 0x7F;
value |= state<<LIS3DH_ADC_PD;
if( !LIS3DH_WriteReg(LIS3DH_TEMP_CFG_REG, value) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
开发者ID:janvdt,项目名称:Dash7,代码行数:21,代码来源:lis3dh_driver.c
示例18: LIS3DH_Int1LatchEnable
/*******************************************************************************
* Function Name : LIS3DH_Int1LatchEnable
* Description : Enable Interrupt 1 Latching function
* Input : ENABLE/DISABLE
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_Int1LatchEnable(State_t latch) {
u8_t value;
if( !LIS3DH_ReadReg(LIS3DH_CTRL_REG5, &value) )
return MEMS_ERROR;
value &= 0xF7;
value |= latch<<LIS3DH_LIR_INT1;
if( !LIS3DH_WriteReg(LIS3DH_CTRL_REG5, value) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
开发者ID:janvdt,项目名称:Dash7,代码行数:21,代码来源:lis3dh_driver.c
示例19: 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;
}
开发者ID:janvdt,项目名称:Dash7,代码行数:21,代码来源:lis3dh_driver.c
示例20: LIS3DH_SetClickCFG
/*******************************************************************************
* Function Name : LIS3DH_SetClickCFG
* Description : Set Click Interrupt config Function
* Input : LIS3DH_ZD_ENABLE/DISABLE | LIS3DH_ZS_ENABLE/DISABLE | LIS3DH_YD_ENABLE/DISABLE |
LIS3DH_YS_ENABLE/DISABLE | LIS3DH_XD_ENABLE/DISABLE | LIS3DH_XS_ENABLE/DISABLE
* example : LIS3DH_SetClickCFG( LIS3DH_ZD_ENABLE | LIS3DH_ZS_DISABLE | LIS3DH_YD_ENABLE |
LIS3DH_YS_DISABLE | LIS3DH_XD_ENABLE | LIS3DH_XS_ENABLE)
* Note : You MUST use all input variable in the argument, as example
* Output : None
* Return : Status [MEMS_ERROR, MEMS_SUCCESS]
*******************************************************************************/
status_t LIS3DH_SetClickCFG(u8_t status) {
u8_t value;
if( !LIS3DH_ReadReg(LIS3DH_CLICK_CFG, &value) )
return MEMS_ERROR;
value &= 0xC0;
value |= status;
if( !LIS3DH_WriteReg(LIS3DH_CLICK_CFG, value) )
return MEMS_ERROR;
return MEMS_SUCCESS;
}
开发者ID:janvdt,项目名称:Dash7,代码行数:25,代码来源:lis3dh_driver.c
注:本文中的LIS3DH_ReadReg函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论