ChibiOS  19.1.4
Collaboration diagram for LPS22HB:

Detailed Description

Macros

#define lps22hbI2CWriteRegister(i2cp, sad, txbuf, n)
 Writes a value into a register using I2C. More...
 
#define lps22hbBarometerGetAxesNumber(devp)   barometerGetAxesNumber(&((devp)->baro_if))
 Return the number of axes of the BaseBarometer. More...
 
#define lps22hbBarometerReadRaw(devp, axes)   barometerReadRaw(&((devp)->baro_if), axes)
 Retrieves raw data from the BaseBarometer. More...
 
#define lps22hbBarometerReadCooked(devp, axes)   barometerReadCooked(&((devp)->baro_if), axes)
 Retrieves cooked data from the BaseBarometer. More...
 
#define lps22hbBarometerSetBias(devp, bp)   barometerSetBias(&((devp)->baro_if), bp)
 Set bias values for the BaseBarometer. More...
 
#define lps22hbBarometerResetBias(devp)   barometerResetBias(&((devp)->baro_if))
 Reset bias values for the BaseBarometer. More...
 
#define lps22hbBarometerSetSensitivity(devp, sp)   barometerSetSensitivity(&((devp)->baro_if), sp)
 Set sensitivity values for the BaseBarometer. More...
 
#define lps22hbBarometerResetSensitivity(devp)   barometerResetSensitivity(&((devp)->baro_if))
 Reset sensitivity values for the BaseBarometer. More...
 
#define lps22hbThermometerGetAxesNumber(devp)   thermometerGetAxesNumber(&((devp)->thermo_if))
 Return the number of axes of the BaseThermometer. More...
 
#define lps22hbThermometerReadRaw(devp, axes)   thermometerReadRaw(&((devp)->thermo_if), axes)
 Retrieves raw data from the BaseThermometer. More...
 
#define lps22hbThermometerReadCooked(devp, axes)   thermometerReadCooked(&((devp)->thermo_if), axes)
 Retrieves cooked data from the BaseThermometer. More...
 
#define lps22hbThermometerSetBias(devp, bp)   thermometerSetBias(&((devp)->thermo_if), bp)
 Set bias values for the BaseThermometer. More...
 
#define lps22hbThermometerResetBias(devp)   thermometerResetBias(&((devp)->thermo_if))
 Reset bias values for the BaseThermometer. More...
 
#define lps22hbThermometerSetSensitivity(devp, sp)   thermometerSetSensitivity(&((devp)->thermo_if), sp)
 Set sensitivity values for the BaseThermometer. More...
 
#define lps22hbThermometerResetSensitivity(devp)   thermometerResetSensitivity(&((devp)->thermo_if))
 Reset sensitivity values for the BaseThermometer. More...
 

Version identification

#define EX_LPS22HB_VERSION   "1.0.2"
 LPS22HB driver version string. More...
 
#define EX_LPS22HB_MAJOR   1
 LPS22HB driver version major number. More...
 
#define EX_LPS22HB_MINOR   0
 LPS22HB driver version minor number. More...
 
#define EX_LPS22HB_PATCH   2
 LPS22HB driver version patch number. More...
 
#define LPS22HB_BARO_NUMBER_OF_AXES   1U
 LPS22HB barometer subsystem characteristics. More...
 
#define LPS22HB_THERMO_NUMBER_OF_AXES   1U
 LPS22HB thermometer subsystem characteristics. More...
 

LPS22HB communication interfaces related bit masks

#define LPS22HB_DI_MASK   0xFF
 
#define LPS22HB_DI(n)   (1 << n)
 
#define LPS22HB_AD_MASK   0x3F
 
#define LPS22HB_AD(n)   (1 << n)
 
#define LPS22HB_MS   (1 << 6)
 
#define LPS22HB_RW   (1 << 7)
 
#define LPS22HB_SUB_MS   (1 << 7)
 

LPS22HB register addresses

#define LPS22HB_AD_INT_CFG   0x0B
 
#define LPS22HB_AD_THS_P_L   0x0C
 
#define LPS22HB_AD_THS_P_H   0x0D
 
#define LPS22HB_AD_WHO_AM_I   0x0F
 
#define LPS22HB_AD_CTRL_REG1   0x10
 
#define LPS22HB_AD_CTRL_REG2   0x11
 
