49#if (LPS22HB_USE_I2C) || defined(__DOXYGEN__)
64 uint8_t reg, uint8_t* rxbuf,
size_t n) {
84#define lps22hbI2CWriteRegister(i2cp, sad, txbuf, n) \
85 i2cMasterTransmitTimeout(i2cp, sad, txbuf, n + 1, NULL, 0, \
129 "baro_read_raw(), invalid state");
132 "baro_read_raw(), channel not ready");
134#if LPS22HB_SHARED_I2C
137 devp->config->i2ccfg);
143#if LPS22HB_SHARED_I2C
148 *axes = buff[0] + (buff[1] << 8) + (buff[2] << 16);
181 "baro_read_cooked(), invalid state");
185 *axes = (raw * devp->barosensitivity) - devp->barobias;
215 "baro_set_bias(), invalid state");
217 devp->barobias = *bp;
241 "baro_reset_bias(), invalid state");
269 "baro_set_sensitivity(), invalid state");
271 devp->barosensitivity = *sp;
294 "baro_reset_sensitivity(), invalid state");
341 "thermo_read_raw(), invalid state");
344 "thermo_read_raw(), channel not ready");
346#if LPS22HB_SHARED_I2C
349 devp->config->i2ccfg);
355#if LPS22HB_SHARED_I2C
360 tmp = buff[0] + (buff[1] << 8);
361 *axes = (int32_t)tmp;
394 "thermo_read_cooked(), invalid state");
398 *axis = (raw * devp->thermosensitivity) - devp->thermobias;
425 "thermo_set_bias(), invalid state");
427 devp->thermobias = *bp;
452 "thermo_reset_bias(), invalid state");
481 "thermo_set_sensitivity(), invalid state");
483 devp->thermosensitivity = *sp;
507 "thermo_reset_sensitivity(), invalid state");
570 "lps22hbStart(), invalid state");
572 devp->config = config;
580#if LPS22HB_SHARED_I2C
584 i2cStart(devp->config->i2cp, devp->config->i2ccfg);
588#if LPS22HB_SHARED_I2C
595 cr[1] = devp->config->outputdatarate;
596#if LPS22HB_USE_ADVANCED || defined(__DOXYGEN__)
597 cr[1] |= devp->config->blockdataupdate;
598 cr[1] |= devp->config->lowpass_filter;
602#if LPS22HB_SHARED_I2C
610#if LPS22HB_SHARED_I2C
614 if(devp->config->barosensitivity == NULL) {
619 devp->barosensitivity = *(devp->config->barosensitivity);
622 if(devp->config->barobias == NULL) {
627 devp->barobias = *(devp->config->barobias);
630 if(devp->config->thermosensitivity == NULL) {
635 devp->thermosensitivity = *(devp->config->thermosensitivity);
638 if(devp->config->thermobias == NULL) {
643 devp->thermobias = *(devp->config->thermobias);
665 "lps22hbStop(), invalid state");
668#if LPS22HB_SHARED_I2C
671 (devp)->config->i2ccfg);
680#if LPS22HB_SHARED_I2C
static const struct ADXL317VMT vmt_device
static msg_t baro_read_raw(void *ip, int32_t axes[])
Read baromether raw data.
static msg_t baro_reset_bias(void *ip)
Reset the barometer bias.
static msg_t thermo_set_bias(void *ip, float *bp)
Set the thermometer bias.
static msg_t thermo_read_raw(void *ip, int32_t axes[])
Read thermometer raw data.
static size_t baro_get_axes_number(void *ip)
Get the barometer number of axes.
static msg_t baro_set_bias(void *ip, float *bp)
Set the barometer bias.
static size_t thermo_get_axes_number(void *ip)
Get the thermometer number of axes.
static msg_t thermo_read_cooked(void *ip, float axes[])
Read thermometer cooked data.
static msg_t baro_read_cooked(void *ip, float axes[])
Read barometer cooked data.
static msg_t thermo_reset_bias(void *ip)
Reset the thermometer bias.
#define objGetInstance(type, ip)
Returns the instance pointer starting from an interface pointer.
static msg_t thermo_reset_sensitivity(void *ip)
Reset sensitivity values for the BaseThermometer.
static msg_t thermo_set_sensitivity(void *ip, float *sp)
Set sensitivity values for the BaseThermometer.
static const struct BaseThermometerVMT vmt_thermometer
msg_t i2cStart(I2CDriver *i2cp, const I2CConfig *config)
Configures and activates the I2C peripheral.
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.
void i2cReleaseBus(I2CDriver *i2cp)
Releases exclusive access to the I2C bus.
void i2cStop(I2CDriver *i2cp)
Deactivates the I2C peripheral.
void i2cAcquireBus(I2CDriver *i2cp)
Gains exclusive access to the I2C bus.
struct hal_i2c_driver I2CDriver
Type of a structure representing an I2C driver.
static msg_t thermo_reset_sensitivity(void *ip)
Reset sensitivity values for the BaseThermometer.
#define LPS22HB_AD_CTRL_REG2
static const struct BaseBarometerVMT vmt_barometer
static msg_t thermo_set_sensitivity(void *ip, float *sp)
Set sensitivity values for the BaseThermometer.
static msg_t baro_read_raw(void *ip, int32_t axes[])
Retrieves raw data from the BaseBarometer.
#define LPS22HB_AD_CTRL_REG1
#define LPS22HB_CTRL_REG2_IF_ADD_INC
static msg_t baro_reset_bias(void *ip)
Reset bias values for the BaseBarometer.
static msg_t thermo_set_bias(void *ip, float *bp)
Set bias values for the BaseThermometer.
#define LPS22HB_BARO_BIAS
void lps22hbObjectInit(LPS22HBDriver *devp)
Initializes an instance.
static msg_t thermo_read_raw(void *ip, int32_t axes[])
Retrieves raw data from the BaseThermometer.
#define lps22hbI2CWriteRegister(i2cp, sad, txbuf, n)
Writes a value into a register using I2C.
static msg_t baro_reset_sensitivity(void *ip)
Reset sensitivity values for the BaseBarometer.
#define LPS22HB_THERMO_BIAS
#define LPS22HB_AD_PRESS_OUT_XL
lps22hb_sad_t
LPS22HB slave address.
void lps22hbStart(LPS22HBDriver *devp, const LPS22HBConfig *config)
Configures and activates LPS22HB Complex Driver peripheral.
#define LPS22HB_BARO_SENS
static size_t baro_get_axes_number(void *ip)
Return the number of axes of the BaseBarometer.
static msg_t baro_set_bias(void *ip, float *bp)
Set bias values for the BaseBarometer.
#define LPS22HB_AD_TEMP_OUT_L
static size_t thermo_get_axes_number(void *ip)
Return the number of axes of the BaseThermometer.
static msg_t lps22hbI2CReadRegister(I2CDriver *i2cp, lps22hb_sad_t sad, uint8_t reg, uint8_t *rxbuf, size_t n)
Reads registers value using I2C.
static msg_t baro_set_sensitivity(void *ip, float *sp)
Set sensitivity values for the BaseBarometer.
#define LPS22HB_THERMO_SENS
#define LPS22HB_BARO_NUMBER_OF_AXES
LPS22HB barometer subsystem characteristics.
static msg_t thermo_read_cooked(void *ip, float *axis)
Retrieves cooked data from the BaseThermometer.
#define LPS22HB_THERMO_NUMBER_OF_AXES
LPS22HB thermometer subsystem characteristics.
static msg_t baro_read_cooked(void *ip, float axes[])
Retrieves cooked data from the BaseBarometer.
static msg_t thermo_reset_bias(void *ip)
Reset bias values for the BaseThermometer.
void lps22hbStop(LPS22HBDriver *devp)
Deactivates the LPS22HB Complex Driver peripheral.
#define osalDbgAssert(c, remark)
Condition assertion.
#define osalDbgCheck(c)
Function parameters check.
#define osalThreadSleepMilliseconds(msecs)
Delays the invoking thread for the specified number of milliseconds.
#define MSG_OK
Normal wakeup message.
#define TIME_INFINITE
Infinite interval specification for all functions with a timeout specification.
LPS22HB MEMS interface module header.
const struct BaseBarometerVMT * vmt
Virtual Methods Table.
BaseBarometer virtual methods table.
const struct BaseThermometerVMT * vmt
Virtual Methods Table.
BaseThermometer virtual methods table.
LPS22HB configuration structure.
I2CDriver * i2cp
I2C driver associated to this LPS22HB.
LPS22HB 2-axis barometer/thermometer class.
const struct LPS22HBVMT * vmt
Virtual Methods Table.
BaseBarometer baro_if
Base barometer interface.
BaseThermometer thermo_if
Base thermometer interface.
LPS22HB virtual methods table.
const I2CConfig * config
Current configuration data.