Beta
Dependencies: ST_INTERFACES X_NUCLEO_COMMON
Fork of X_NUCLEO_IKS01A2 by
Diff: Components/LPS22HBSensor/LPS22HB_Driver.c
- Revision:
- 6:671fd10a51b7
- Parent:
- 0:cad5dab2b21d
--- a/Components/LPS22HBSensor/LPS22HB_Driver.c Thu Dec 15 14:03:46 2016 +0000 +++ b/Components/LPS22HBSensor/LPS22HB_Driver.c Tue Mar 14 13:41:32 2017 +0100 @@ -1,6 +1,6 @@ /** ******************************************************************************* - * @file LPS22HB_Driver.c + * @file LPS22HB_driver.c * @author HESA Application Team * @version V1.1 * @date 10-August-2016 @@ -36,7 +36,7 @@ */ /* Includes ------------------------------------------------------------------*/ -#include "LPS22HB_Driver.h" +#include "LPS22HB_driver.h" #ifdef USE_FULL_ASSERT_LPS22HB #include <stdio.h> #endif @@ -54,8 +54,8 @@ * @{ */ -extern uint8_t LPS22HB_IO_Write( void *handle, uint8_t WriteAddr, uint8_t *pBuffer, uint16_t nBytesToWrite ); -extern uint8_t LPS22HB_IO_Read( void *handle, uint8_t ReadAddr, uint8_t *pBuffer, uint16_t nBytesToRead ); +extern uint8_t LPS22HB_io_write( void *handle, uint8_t WriteAddr, uint8_t *pBuffer, uint16_t nBytesToWrite ); +extern uint8_t LPS22HB_io_read( void *handle, uint8_t ReadAddr, uint8_t *pBuffer, uint16_t nBytesToRead ); /** * @} @@ -82,34 +82,34 @@ */ /******************************************************************************* -* Function Name : LPS22HB_ReadReg +* Function Name : LPS22HB_read_reg * Description : Generic Reading function. It must be fullfilled with either * : I2C or SPI reading functions * Input : Register Address * Output : Data Read * Return : None *******************************************************************************/ -LPS22HB_Error_et LPS22HB_ReadReg( void *handle, uint8_t RegAddr, uint16_t NumByteToRead, uint8_t *Data ) +LPS22HB_Error_et LPS22HB_read_reg( void *handle, uint8_t RegAddr, uint16_t NumByteToRead, uint8_t *Data ) { - if ( LPS22HB_IO_Read( handle, RegAddr, Data, NumByteToRead ) ) + if ( LPS22HB_io_read( handle, RegAddr, Data, NumByteToRead ) ) return LPS22HB_ERROR; else return LPS22HB_OK; } /******************************************************************************* -* Function Name : LPS22HB_WriteReg +* Function Name : LPS22HB_write_reg * Description : Generic Writing function. It must be fullfilled with either * : I2C or SPI writing function * Input : Register Address, Data to be written * Output : None * Return : None *******************************************************************************/ -LPS22HB_Error_et LPS22HB_WriteReg( void *handle, uint8_t RegAddr, uint16_t NumByteToWrite, uint8_t *Data ) +LPS22HB_Error_et LPS22HB_write_reg( void *handle, uint8_t RegAddr, uint16_t NumByteToWrite, uint8_t *Data ) { - if ( LPS22HB_IO_Write( handle, RegAddr, Data, NumByteToWrite ) ) + if ( LPS22HB_io_write( handle, RegAddr, Data, NumByteToWrite ) ) return LPS22HB_ERROR; else return LPS22HB_OK; @@ -123,7 +123,7 @@ */ LPS22HB_Error_et LPS22HB_Get_DeviceID(void *handle, uint8_t* deviceid) { - if(LPS22HB_ReadReg(handle, LPS22HB_WHO_AM_I_REG, 1, deviceid)) + if(LPS22HB_read_reg(handle, LPS22HB_WHO_AM_I_REG, 1, deviceid)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -135,11 +135,11 @@ * @param None * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK] */ -LPS22HB_Error_et LPS22HB_Get_DriverVersion(LPS22HB_DriverVersion_st *Version) +LPS22HB_Error_et LPS22HB_Get_DriverVersion(LPS22HB_driverVersion_st *Version) { - Version->Major = LPS22HB_DriverVersion_Major; - Version->Minor = LPS22HB_DriverVersion_Minor; - Version->Point = LPS22HB_DriverVersion_Point; + Version->Major = LPS22HB_driverVersion_Major; + Version->Minor = LPS22HB_driverVersion_Minor; + Version->Point = LPS22HB_driverVersion_Point; return LPS22HB_OK; } @@ -157,13 +157,13 @@ LPS22HB_assert_param(IS_LPS22HB_PowerMode(mode)); - if(LPS22HB_ReadReg(handle, LPS22HB_RES_CONF_REG, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_RES_CONF_REG, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_LCEN_MASK; tmp |= (uint8_t)mode; - if(LPS22HB_WriteReg(handle, LPS22HB_RES_CONF_REG, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_RES_CONF_REG, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -179,7 +179,7 @@ { uint8_t tmp; - if(LPS22HB_ReadReg(handle, LPS22HB_RES_CONF_REG, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_RES_CONF_REG, 1, &tmp)) return LPS22HB_ERROR; *mode = (LPS22HB_PowerMode_et)(tmp & LPS22HB_LCEN_MASK); @@ -201,13 +201,13 @@ LPS22HB_assert_param(IS_LPS22HB_ODR(odr)); - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_ODR_MASK; tmp |= (uint8_t)odr; - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -223,7 +223,7 @@ { uint8_t tmp; - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) return LPS22HB_ERROR; *odr = (LPS22HB_Odr_et)(tmp & LPS22HB_ODR_MASK); @@ -243,14 +243,14 @@ LPS22HB_assert_param(IS_LPS22HB_State(state)); - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_LPFP_MASK; tmp |= ((uint8_t)state)<<LPS22HB_LPFP_BIT; - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) return LPS22HB_ERROR; @@ -270,7 +270,7 @@ LPS22HB_assert_param(IS_LPS22HB_LPF_Cutoff(cutoff)); - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_LPFP_CUTOFF_MASK; @@ -278,7 +278,7 @@ - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) return LPS22HB_ERROR; @@ -302,14 +302,14 @@ LPS22HB_assert_param(IS_LPS22HB_BDUMode(bdu)); - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_BDU_MASK; tmp |= ((uint8_t)bdu); - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) return LPS22HB_OK; return LPS22HB_OK; @@ -325,7 +325,7 @@ { uint8_t tmp; - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) return LPS22HB_ERROR; *bdu = (LPS22HB_Bdu_et)(tmp & LPS22HB_BDU_MASK); @@ -346,13 +346,13 @@ LPS22HB_assert_param(IS_LPS22HB_SPIMode(spimode)); - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_SIM_MASK; tmp |= (uint8_t)spimode; - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -371,14 +371,14 @@ LPS22HB_assert_param(IS_LPS22HB_CTE(mode)); - if(LPS22HB_ReadReg(handle, LPS22HB_CLOCK_TREE_CONFIGURATION, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CLOCK_TREE_CONFIGURATION, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_CTE_MASK; tmp |= (uint8_t)mode; - if(LPS22HB_WriteReg(handle, LPS22HB_CLOCK_TREE_CONFIGURATION, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CLOCK_TREE_CONFIGURATION, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -395,7 +395,7 @@ { uint8_t tmp; - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) return LPS22HB_ERROR; *spimode = (LPS22HB_SPIMode_et)(tmp & LPS22HB_SIM_MASK); @@ -412,12 +412,12 @@ { uint8_t tmp; - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) return LPS22HB_ERROR; tmp |= (0x01<<LPS22HB_SW_RESET_BIT); - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -433,12 +433,12 @@ { uint8_t tmp; - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) return LPS22HB_ERROR; tmp |= (0x01<<LPS22HB_BOOT_BIT); - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -455,12 +455,12 @@ { uint8_t tmp; - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) return LPS22HB_ERROR; tmp |= ((0x01<<LPS22HB_SW_RESET_BIT) | (0x01<<LPS22HB_BOOT_BIT)); - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -479,13 +479,13 @@ LPS22HB_assert_param(IS_LPS22HB_State(status)); - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_FIFO_EN_MASK; tmp |= ((uint8_t)status)<<LPS22HB_FIFO_EN_BIT; - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -502,13 +502,13 @@ LPS22HB_assert_param(IS_LPS22HB_State(status)); - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_WTM_EN_MASK; tmp |= ((uint8_t)status)<<LPS22HB_WTM_EN_BIT; - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -526,13 +526,13 @@ LPS22HB_assert_param(IS_LPS22HB_State(status)); - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_ADD_INC_MASK; tmp |= (((uint8_t)status)<<LPS22HB_ADD_INC_BIT); - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -551,14 +551,14 @@ LPS22HB_assert_param(IS_LPS22HB_State(statei2c)); - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) return LPS22HB_ERROR; /*Reset Bit->I2C Enabled*/ tmp &= ~LPS22HB_I2C_MASK; tmp|=((uint8_t)~statei2c)<<LPS22HB_I2C_BIT; - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -576,14 +576,14 @@ { uint8_t tmp; - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) return LPS22HB_ERROR; /* Set the one shot bit */ /* Once the measurement is done, one shot bit will self-clear*/ tmp |= LPS22HB_ONE_SHOT_MASK; - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -602,13 +602,13 @@ LPS22HB_assert_param(IS_LPS22HB_InterruptActiveLevel(mode)); - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_INT_H_L_MASK; tmp |= ((uint8_t)mode); - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -627,13 +627,13 @@ LPS22HB_assert_param(IS_LPS22HB_OutputType(output)); - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_PP_OD_MASK; tmp |= (uint8_t)output; - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -651,13 +651,13 @@ LPS22HB_assert_param(IS_LPS22HB_OutputSignal(config)); - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~(LPS22HB_INT_S12_MASK); tmp |= (uint8_t)config; - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -677,13 +677,13 @@ LPS22HB_assert_param(IS_LPS22HB_State(status)); - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_DRDY_MASK; tmp |= ((uint8_t)status)<<LPS22HB_DRDY_BIT; - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -702,13 +702,13 @@ LPS22HB_assert_param(IS_LPS22HB_State(status)); - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_FIFO_OVR_MASK; tmp |= ((uint8_t)status)<<LPS22HB_FIFO_OVR_BIT; - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -726,13 +726,13 @@ LPS22HB_assert_param(IS_LPS22HB_State(status)); - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_FIFO_FTH_MASK; tmp |= ((uint8_t)status)<<LPS22HB_FIFO_FTH_BIT; - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -750,13 +750,13 @@ LPS22HB_assert_param(IS_LPS22HB_State(status)); - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_FIFO_FULL_MASK; tmp |= ((uint8_t)status)<<LPS22HB_FIFO_FULL_BIT; - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -776,12 +776,12 @@ { uint8_t tmp; - if(LPS22HB_ReadReg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) return LPS22HB_ERROR; tmp |= ((uint8_t)LPS22HB_AUTORIFP_MASK); - if(LPS22HB_WriteReg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -797,13 +797,13 @@ { uint8_t tmp; - if(LPS22HB_ReadReg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) return LPS22HB_ERROR; tmp |= ((uint8_t)LPS22HB_RESET_ARP_MASK); - if(LPS22HB_WriteReg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -820,12 +820,12 @@ { uint8_t tmp; - if(LPS22HB_ReadReg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) return LPS22HB_ERROR; tmp |= LPS22HB_AUTOZERO_MASK; - if(LPS22HB_WriteReg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -842,14 +842,14 @@ { uint8_t tmp; - if(LPS22HB_ReadReg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) return LPS22HB_ERROR; /* Set the RESET_AZ bit*/ /* RESET_AZ is self cleared*/ tmp |= LPS22HB_RESET_AZ_MASK; - if(LPS22HB_WriteReg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) return LPS22HB_ERROR; @@ -869,13 +869,13 @@ LPS22HB_assert_param(IS_LPS22HB_State(diff_en)); - if(LPS22HB_ReadReg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_DIFF_EN_MASK; tmp |= ((uint8_t)diff_en)<<LPS22HB_DIFF_EN_BIT; - if(LPS22HB_WriteReg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -892,7 +892,7 @@ { uint8_t tmp; - if(LPS22HB_ReadReg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) return LPS22HB_ERROR; *diff_en= (LPS22HB_State_et)((tmp & LPS22HB_DIFF_EN_MASK)>>LPS22HB_DIFF_EN_BIT); @@ -912,13 +912,13 @@ LPS22HB_assert_param(IS_LPS22HB_State(status)); - if(LPS22HB_ReadReg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_LIR_MASK; tmp |= (((uint8_t)status)<<LPS22HB_LIR_BIT); - if(LPS22HB_WriteReg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -938,13 +938,13 @@ LPS22HB_assert_param(IS_LPS22HB_State(status)); - if(LPS22HB_ReadReg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_PLE_MASK; tmp |= (((uint8_t)status)<<LPS22HB_PLE_BIT); - if(LPS22HB_WriteReg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -962,13 +962,13 @@ LPS22HB_assert_param(IS_LPS22HB_State(status)); - if(LPS22HB_ReadReg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_PHE_MASK; tmp |= (((uint8_t)status)<<LPS22HB_PHE_BIT); - if(LPS22HB_WriteReg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -985,7 +985,7 @@ { uint8_t tmp; - if(LPS22HB_ReadReg(handle, LPS22HB_INTERRUPT_SOURCE_REG, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_INTERRUPT_SOURCE_REG, 1, &tmp)) return LPS22HB_ERROR; interruptsource->PH = (uint8_t)(tmp & LPS22HB_PH_MASK); @@ -1006,7 +1006,7 @@ { uint8_t tmp; - if(LPS22HB_ReadReg(handle, LPS22HB_STATUS_REG, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_STATUS_REG, 1, &tmp)) return LPS22HB_ERROR; datastatus->PressDataAvailable = (uint8_t)(tmp & LPS22HB_PDA_MASK); @@ -1033,7 +1033,7 @@ uint32_t tmp = 0; uint8_t i; - if(LPS22HB_ReadReg(handle, LPS22HB_PRESS_OUT_XL_REG, 3, buffer)) + if(LPS22HB_read_reg(handle, LPS22HB_PRESS_OUT_XL_REG, 3, buffer)) return LPS22HB_ERROR; /* Build the raw data */ @@ -1082,7 +1082,7 @@ uint8_t buffer[2]; uint16_t tmp; - if(LPS22HB_ReadReg(handle, LPS22HB_TEMP_OUT_L_REG, 2, buffer)) + if(LPS22HB_read_reg(handle, LPS22HB_TEMP_OUT_L_REG, 2, buffer)) return LPS22HB_ERROR; /* Build the raw tmp */ @@ -1125,7 +1125,7 @@ { uint8_t tempReg[2]; - if(LPS22HB_ReadReg(handle, LPS22HB_THS_P_LOW_REG, 2, tempReg)) + if(LPS22HB_read_reg(handle, LPS22HB_THS_P_LOW_REG, 2, tempReg)) return LPS22HB_ERROR; *P_ths= (((((uint16_t)tempReg[1])<<8) + tempReg[0])/16); @@ -1147,7 +1147,7 @@ buffer[0] = (uint8_t)(16 * P_ths); buffer[1] = (uint8_t)(((uint16_t)(16 * P_ths))>>8); - if(LPS22HB_WriteReg(handle, LPS22HB_THS_P_LOW_REG, 2, buffer)) + if(LPS22HB_write_reg(handle, LPS22HB_THS_P_LOW_REG, 2, buffer)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -1165,13 +1165,13 @@ LPS22HB_assert_param(IS_LPS22HB_FifoMode(fifomode)); - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_FIFO_REG, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_FIFO_REG, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_FIFO_MODE_MASK; tmp |= (uint8_t)fifomode; - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_FIFO_REG, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_FIFO_REG, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -1187,7 +1187,7 @@ { uint8_t tmp; - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_FIFO_REG, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_FIFO_REG, 1, &tmp)) return LPS22HB_ERROR; tmp &= LPS22HB_FIFO_MODE_MASK; @@ -1208,13 +1208,13 @@ LPS22HB_assert_param(IS_LPS22HB_WtmLevel(wtmlevel)); - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_FIFO_REG, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_FIFO_REG, 1, &tmp)) return LPS22HB_ERROR; tmp &= ~LPS22HB_WTM_POINT_MASK; tmp |= wtmlevel; - if(LPS22HB_WriteReg(handle, LPS22HB_CTRL_FIFO_REG, 1, &tmp)) + if(LPS22HB_write_reg(handle, LPS22HB_CTRL_FIFO_REG, 1, &tmp)) return LPS22HB_ERROR; return LPS22HB_OK; @@ -1228,7 +1228,7 @@ */ LPS22HB_Error_et LPS22HB_Get_FifoWatermarkLevel(void *handle, uint8_t *wtmlevel) { - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_FIFO_REG, 1, wtmlevel)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_FIFO_REG, 1, wtmlevel)) return LPS22HB_ERROR; *wtmlevel &= LPS22HB_WTM_POINT_MASK; @@ -1246,7 +1246,7 @@ { uint8_t tmp; - if(LPS22HB_ReadReg(handle, LPS22HB_STATUS_FIFO_REG, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_STATUS_FIFO_REG, 1, &tmp)) return LPS22HB_ERROR; status->FIFO_FTH = (uint8_t)((tmp & LPS22HB_FTH_FIFO_MASK)>>LPS22HB_FTH_FIFO_BIT); @@ -1278,7 +1278,7 @@ uint8_t buffer[2]; int16_t raw_press; - if(LPS22HB_ReadReg(handle, LPS22HB_RPDS_L_REG, 2, buffer)) + if(LPS22HB_read_reg(handle, LPS22HB_RPDS_L_REG, 2, buffer)) return LPS22HB_ERROR; raw_press = (int16_t)((((uint16_t)buffer[1]) << 8) + (uint16_t)buffer[0]); @@ -1303,7 +1303,7 @@ int32_t raw_press; uint8_t i; - if(LPS22HB_ReadReg(handle, LPS22HB_REF_P_XL_REG, 3, buffer)) + if(LPS22HB_read_reg(handle, LPS22HB_REF_P_XL_REG, 3, buffer)) return LPS22HB_ERROR; /* Build the raw data */ @@ -1333,7 +1333,7 @@ uint8_t tmp; LPS22HB_DataStatus_st datastatus; - if(LPS22HB_ReadReg(handle, LPS22HB_STATUS_REG, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_STATUS_REG, 1, &tmp)) return LPS22HB_ERROR; datastatus.TempDataAvailable=(uint8_t)((tmp&LPS22HB_TDA_MASK)>>LPS22HB_TDA_BIT); @@ -1488,7 +1488,7 @@ return LPS22HB_ERROR; /*Read LPS22HB_CTRL_REG1*/ - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG1, 1, &tmp)) return LPS22HB_ERROR; pxLPS22HBInit->OutputDataRate= (LPS22HB_Odr_et)(tmp & LPS22HB_ODR_MASK); @@ -1498,7 +1498,7 @@ pxLPS22HBInit->LPF_Cutoff=(LPS22HB_LPF_Cutoff_et)(tmp& LPS22HB_LPFP_CUTOFF_MASK); /*Read LPS22HB_CTRL_REG2*/ - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) return LPS22HB_ERROR; pxLPS22HBInit->IfAddInc=(LPS22HB_State_et)((tmp& LPS22HB_ADD_INC_MASK)>>LPS22HB_ADD_INC_BIT); @@ -1625,7 +1625,7 @@ uint8_t tmp; /*Read LPS22HB_CTRL_REG3*/ - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG3, 1, &tmp)) return LPS22HB_ERROR; pLPS22HBInt->INT_H_L= (LPS22HB_InterruptActiveLevel_et)(tmp & LPS22HB_INT_H_L_MASK); @@ -1637,7 +1637,7 @@ pLPS22HBInt->FIFO_FULL=(LPS22HB_State_et)((tmp& LPS22HB_FIFO_FULL_MASK)>>LPS22HB_FIFO_FULL_BIT); /*Read LPS22HB_INTERRUPT_CFG_REG*/ - if(LPS22HB_ReadReg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_INTERRUPT_CFG_REG, 1, &tmp)) return LPS22HB_ERROR; pLPS22HBInt->LatchIRQ= (LPS22HB_State_et)((tmp& LPS22HB_LIR_MASK)>>LPS22HB_LIR_BIT); @@ -1685,7 +1685,7 @@ /*Set Fifo Watermark Level*/ if(LPS22HB_Set_FifoWatermarkLevel(handle, pLPS22HBFIFO->WTM_LEVEL)) return LPS22HB_ERROR; - /* Force->Enable FIFO Treshold interrupt on INT_DRDY pin. */ + /* Force->enable FIFO Treshold interrupt on INT_DRDY pin. */ if(LPS22HB_Set_FIFO_FTH_Interrupt(handle, LPS22HB_ENABLE)) return LPS22HB_ERROR; } @@ -1707,7 +1707,7 @@ { uint8_t tmp; - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_FIFO_REG, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_FIFO_REG, 1, &tmp)) return LPS22HB_ERROR; /*!< Fifo Mode Selection */ @@ -1716,7 +1716,7 @@ /*!< FIFO threshold/Watermark level selection*/ pLPS22HBFIFO->WTM_LEVEL= (uint8_t)(tmp& LPS22HB_WTM_POINT_MASK); - if(LPS22HB_ReadReg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) + if(LPS22HB_read_reg(handle, LPS22HB_CTRL_REG2, 1, &tmp)) return LPS22HB_ERROR; /*!< Enable/Disable the watermark interrupt*/