49#if (LPS25H_USE_I2C) || defined(__DOXYGEN__)
64 uint8_t reg, uint8_t* rxbuf,
size_t n) {
69 return i2cMasterTransmitTimeout(i2cp, sad, &txbuf, 1, rxbuf, n,
88 uint8_t* txbuf,
size_t n) {
91 return i2cMasterTransmitTimeout(i2cp, sad, txbuf, n + 1, NULL, 0,
130 osalDbgCheck((ip != NULL) && (axes != NULL));
136 "baro_read_raw(), invalid state");
138 osalDbgAssert((devp->config->i2cp->state == I2C_READY),
139 "baro_read_raw(), channel not ready");
142 i2cAcquireBus(devp->config->i2cp);
143 i2cStart(devp->config->i2cp,
144 devp->config->i2ccfg);
151 i2cReleaseBus(devp->config->i2cp);
155 *axes = buff[0] + (buff[1] << 8) + (buff[2] << 16);
182 osalDbgCheck((ip != NULL) && (axes != NULL));
188 "baro_read_cooked(), invalid state");
192 *axes = (raw * devp->barosensitivity) - devp->barobias;
216 osalDbgCheck((ip != NULL) && (bp != NULL));
222 "baro_set_bias(), invalid state");
224 devp->barobias = *bp;
242 osalDbgCheck(ip != NULL);
248 "baro_reset_bias(), invalid state");
270 osalDbgCheck((ip != NULL) && (sp != NULL));
276 "baro_set_sensitivity(), invalid state");
278 devp->barosensitivity = *sp;
295 osalDbgCheck(ip != NULL);
301 "baro_reset_sensitivity(), invalid state");
342 osalDbgCheck((ip != NULL) && (axes != NULL));
348 "thermo_read_raw(), invalid state");
350 osalDbgAssert((devp->config->i2cp->state == I2C_READY),
351 "thermo_read_raw(), channel not ready");
354 i2cAcquireBus(devp->config->i2cp);
355 i2cStart(devp->config->i2cp,
356 devp->config->i2ccfg);
363 i2cReleaseBus(devp->config->i2cp);
367 tmp = buff[0] + (buff[1] << 8);
368 *axes = (int32_t)tmp;
395 osalDbgCheck((ip != NULL) && (axis != NULL));
401 "thermo_read_cooked(), invalid state");
405 *axis = (raw * devp->thermosensitivity) - devp->thermobias;
426 osalDbgCheck((ip != NULL) && (bp != NULL));
432 "thermo_set_bias(), invalid state");
434 devp->thermobias = *bp;
453 osalDbgCheck(ip != NULL);
459 "thermo_reset_bias(), invalid state");
482 osalDbgCheck((ip != NULL) && (sp != NULL));
488 "thermo_set_sensitivity(), invalid state");
490 devp->thermosensitivity = *sp;
508 osalDbgCheck(ip != NULL);
514 "thermo_reset_sensitivity(), invalid state");
574 osalDbgCheck((devp != NULL) && (config != NULL));
577 "lps25hStart(), invalid state");
579 devp->config = config;
585#if LPS25H_USE_ADVANCED || defined(__DOXYGEN__)
586 cr[1] |= devp->config->bdu;
591 i2cAcquireBus((devp)->config->
i2cp);
593 i2cStart((devp)->config->
i2cp,
594 (devp)->config->i2ccfg);
599 i2cReleaseBus((devp)->config->
i2cp);
606#if LPS25H_USE_ADVANCED || defined(__DOXYGEN__)
607 cr[1] = devp->config->baroresolution | devp->config->thermoresolution;
612 i2cAcquireBus((devp)->config->
i2cp);
613 i2cStart((devp)->config->
i2cp,
614 (devp)->config->i2ccfg);
621 i2cReleaseBus((devp)->config->
i2cp);
624 if(devp->config->barosensitivity == NULL) {
629 devp->barosensitivity = *(devp->config->barosensitivity);
632 if(devp->config->barobias == NULL) {
637 devp->barobias = *(devp->config->barobias);
640 if(devp->config->thermosensitivity == NULL) {
645 devp->thermosensitivity = *(devp->config->thermosensitivity);
648 if(devp->config->thermobias == NULL) {
653 devp->thermobias = *(devp->config->thermobias);
657 osalThreadSleepMilliseconds(5);
672 osalDbgCheck(devp != NULL);
675 "lps25hStop(), invalid state");
679 i2cAcquireBus((devp)->config->i2cp);
680 i2cStart((devp)->config->i2cp,
681 (devp)->config->i2ccfg);
689 i2cStop((devp)->config->i2cp);
691 i2cReleaseBus((devp)->config->i2cp);
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.
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
static const struct BaseBarometerVMT vmt_barometer
static msg_t baro_reset_sensitivity(void *ip)
Reset sensitivity values for the BaseBarometer.
static msg_t baro_set_sensitivity(void *ip, float *sp)
Set sensitivity values for the BaseBarometer.
static msg_t thermo_reset_sensitivity(void *ip)
Reset sensitivity values for the BaseThermometer.
static msg_t lps25hI2CWriteRegister(I2CDriver *i2cp, lps25h_sad_t sad, uint8_t *txbuf, size_t n)
Writes a value into a register using I2C.
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.
static msg_t baro_reset_bias(void *ip)
Reset bias values for the BaseBarometer.
#define LPS25H_AD_CTRL_REG1
#define LPS25H_BARO_NUMBER_OF_AXES
LPS25H barometer subsystem characteristics.
static msg_t thermo_set_bias(void *ip, float *bp)
Set bias values for the BaseThermometer.
#define LPS25H_AD_RES_CONF
static msg_t thermo_read_raw(void *ip, int32_t axes[])
Retrieves raw data from the BaseThermometer.
static msg_t baro_reset_sensitivity(void *ip)
Reset sensitivity values for the BaseBarometer.
#define LPS25H_THERMO_NUMBER_OF_AXES
LPS25H thermometer subsystem characteristics.
void lps25hObjectInit(LPS25HDriver *devp)
Initializes an instance.
void lps25hStart(LPS25HDriver *devp, const LPS25HConfig *config)
Configures and activates LPS25H Complex Driver peripheral.
#define LPS25H_THERMO_BIAS
lps25h_sad_t
LPS25H slave address.
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 LPS25H_AD_PRESS_OUT_XL
static size_t thermo_get_axes_number(void *ip)
Return the number of axes of the BaseThermometer.
static msg_t baro_set_sensitivity(void *ip, float *sp)
Set sensitivity values for the BaseBarometer.
void lps25hStop(LPS25HDriver *devp)
Deactivates the LPS25H Complex Driver peripheral.
static msg_t thermo_read_cooked(void *ip, float *axis)
Retrieves cooked data from the BaseThermometer.
#define LPS25H_THERMO_SENS
#define LPS25H_AD_TEMP_OUT_L
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.
#define LPS25H_CTRL_REG1_PD
static msg_t lps25hI2CReadRegister(I2CDriver *i2cp, lps25h_sad_t sad, uint8_t reg, uint8_t *rxbuf, size_t n)
Reads registers value using I2C.
LPS25H 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.
LPS25H configuration structure.
I2CDriver * i2cp
I2C driver associated to this LPS25H.
LPS25H 2-axis barometer/thermometer class.
BaseBarometer baro_if
Base barometer interface.
const struct LPS25HVMT * vmt
Virtual Methods Table.
BaseThermometer thermo_if
Base thermometer interface.
LPS25H virtual methods table.