Beta
Dependencies: ST_INTERFACES X_NUCLEO_COMMON
Fork of X_NUCLEO_IKS01A2 by
Diff: Components/HTS221Sensor/HTS221Sensor.cpp
- Revision:
- 6:671fd10a51b7
- Parent:
- 1:bd2a01e81e6f
- Child:
- 9:038121268b07
diff -r 63b2b4c21092 -r 671fd10a51b7 Components/HTS221Sensor/HTS221Sensor.cpp --- a/Components/HTS221Sensor/HTS221Sensor.cpp Thu Dec 15 14:03:46 2016 +0000 +++ b/Components/HTS221Sensor/HTS221Sensor.cpp Tue Mar 14 13:41:32 2017 +0100 @@ -41,7 +41,7 @@ #include "mbed.h" #include "DevI2C.h" #include "HTS221Sensor.h" -#include "HTS221_Driver.h" +#include "HTS221_driver.h" /* Class Implementation ------------------------------------------------------*/ @@ -70,7 +70,7 @@ * @param[in] init pointer to device specific initalization structure. * @retval "0" in case of success, an error code otherwise. */ -int HTS221Sensor::Init(void *init) +int HTS221Sensor::init(void *init) { /* Power down the device */ if ( HTS221_DeActivate( (void *)this ) == HTS221_ERROR ) @@ -127,7 +127,7 @@ * @param id the pointer where the ID of the device is stored * @retval 0 in case of success, an error code otherwise */ -int HTS221Sensor::ReadID(uint8_t *id) +int HTS221Sensor::read_id(uint8_t *id) { if(!id) { @@ -153,7 +153,7 @@ uint8_t tmpreg; /* Read CTRL_REG2 register */ - if (ReadReg(HTS221_CTRL_REG2, &tmpreg) != 0) + if (read_reg(HTS221_CTRL_REG2, &tmpreg) != 0) { return 1; } @@ -162,7 +162,7 @@ tmpreg |= (0x01 << HTS221_BOOT_BIT); /* Write value to MEMS CTRL_REG2 regsister */ - if (WriteReg(HTS221_CTRL_REG2, tmpreg) != 0) + if (write_reg(HTS221_CTRL_REG2, tmpreg) != 0) { return 1; } @@ -275,10 +275,10 @@ * @retval 0 in case of success * @retval 1 in case of failure */ -int HTS221Sensor::ReadReg( uint8_t reg, uint8_t *data ) +int HTS221Sensor::read_reg( uint8_t reg, uint8_t *data ) { - if ( HTS221_ReadReg( (void *)this, reg, 1, data ) == HTS221_ERROR ) + if ( HTS221_read_reg( (void *)this, reg, 1, data ) == HTS221_ERROR ) { return 1; } @@ -293,10 +293,10 @@ * @retval 0 in case of success * @retval 1 in case of failure */ -int HTS221Sensor::WriteReg( uint8_t reg, uint8_t data ) +int HTS221Sensor::write_reg( uint8_t reg, uint8_t data ) { - if ( HTS221_WriteReg( (void *)this, reg, 1, &data ) == HTS221_ERROR ) + if ( HTS221_write_reg( (void *)this, reg, 1, &data ) == HTS221_ERROR ) { return 1; } @@ -304,12 +304,12 @@ return 0; } -uint8_t HTS221_IO_Write( void *handle, uint8_t WriteAddr, uint8_t *pBuffer, uint16_t nBytesToWrite ) +uint8_t HTS221_io_write( void *handle, uint8_t WriteAddr, uint8_t *pBuffer, uint16_t nBytesToWrite ) { - return ((HTS221Sensor *)handle)->IO_Write(pBuffer, WriteAddr, nBytesToWrite); + return ((HTS221Sensor *)handle)->io_write(pBuffer, WriteAddr, nBytesToWrite); } -uint8_t HTS221_IO_Read( void *handle, uint8_t ReadAddr, uint8_t *pBuffer, uint16_t nBytesToRead ) +uint8_t HTS221_io_read( void *handle, uint8_t ReadAddr, uint8_t *pBuffer, uint16_t nBytesToRead ) { - return ((HTS221Sensor *)handle)->IO_Read(pBuffer, ReadAddr, nBytesToRead); + return ((HTS221Sensor *)handle)->io_read(pBuffer, ReadAddr, nBytesToRead); }