#define LPS22HB_AD_CTRL_REG3   0x12
 
#define LPS22HB_AD_FIFO_CTRL   0x14
 
#define LPS22HB_AD_REF_P_XL   0x15
 
#define LPS22HB_AD_REF_P_L   0x16
 
#define LPS22HB_AD_REF_P_H   0x17
 
#define LPS22HB_AD_RPDS_L   0x18
 
#define LPS22HB_AD_RPDS_H   0x19
 
#define LPS22HB_AD_RES_CONF   0x1A
 
#define LPS22HB_AD_INT_SRC   0x25
 
#define LPS22HB_AD_FIFO_SRC   0x26
 
#define LPS22HB_AD_STATUS_REG   0x27
 
#define LPS22HB_AD_PRESS_OUT_XL   0x28
 
#define LPS22HB_AD_PRESS_OUT_L   0x29
 
#define LPS22HB_AD_PRESS_OUT_H   0x2A
 
#define LPS22HB_AD_TEMP_OUT_L   0x2B
 
#define LPS22HB_AD_TEMP_OUT_H   0x2C
 
#define LPS22HB_AD_LPFP_RES   0x33
 

LPS22HB_INT_CFG register bits definitions

#define LPS22HB_INT_CFG_MASK   0xFF
 
#define LPS22HB_INT_CFG_PHE   (1 << 0)
 
#define LPS22HB_INT_CFG_PLE   (1 << 1)
 
#define LPS22HB_INT_CFG_LIR   (1 << 2)
 
#define LPS22HB_INT_CFG_DIFF_EN   (1 << 3)
 
#define LPS22HB_INT_CFG_RESET_AZ   (1 << 4)
 
#define LPS22HB_INT_CFG_AUTOZERO   (1 << 5)
 
#define LPS22HB_INT_CFG_RESET_ARP   (1 << 6)
 
#define LPS22HB_INT_CFG_AUTORIFP   (1 << 7)
 

LPS22HB_CTRL_REG1 register bits definitions

#define LPS22HB_CTRL_REG1_MASK   0x7F
 
#define LPS22HB_CTRL_REG1_SIM   (1 << 0)
 
#define LPS22HB_CTRL_REG1_BDU   (1 << 1)
 
#define LPS22HB_CTRL_REG1_LPFP_CFG   (1 << 2)
 
#define LPS22HB_CTRL_REG1_LPFP_EN   (1 << 3)
 
#define LPS22HB_CTRL_REG1_ODR0   (1 << 4)
 
#define LPS22HB_CTRL_REG1_ODR1   (1 << 5)
 
#define LPS22HB_CTRL_REG1_ODR2   (1 << 6)
 

LPS22HB_CTRL_REG2 register bits definitions

#define LPS22HB_CTRL_REG2_MASK   0xFD
 
#define LPS22HB_CTRL_REG2_ONE_SHOT   (1 << 0)
 
#define LPS22HB_CTRL_REG2_SWRESET   (1 << 2)
 
#define LPS22HB_CTRL_REG2_I2C_DIS   (1 << 3)
 
#define LPS22HB_CTRL_REG2_IF_ADD_INC   (1 << 4)
 
#define LPS22HB_CTRL_REG2_STOP_ON_FTH   (1 << 5)
 
#define LPS22HB_CTRL_REG2_FIFO_EN   (1 << 6)
 
#define LPS22HB_CTRL_REG2_BOOT   (1 << 7)
 

LPS22HB_CTRL_REG3 register bits definitions

#define LPS22HB_CTRL_REG3_MASK   0xFF
 
#define LPS22HB_CTRL_REG3_INT_S1   (1 << 0)
 
#define LPS22HB_CTRL_REG3_INT_S2   (1 << 1)
 
#define LPS22HB_CTRL_REG3_DRDY   (1 << 2)
 
#define LPS22HB_CTRL_REG3_F_OVR   (1 << 3)
 
#define LPS22HB_CTRL_REG3_F_FTH   (1 << 4)
 
#define LPS22HB_CTRL_REG3_F_FSS5   (1 << 5)
 
#define LPS22HB_CTRL_REG3_PP_OD   (1 << 6)
 
#define LPS22HB_CTRL_REG3_INT_H_L   (1 << 7)
 

