Beta
Dependencies: ST_INTERFACES X_NUCLEO_COMMON
Fork of X_NUCLEO_IKS01A2 by
Diff: Components/LPS22HBSensor/LPS22HBSensor.cpp
- Revision:
- 9:038121268b07
- Parent:
- 6:671fd10a51b7
--- a/Components/LPS22HBSensor/LPS22HBSensor.cpp Tue Mar 14 13:56:20 2017 +0100 +++ b/Components/LPS22HBSensor/LPS22HBSensor.cpp Tue Mar 14 13:30:55 2017 +0000 @@ -50,9 +50,9 @@ * @param i2c object of an helper class which handles the I2C peripheral * @param address the address of the component's instance */ -LPS22HBSensor::LPS22HBSensor(DevI2C &i2c) : dev_i2c(i2c) +LPS22HBSensor::LPS22HBSensor(DevI2C &i2c) : _dev_i2c(i2c) { - address = LPS22HB_ADDRESS_HIGH; + _address = LPS22HB_ADDRESS_HIGH; }; @@ -60,7 +60,7 @@ * @param i2c object of an helper class which handles the I2C peripheral * @param address the address of the component's instance */ -LPS22HBSensor::LPS22HBSensor(DevI2C &i2c, uint8_t address) : dev_i2c(i2c), address(address) +LPS22HBSensor::LPS22HBSensor(DevI2C &i2c, uint8_t address) : _dev_i2c(i2c), _address(address) { }; @@ -107,8 +107,8 @@ return 1; } - isEnabled = 0; - Last_ODR = 25.0f; + _is_enabled = 0; + _last_odr = 25.0f; return 0; } @@ -118,20 +118,20 @@ * @brief Enable LPS22HB * @retval 0 in case of success, an error code otherwise */ -int LPS22HBSensor::Enable(void) +int LPS22HBSensor::enable(void) { /* Check if the component is already enabled */ - if ( isEnabled == 1 ) + if ( _is_enabled == 1 ) { return 0; } - if(Set_ODR_When_Enabled(Last_ODR) == 1) + if(Set_ODR_When_Enabled(_last_odr) == 1) { return 1; } - isEnabled = 1; + _is_enabled = 1; return 0; } @@ -140,10 +140,10 @@ * @brief Disable LPS22HB * @retval 0 in case of success, an error code otherwise */ -int LPS22HBSensor::Disable(void) +int LPS22HBSensor::disable(void) { /* Check if the component is already disabled */ - if ( isEnabled == 0 ) + if ( _is_enabled == 0 ) { return 0; } @@ -154,7 +154,7 @@ return 1; } - isEnabled = 0; + _is_enabled = 0; return 0; } @@ -185,7 +185,7 @@ * @param None * @retval 0 in case of success, an error code otherwise */ -int LPS22HBSensor::Reset(void) +int LPS22HBSensor::reset(void) { /* Read WHO AM I register */ if ( LPS22HB_MemoryBoot((void *)this) == LPS22HB_ERROR ) @@ -201,7 +201,7 @@ * @param pfData the pressure value in mbar * @retval 0 in case of success, an error code otherwise */ -int LPS22HBSensor::GetPressure(float* pfData) +int LPS22HBSensor::get_pressure(float* pfData) { int32_t int32data = 0; @@ -221,7 +221,7 @@ * @param pfData the temperature value * @retval 0 in case of success, an error code otherwise */ -int LPS22HBSensor::GetTemperature(float *pfData) +int LPS22HBSensor::get_temperature(float *pfData) { int16_t int16data = 0; @@ -241,7 +241,7 @@ * @param odr the pointer to the output data rate * @retval 0 in case of success, an error code otherwise */ -int LPS22HBSensor::Get_ODR(float* odr) +int LPS22HBSensor::get_odr(float* odr) { LPS22HB_Odr_et odr_low_level; @@ -283,9 +283,9 @@ * @param odr the output data rate to be set * @retval 0 in case of success, an error code otherwise */ -int LPS22HBSensor::Set_ODR(float odr) +int LPS22HBSensor::set_odr(float odr) { - if(isEnabled == 1) + if(_is_enabled == 1) { if(Set_ODR_When_Enabled(odr) == 1) { @@ -325,7 +325,7 @@ return 1; } - if ( Get_ODR( &Last_ODR ) == 1 ) + if ( get_odr( &_last_odr ) == 1 ) { return 1; } @@ -341,7 +341,7 @@ */ int LPS22HBSensor::Set_ODR_When_Disabled( float odr ) { - Last_ODR = ( odr <= 1.0f ) ? 1.0f + _last_odr = ( odr <= 1.0f ) ? 1.0f : ( odr <= 10.0f ) ? 10.0f : ( odr <= 25.0f ) ? 25.0f : ( odr <= 50.0f ) ? 50.0f