Shih-Ho Hsieh / Mbed 2 deprecated Motor_XYZ_UI_SPI_I2C_5mag

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

LPS25H Class Reference

Class representing a LPS25H sensor component. More...

#include <lps25h_class.h>

Inherits PressureSensor, and TempSensor.

Public Member Functions

 LPS25H (DevI2C &i2c, uint16_t SA0=1)
 Constructor.
virtual ~LPS25H ()
 Destructor.
virtual int init (void *init_struct)
 Initializing the component.
virtual int PowerOff (void)
 Enter sensor shutdown mode.
virtual int read_id (uint8_t *p_id)
 Getting the ID of the component.
virtual int Reset (void)
 Reset sensor.
virtual int get_pressure (float *pfData)
 Get current pressure [mbar].
virtual int get_temperature (float *pfData)
 Get current temperature in degrees Celsius [°C].
virtual int get_fahrenheit (float *pf_data)
 Get current temperature in degrees Fahrenheit [°F].

Protected Member Functions

PRESSURE_StatusTypeDef LPS25H_Init (PRESSURE_InitTypeDef *LPS25H_Init)
 Set LPS25H Initialization.
PRESSURE_StatusTypeDef LPS25H_ReadID (uint8_t *p_id)
 Read ID address of LPS25H.
PRESSURE_StatusTypeDef LPS25H_RebootCmd (void)
 Reboot memory content of LPS25H.
PRESSURE_StatusTypeDef LPS25H_GetPressure (float *pfData)
 Read LPS25H output register, and calculate the pressure in mbar.
PRESSURE_StatusTypeDef LPS25H_GetTemperature (float *pfData)
 Read LPS25H output register, and calculate the temperature.
PRESSURE_StatusTypeDef LPS25H_PowerOff (void)
 Enter the shutdown mode for LPS25H.
void LPS25H_SlaveAddrRemap (uint8_t SA0_Bit_Status)
 Set the slave address according to SA0 bit.
PRESSURE_StatusTypeDef LPS25H_PowerOn (void)
 Exit the shutdown mode for LPS25H.
PRESSURE_StatusTypeDef LPS25H_I2C_ReadRawPressure (int32_t *raw_press)
 Read LPS25H output register, and calculate the raw pressure.
PRESSURE_StatusTypeDef LPS25H_I2C_ReadRawTemperature (int16_t *raw_data)
 Read LPS25H output register, and calculate the raw temperature.
void LPS25H_IO_ITConfig (void)
 Configures LPS25H interrupt lines for NUCLEO boards.
PRESSURE_StatusTypeDef LPS25H_IO_Init (void)
 Configures LPS25H I2C interface.
PRESSURE_StatusTypeDef LPS25H_IO_Read (uint8_t *pBuffer, uint8_t RegisterAddr, uint16_t NumByteToRead)
 Utility function to read data from LPS25H.
PRESSURE_StatusTypeDef LPS25H_IO_Write (uint8_t *pBuffer, uint8_t RegisterAddr, uint16_t NumByteToWrite)
 Utility function to write data to LPS25H.

Detailed Description

Class representing a LPS25H sensor component.

Definition at line 51 of file lps25h_class.h.


Constructor & Destructor Documentation

LPS25H ( DevI2C i2c,
uint16_t  SA0 = 1 
)

Constructor.

Parameters:
[in]i2cdevice I2C to be used for communication

Definition at line 56 of file lps25h_class.h.

virtual ~LPS25H (  ) [virtual]

Destructor.

Definition at line 63 of file lps25h_class.h.


Member Function Documentation

virtual int get_fahrenheit ( float *  pf_data ) [virtual, inherited]

Get current temperature in degrees Fahrenheit [°F].

Parameters:
[out]pf_dataPointer to where to store temperature to
Returns:
0 in case of success, an error code otherwise

Definition at line 71 of file TempSensor.h.

virtual int get_pressure ( float *  pf_data ) [virtual]

Get current pressure [mbar].

Parameters:
[out]pf_dataPointer to where to store pressure to
Returns:
0 in case of success, an error code otherwise

Implements PressureSensor.

Definition at line 90 of file lps25h_class.h.

virtual int get_temperature ( float *  pf_data ) [virtual]

Get current temperature in degrees Celsius [°C].

Parameters:
[out]pf_dataPointer to where to store temperature to
Returns:
0 in case of success, an error code otherwise

Implements TempSensor.

Definition at line 94 of file lps25h_class.h.

virtual int init ( void *  init ) [virtual]

Initializing the component.

Parameters:
[in]initpointer to device specific initalization structure.
Return values:
0in case of success, an error code otherwise.

Implements Component.

Definition at line 66 of file lps25h_class.h.

PRESSURE_StatusTypeDef LPS25H_GetPressure ( float *  pfData ) [protected]

Read LPS25H output register, and calculate the pressure in mbar.

Parameters:
pfDatathe pressure value in mbar
Return values:
PRESSURE_OKin case of success, an error code otherwise

Definition at line 196 of file lps25h_class.cpp.