LPS22HB_INT_SRC register bits definitions

#define LPS22HB_INT_SRC_MASK   0x87
 
#define LPS22HB_INT_SRC_PH   (1 << 0)
 
#define LPS22HB_INT_SRC_PL   (1 << 1)
 
#define LPS22HB_INT_SRC_IA   (1 << 2)
 
#define LPS22HB_INT_SRC_BOOT_STATUS   (1 << 8)
 

Configuration options

#define LPS22HB_USE_SPI   FALSE
 LPS22HB SPI interface switch. More...
 
#define LPS22HB_SHARED_SPI   FALSE
 LPS22HB shared SPI switch. More...
 
#define LPS22HB_USE_I2C   TRUE
 LPS22HB I2C interface switch. More...
 
#define LPS22HB_SHARED_I2C   FALSE
 LPS22HB shared I2C switch. More...
 
#define LPS22HB_USE_ADVANCED   FALSE
 LPS22HB advanced configurations switch. More...
 

LPS22HB data structures and types.

Todo:
Add support for LPS22HB over SPI.
typedef struct LPS22HBDriver LPS22HBDriver
 Structure representing a LPS22HB driver. More...
 
#define _lps22hb_methods_alone
 LPS22HB specific methods. More...
 
#define _lps22hb_methods
 LPS22HB specific methods with inherited ones. More...
 
#define _lps22hb_data
 LPS22HBDriver specific data. More...
 

Data Structures

struct  LPS22HBConfig
 LPS22HB configuration structure. More...
 
struct  LPS22HBVMT
 LPS22HB virtual methods table. More...
 
struct  LPS22HBDriver
 LPS22HB 2-axis barometer/thermometer class. More...
 

Functions

static msg_t lps22hbI2CReadRegister (I2CDriver *i2cp, lps22hb_sad_t sad, uint8_t reg, uint8_t *rxbuf, size_t n)
 Reads registers value using I2C. More...
 
static size_t baro_get_axes_number (void *ip)
 Return the number of axes of the BaseBarometer. More...
 
static msg_t baro_read_raw (void *ip, int32_t axes[])
 Retrieves raw data from the BaseBarometer. More...
 
static msg_t baro_read_cooked (void *ip, float axes[])
 Retrieves cooked data from the BaseBarometer. More...
 
static msg_t baro_set_bias (void *ip, float *bp)
 Set bias values for the BaseBarometer. More...
 
static msg_t baro_reset_bias (void *ip)
 Reset bias values for the BaseBarometer. More...
 
static msg_t baro_set_sensitivity (void *ip, float *sp)
 Set sensitivity values for the BaseBarometer. More...
 
static msg_t baro_reset_sensitivity (void *ip)
 Reset sensitivity values for the BaseBarometer. More...
 
static size_t thermo_get_axes_number (void *ip)
 Return the number of axes of the BaseThermometer. More...
 
static msg_t thermo_read_raw (void *ip, int32_t axes[])
 Retrieves raw data from the BaseThermometer. More...
 
static msg_t thermo_read_cooked (void *ip, float *axis)
 Retrieves cooked data from the BaseThermometer. More...
 
static msg_t thermo_set_bias (void *ip, float *bp)
 Set bias values for the BaseThermometer. More...
 
static msg_t thermo_reset_bias (void *ip)
 Reset bias values for the BaseThermometer. More...
 
static msg_t thermo_set_sensitivity (void *ip, float *sp)
 Set sensitivity values for the BaseThermometer. More...
 
static msg_t thermo_reset_sensitivity (void *ip)
 Reset sensitivity values for the BaseThermometer. More...
 
void lps22hbObjectInit (LPS22HBDriver *devp)
 Initializes an instance. More...
 
void lps22hbStart (LPS22HBDriver *devp, const LPS22HBConfig *config)
 Configures and activates LPS22HB Complex Driver peripheral. More...
 
void lps22hbStop (LPS22HBDriver *devp)
 Deactivates the LPS22HB Complex Driver peripheral. More...
 

Macro Definition Documentation

#define lps22hbI2CWriteRegister (   i2cp,
  sad,
  txbuf,
 
)
Value:
i2cMasterTransmitTimeout(i2cp, sad, txbuf, n + 1, NULL, 0, \
msg_t i2cMasterTransmitTimeout(I2CDriver *i2cp, i2caddr_t addr, const uint8_t *txbuf, size_t txbytes, uint8_t *rxbuf, size_t rxbytes, sysinterval_t timeout)
Sends data via the I2C bus.
Definition: hal_i2c.c:170
#define TIME_INFINITE
Infinite interval specification for all functions with a timeout specification.
Definition: chtime.h:55

Writes a value into a register using I2C.

Precondition
The I2C interface must be initialized and the driver started.
Parameters
[in]i2cppointer to the I2C interface
[in]sadslave address without R bit
[in]txbufbuffer containing sub-address value in first position and values to write
[in]nsize of txbuf less one (not considering the first element)
Returns
the operation status.
Function Class:Not an API, this function is for internal use only.

Definition at line 84 of file lps22hb.c.

Referenced by lps22hbStart(), and lps22hbStop().

#define EX_LPS22HB_VERSION   "1.0.2"

LPS22HB driver version string.

Definition at line 46 of file lps22hb.h.

#define EX_LPS22HB_MAJOR   1

LPS22HB driver version major number.

Definition at line 51 of file lps22hb.h.

#define EX_LPS22HB_MINOR   0

LPS22HB driver version minor number.

Definition at line 56 of file lps22hb.h.

#define EX_LPS22HB_PATCH   2

LPS22HB driver version patch number.

Definition at line 61 of file lps22hb.h.

#define LPS22HB_BARO_NUMBER_OF_AXES   1U

LPS22HB barometer subsystem characteristics.

Note
Sensitivity is expressed as hPa/LSB whereas hPa stand for hectopascal.
Bias is expressed as hPa.

Definition at line 72 of file lps22hb.h.

Referenced by baro_get_axes_number(), and lps22hbObjectInit().

#define LPS22HB_THERMO_NUMBER_OF_AXES   1U

LPS22HB thermometer subsystem characteristics.

Note
Sensitivity is expressed as °C/LSB.
Bias is expressed as °C.

Definition at line 85 of file lps22hb.h.

Referenced by lps22hbObjectInit(), and thermo_get_axes_number().

#define LPS22HB_USE_SPI   FALSE

LPS22HB SPI interface switch.

If set to TRUE the support for SPI is included.

Note
The default is FALSE.

Definition at line 217 of file lps22hb.h.

#define LPS22HB_SHARED_SPI   FALSE

LPS22HB shared SPI switch.

If set to TRUE the device acquires SPI bus ownership on each transaction.

Note
The default is FALSE. Requires SPI_USE_MUTUAL_EXCLUSION.

Definition at line 227 of file lps22hb.h.

#define LPS22HB_USE_I2C   TRUE

LPS22HB I2C interface switch.

If set to TRUE the support for I2C is included.

Note
The default is TRUE.

Definition at line 236 of file lps22hb.h.

#define LPS22HB_SHARED_I2C   FALSE

LPS22HB shared I2C switch.

If set to TRUE the device acquires I2C bus ownership on each transaction.

Note
The default is FALSE. Requires I2C_USE_MUTUAL_EXCLUSION.

Definition at line 246 of file lps22hb.h.

#define LPS22HB_USE_ADVANCED   FALSE

LPS22HB advanced configurations switch.

If set to TRUE more configurations are available.

Note
The default is FALSE.

Definition at line 255 of file lps22hb.h.

#define _lps22hb_methods_alone

LPS22HB specific methods.

Note
No methods so far, just a common ancestor interface.

Definition at line 414 of file lps22hb.h.

#define _lps22hb_methods
Value:
#define _lps22hb_methods_alone
LPS22HB specific methods.
Definition: lps22hb.h:414

LPS22HB specific methods with inherited ones.

Definition at line 419 of file lps22hb.h.

#define _lps22hb_data
Value:
/* Driver state.*/ \
/* Current configuration data.*/ \
const LPS22HBConfig *config; \
/* Barometer subsystem axes number.*/ \
size_t baroaxes; \
/* Barometer subsystem current sensitivity.*/ \
float barosensitivity; \
/* Barometer subsystem current bias .*/ \
float barobias; \
/* Thermometer subsystem axes number.*/ \
size_t thermoaxes; \
/* Thermometer subsystem current sensitivity.*/ \
float thermosensitivity; \
/* Thermometer subsystem current bias.*/ \
float thermobias;
lps22hb_state_t
Driver state machine possible states.
Definition: lps22hb.h:343
LPS22HB configuration structure.
Definition: lps22hb.h:352

LPS22HBDriver specific data.

Definition at line 435 of file lps22hb.h.

#define lps22hbBarometerGetAxesNumber (   devp)    barometerGetAxesNumber(&((devp)->baro_if))

Return the number of axes of the BaseBarometer.

Parameters
[in]devppointer to LPS22HBDriver.
Returns
the number of axes.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 480 of file lps22hb.h.

#define lps22hbBarometerReadRaw (   devp,
  axes 
)    barometerReadRaw(&((devp)->baro_if), axes)