PRESSURE_StatusTypeDef LPS25H_GetTemperature ( float *  pfData ) [protected]

Read LPS25H output register, and calculate the temperature.

Parameters:
pfDatathe temperature value
Return values:
PRESSURE_OKin case of success, an error code otherwise

Definition at line 241 of file lps25h_class.cpp.

PRESSURE_StatusTypeDef LPS25H_I2C_ReadRawPressure ( int32_t *  raw_press ) [protected]

Read LPS25H output register, and calculate the raw pressure.

Parameters:
raw_pressthe pressure raw value
Return values:
PRESSURE_OKin case of success, an error code otherwise

Definition at line 164 of file lps25h_class.cpp.

PRESSURE_StatusTypeDef LPS25H_I2C_ReadRawTemperature ( int16_t *  raw_data ) [protected]

Read LPS25H output register, and calculate the raw temperature.

Parameters:
raw_datathe temperature raw value
Return values:
PRESSURE_OKin case of success, an error code otherwise

Definition at line 215 of file lps25h_class.cpp.

PRESSURE_StatusTypeDef LPS25H_Init ( PRESSURE_InitTypeDef LPS25H_Init ) [protected]

Set LPS25H Initialization.

Parameters:
LPS25H_Initthe configuration setting for the LPS25H
Return values:
PRESSURE_OKin case of success, an error code otherwise

Definition at line 53 of file lps25h_class.cpp.

PRESSURE_StatusTypeDef LPS25H_IO_Init ( void   ) [protected]

Configures LPS25H I2C interface.

Returns:
PRESSURE_OK in case of success, an error code otherwise

Definition at line 128 of file lps25h_class.h.

void LPS25H_IO_ITConfig ( void   ) [protected]

Configures LPS25H interrupt lines for NUCLEO boards.

Definition at line 119 of file lps25h_class.h.

PRESSURE_StatusTypeDef LPS25H_IO_Read ( uint8_t *  pBuffer,
uint8_t  RegisterAddr,
uint16_t  NumByteToRead 
) [protected]

Utility function to read data from LPS25H.

Parameters:
[out]pBufferpointer to the byte-array to read data in to
[in]RegisterAddrspecifies internal address register to read from.
[in]NumByteToReadnumber of bytes to be read.
Return values:
PRESSURE_OKif ok,
PRESSURE_ERRORif an I2C error has occured

Definition at line 141 of file lps25h_class.h.

PRESSURE_StatusTypeDef LPS25H_IO_Write ( uint8_t *  pBuffer,
uint8_t  RegisterAddr,
uint16_t  NumByteToWrite 
) [protected]

Utility function to write data to LPS25H.

Parameters:
[in]pBufferpointer to the byte-array data to send
[in]RegisterAddrspecifies internal address register to read from.
[in]NumByteToWritenumber of bytes to write.
Return values:
PRESSURE_OKif ok,
PRESSURE_ERRORif an I2C error has occured

Definition at line 162 of file lps25h_class.h.

PRESSURE_StatusTypeDef LPS25H_PowerOff ( void   ) [protected]

Enter the shutdown mode for LPS25H.

Return values:
PRESSURE_OKin case of success, an error code otherwise

Definition at line 285 of file lps25h_class.cpp.

PRESSURE_StatusTypeDef LPS25H_PowerOn ( void   ) [protected]

Exit the shutdown mode for LPS25H.

Return values:
PRESSURE_OKin case of success, an error code otherwise

Definition at line 258 of file lps25h_class.cpp.

PRESSURE_StatusTypeDef LPS25H_ReadID ( uint8_t *  p_id ) [protected]

Read ID address of LPS25H.

Parameters:
ht_idthe pointer where the ID of the device is stored
Return values:
PRESSURE_OKin case of success, an error code otherwise

Definition at line 122 of file lps25h_class.cpp.

PRESSURE_StatusTypeDef LPS25H_RebootCmd ( void   ) [protected]

Reboot memory content of LPS25H.

Return values:
PRESSURE_OKin case of success, an error code otherwise

Definition at line 136 of file lps25h_class.cpp.

void LPS25H_SlaveAddrRemap ( uint8_t  SA0_Bit_Status ) [protected]

Set the slave address according to SA0 bit.

Parameters:
SA0_Bit_StatusLPS25H_SA0_LOW or LPS25H_SA0_HIGH
Return values:
None

Definition at line 312 of file lps25h_class.cpp.

virtual int PowerOff ( void   ) [virtual]

Enter sensor shutdown mode.

Returns:
0 in case of success, an error code otherwise

Definition at line 74 of file lps25h_class.h.

virtual int read_id ( uint8_t *  id ) [virtual]

Getting the ID of the component.

Parameters:
[out]idpointer to an allocated variable to store the ID into.
Return values:
0in case of success, an error code otherwise.

Implements Component.

Definition at line 78 of file lps25h_class.h.

virtual int Reset ( void   ) [virtual]

Reset sensor.

Returns:
0 in case of success, an error code otherwise

Definition at line 86 of file lps25h_class.h.