Retrieves raw data from the BaseBarometer.

Note
This data is retrieved from MEMS register without any algebraical manipulation.
The axes array must be at least the same size of the BaseBarometer axes number.
Parameters
[in]devppointer to LPS22HBDriver.
[out]axesa buffer which would be filled with raw data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 501 of file lps22hb.h.

#define lps22hbBarometerReadCooked (   devp,
  axes 
)    barometerReadCooked(&((devp)->baro_if), axes)

Retrieves cooked data from the BaseBarometer.

Note
This data is manipulated according to the formula cooked = (raw * sensitivity) - bias.
Final data is expressed as hPa.
The axes array must be at least the same size of the BaseBarometer axes number.
Parameters
[in]devppointer to LPS22HBDriver.
[out]axesa buffer which would be filled with cooked data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 523 of file lps22hb.h.

#define lps22hbBarometerSetBias (   devp,
  bp 
)    barometerSetBias(&((devp)->baro_if), bp)

Set bias values for the BaseBarometer.

Note
Bias must be expressed as hPa.
The bias buffer must be at least the same size of the BaseBarometer axes number.
Parameters
[in]devppointer to LPS22HBDriver.
[in]bpa buffer which contains biases.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 540 of file lps22hb.h.

#define lps22hbBarometerResetBias (   devp)    barometerResetBias(&((devp)->baro_if))

Reset bias values for the BaseBarometer.

Note
Default biases value are obtained from device datasheet when available otherwise they are considered zero.
Parameters
[in]devppointer to LPS22HBDriver.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 555 of file lps22hb.h.

#define lps22hbBarometerSetSensitivity (   devp,
  sp 
)    barometerSetSensitivity(&((devp)->baro_if), sp)

Set sensitivity values for the BaseBarometer.

Note
Sensitivity must be expressed as hPa/LSB.
The sensitivity buffer must be at least the same size of the BaseBarometer axes number.
Parameters
[in]devppointer to LPS22HBDriver.
[in]spa buffer which contains sensitivities.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 572 of file lps22hb.h.

#define lps22hbBarometerResetSensitivity (   devp)    barometerResetSensitivity(&((devp)->baro_if))

Reset sensitivity values for the BaseBarometer.

Note
Default sensitivities value are obtained from device datasheet.
Parameters
[in]devppointer to LPS22HBDriver.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 586 of file lps22hb.h.

#define lps22hbThermometerGetAxesNumber (   devp)    thermometerGetAxesNumber(&((devp)->thermo_if))

Return the number of axes of the BaseThermometer.

Parameters
[in]devppointer to LPS22HBDriver.
Returns
the number of axes.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 598 of file lps22hb.h.

#define lps22hbThermometerReadRaw (   devp,
  axes 
)    thermometerReadRaw(&((devp)->thermo_if), axes)

Retrieves raw data from the BaseThermometer.

Note
This data is retrieved from MEMS register without any algebraical manipulation.
The axes array must be at least the same size of the BaseThermometer axes number.
Parameters
[in]devppointer to LPS22HBDriver.
[out]axesa buffer which would be filled with raw data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 619 of file lps22hb.h.

#define lps22hbThermometerReadCooked (   devp,
  axes 
)    thermometerReadCooked(&((devp)->thermo_if), axes)

Retrieves cooked data from the BaseThermometer.

Note
This data is manipulated according to the formula cooked = (raw * sensitivity) - bias.
Final data is expressed as °C.
The axes array must be at least the same size of the BaseThermometer axes number.
Parameters
[in]devppointer to LPS22HBDriver.
[out]axesa buffer which would be filled with cooked data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 641 of file lps22hb.h.

#define lps22hbThermometerSetBias (   devp,
  bp 
)    thermometerSetBias(&((devp)->thermo_if), bp)

Set bias values for the BaseThermometer.

Note
Bias must be expressed as °C.
The bias buffer must be at least the same size of the BaseThermometer axes number.
Parameters
[in]devppointer to LPS22HBDriver.
[in]bpa buffer which contains biases.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 658 of file lps22hb.h.

#define lps22hbThermometerResetBias (   devp)    thermometerResetBias(&((devp)->thermo_if))

Reset bias values for the BaseThermometer.

Note
Default biases value are obtained from device datasheet when available otherwise they are considered zero.
Parameters
[in]devppointer to LPS22HBDriver.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 673 of file lps22hb.h.

#define lps22hbThermometerSetSensitivity (   devp,
  sp 
)    thermometerSetSensitivity(&((devp)->thermo_if), sp)

Set sensitivity values for the BaseThermometer.

Note
Sensitivity must be expressed as °C/LSB.
The sensitivity buffer must be at least the same size of the BaseThermometer axes number.
Parameters
[in]devppointer to LPS22HBDriver.
[in]spa buffer which contains sensitivities.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 690 of file lps22hb.h.

#define lps22hbThermometerResetSensitivity (   devp)    thermometerResetSensitivity(&((devp)->thermo_if))

Reset sensitivity values for the BaseThermometer.

Note
Default sensitivities value are obtained from device datasheet.
Parameters
[in]devppointer to LPS22HBDriver.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 704 of file lps22hb.h.

Typedef Documentation

typedef struct LPS22HBDriver LPS22HBDriver

Structure representing a LPS22HB driver.

Definition at line 301 of file lps22hb.h.

Enumeration Type Documentation

LPS22HB slave address.

Enumerator
LPS22HB_SAD_GND 

Slave Address when SA0 is to GND

LPS22HB_SAD_VCC 

Slave Address when SA0 is to VCC

Definition at line 306 of file lps22hb.h.

LPS22HB output data rate and bandwidth.

Enumerator
LPS22HB_ODR_PD 

Power down.

LPS22HB_ODR_1HZ 

Output data rate 1 Hz.

LPS22HB_ODR_10HZ 

Output data rate 10 Hz.

LPS22HB_ODR_25HZ 

Output data rate 25 Hz.

LPS22HB_ODR_50HZ 

Output data rate 50 Hz.

LPS22HB_ODR_75HZ 

Output data rate 75 Hz.

Definition at line 314 of file lps22hb.h.

LPS22HB pressure resolution.

Enumerator
LPS22HB_LP_DISABLED 

LP Filter disabled.

LPS22HB_LP_ODR_9 

LP Filter enabled. Cut-off ORD/9.

LPS22HB_LP_ODR_20 

LP Filter enabled. Cut-off ORD/20.

Definition at line 326 of file lps22hb.h.

LPS22HB block data update.

Enumerator
LPS22HB_BDU_CONTINUOUS 

Block data continuously updated.

LPS22HB_BDU_BLOCKED 

Block data updated after reading.

Definition at line 335 of file lps22hb.h.

Driver state machine possible states.

Enumerator
LPS22HB_UNINIT 

Not initialized.

LPS22HB_STOP 

Stopped.

LPS22HB_READY 

Ready.

Definition at line 343 of file lps22hb.h.

Function Documentation

static msg_t lps22hbI2CReadRegister ( I2CDriver i2cp,
lps22hb_sad_t  sad,
uint8_t  reg,
uint8_t *  rxbuf,
size_t  n 
)
static

Reads registers value using I2C.

Precondition
The I2C interface must be initialized and the driver started.
Parameters
[in]i2cppointer to the I2C interface
[in]sadslave address without R bit
[in]regfirst sub-register address
[out]rxbufpointer to an output buffer
[in]nnumber of consecutive register to read
Returns
the operation status.
Function Class:Not an API, this function is for internal use only.

Definition at line 63 of file lps22hb.c.

References i2cMasterTransmitTimeout(), and TIME_INFINITE.

Referenced by baro_read_raw(), and thermo_read_raw().

Here is the call graph for this function:

static size_t baro_get_axes_number ( void *  ip)
static

Return the number of axes of the BaseBarometer.

Parameters
[in]ippointer to BaseBarometer interface.
Returns
the number of axes.

Definition at line 96 of file lps22hb.c.

References LPS22HB_BARO_NUMBER_OF_AXES.

Referenced by thermo_reset_sensitivity().

static msg_t baro_read_raw ( void *  ip,
int32_t  axes[] 
)
static

Retrieves raw data from the BaseBarometer.

Note
This data is retrieved from MEMS register without any algebraical manipulation.
The axes array must be at least the same size of the BaseBarometer axes number.
Parameters
[in]ippointer to BaseBarometer interface.
[out]axesa buffer which would be filled with raw data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 118 of file lps22hb.c.

References I2C_READY, i2cAcquireBus(), i2cReleaseBus(), i2cStart(), LPS22HB_READY, lps22hbI2CReadRegister(), MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by baro_read_cooked(), and thermo_reset_sensitivity().

Here is the call graph for this function:

static msg_t baro_read_cooked ( void *  ip,
float  axes[] 
)
static

Retrieves cooked data from the BaseBarometer.

Note
This data is manipulated according to the formula cooked = (raw * sensitivity) - bias.
Final data is expressed as hPa.
The axes array must be at least the same size of the BaseBarometer axes number.
Parameters
[in]ippointer to BaseBarometer interface.
[out]axesa buffer which would be filled with cooked data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 170 of file lps22hb.c.

References baro_read_raw(), LPS22HB_READY, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by thermo_reset_sensitivity().

Here is the call graph for this function:

static msg_t baro_set_bias ( void *  ip,
float *  bp 
)
static

Set bias values for the BaseBarometer.

Note
Bias must be expressed as hPa.
The bias buffer must be at least the same size of the BaseBarometer axes number.
Parameters
[in]ippointer to BaseBarometer interface.
[in]bpa buffer which contains biases.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 205 of file lps22hb.c.

References LPS22HB_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by thermo_reset_sensitivity().

static msg_t baro_reset_bias ( void *  ip)
static

Reset bias values for the BaseBarometer.

Note
Default biases value are obtained from device datasheet when available otherwise they are considered zero.
Parameters
[in]ippointer to BaseBarometer interface.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 231 of file lps22hb.c.

References LPS22HB_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by thermo_reset_sensitivity().

static msg_t baro_set_sensitivity ( void *  ip,
float *  sp 
)
static

Set sensitivity values for the BaseBarometer.

Note
Sensitivity must be expressed as hPa/LSB.
The sensitivity buffer must be at least the same size of the BaseBarometer axes number.
Parameters
[in]ippointer to BaseBarometer interface.
[in]spa buffer which contains sensitivities.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 259 of file lps22hb.c.

References LPS22HB_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by thermo_reset_sensitivity().

static msg_t baro_reset_sensitivity ( void *  ip)
static

Reset sensitivity values for the BaseBarometer.

Note
Default sensitivities value are obtained from device datasheet.
Parameters
[in]ippointer to BaseBarometer interface.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 284 of file lps22hb.c.

References LPS22HB_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by thermo_reset_sensitivity().

static size_t thermo_get_axes_number ( void *  ip)
static

Return the number of axes of the BaseThermometer.

Parameters
[in]ippointer to BaseThermometer interface.
Returns
the number of axes.

Definition at line 307 of file lps22hb.c.

References LPS22HB_THERMO_NUMBER_OF_AXES.

Referenced by thermo_reset_sensitivity().

static msg_t thermo_read_raw ( void *  ip,
int32_t  axes[] 
)
static

Retrieves raw data from the BaseThermometer.

Note
This data is retrieved from MEMS register without any algebraical manipulation.
The axes array must be at least the same size of the BaseThermometer axes number.
Parameters
[in]ippointer to BaseThermometer interface.
[out]axesa buffer which would be filled with raw data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 329 of file lps22hb.c.

References I2C_READY, i2cAcquireBus(), i2cReleaseBus(), i2cStart(), LPS22HB_READY, lps22hbI2CReadRegister(), MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by thermo_read_cooked(), and thermo_reset_sensitivity().

Here is the call graph for this function:

static msg_t thermo_read_cooked ( void *  ip,
float *  axis 
)
static

Retrieves cooked data from the BaseThermometer.

Note
This data is manipulated according to the formula cooked = (raw * sensitivity) - bias.
Final data is expressed as °C.
The axes array must be at least the same size of the BaseThermometer axes number.
Parameters
[in]ippointer to BaseThermometer interface.
[out]axisa buffer which would be filled with cooked data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 383 of file lps22hb.c.

References LPS22HB_READY, objGetInstance, osalDbgAssert, osalDbgCheck, and thermo_read_raw().

Referenced by thermo_reset_sensitivity().

Here is the call graph for this function:

static msg_t thermo_set_bias ( void *  ip,
float *  bp 
)
static

Set bias values for the BaseThermometer.

Note
Bias must be expressed as °C.
The bias buffer must be at least the same size of the BaseThermometer axes number.
Parameters
[in]ippointer to BaseThermometer interface.
[in]bpa buffer which contains biases.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 415 of file lps22hb.c.

References LPS22HB_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by thermo_reset_sensitivity().

static msg_t thermo_reset_bias ( void *  ip)
static

Reset bias values for the BaseThermometer.

Note
Default biases value are obtained from device datasheet when available otherwise they are considered zero.
Parameters
[in]ippointer to BaseThermometer interface.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 442 of file lps22hb.c.

References LPS22HB_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by thermo_reset_sensitivity().

static msg_t thermo_set_sensitivity ( void *  ip,
float *  sp 
)
static

Set sensitivity values for the BaseThermometer.

Note
Sensitivity must be expressed as °C/LSB.
The sensitivity buffer must be at least the same size of the BaseThermometer axes number.
Parameters
[in]ippointer to BaseThermometer interface.
[in]spa buffer which contains sensitivities.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 471 of file lps22hb.c.

References LPS22HB_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by thermo_reset_sensitivity().

static msg_t thermo_reset_sensitivity ( void *  ip)
static

Reset sensitivity values for the BaseThermometer.

Note
Default sensitivities value are obtained from device datasheet.
Parameters
[in]ippointer to BaseThermometer interface.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 497 of file lps22hb.c.

References baro_get_axes_number(), baro_read_cooked(), baro_read_raw(), baro_reset_bias(), baro_reset_sensitivity(), baro_set_bias(), baro_set_sensitivity(), LPS22HB_READY, MSG_OK, objGetInstance, osalDbgAssert, osalDbgCheck, thermo_get_axes_number(), thermo_read_cooked(), thermo_read_raw(), thermo_reset_bias(), thermo_set_bias(), and thermo_set_sensitivity().

Here is the call graph for this function:

void lps22hbObjectInit ( LPS22HBDriver devp)

Initializes an instance.

Parameters
[out]devppointer to the LPS22HBDriver object
Function Class:Initializer, this function just initializes an object and can be invoked before the kernel is initialized.

Definition at line 543 of file lps22hb.c.

References LPS22HBDriver::baro_if, LPS22HB_BARO_NUMBER_OF_AXES, LPS22HB_STOP, LPS22HB_THERMO_NUMBER_OF_AXES, LPS22HBDriver::thermo_if, BaseThermometer::vmt, BaseBarometer::vmt, and LPS22HBDriver::vmt.

void lps22hbStart ( LPS22HBDriver devp,
const LPS22HBConfig config 
)

Configures and activates LPS22HB Complex Driver peripheral.

Parameters
[in]devppointer to the LPS22HBDriver object
[in]configpointer to the LPS22HBConfig object
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 565 of file lps22hb.c.

References I2CDriver::config, i2cAcquireBus(), LPS22HBConfig::i2cp, i2cReleaseBus(), i2cStart(), LPS22HB_READY, LPS22HB_STOP, lps22hbI2CWriteRegister, osalDbgAssert, osalDbgCheck, and osalThreadSleepMilliseconds.

Here is the call graph for this function:

void lps22hbStop ( LPS22HBDriver devp)

Deactivates the LPS22HB Complex Driver peripheral.

Parameters
[in]devppointer to the LPS22HBDriver object
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 659 of file lps22hb.c.

References i2cAcquireBus(), i2cReleaseBus(), i2cStart(), i2cStop(), LPS22HB_READY, LPS22HB_STOP, lps22hbI2CWriteRegister, osalDbgAssert, and osalDbgCheck.

Here is the call graph for this function: