ChibiOS 21.11.4
lps22hb.h
Go to the documentation of this file.
1/*
2 ChibiOS - Copyright (C) 2016..2023 Rocco Marco Guglielmi
3
4 This file is part of ChibiOS.
5
6 ChibiOS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 ChibiOS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19*/
20
21/**
22 * @file lps22hb.h
23 * @brief LPS22HB MEMS interface module header.
24 *
25 * @addtogroup LPS22HB
26 * @ingroup EX_ST
27 * @{
28 */
29#ifndef _LPS22HB_H_
30#define _LPS22HB_H_
31
32#include "ex_barometer.h"
33#include "ex_thermometer.h"
34
35/*===========================================================================*/
36/* Driver constants. */
37/*===========================================================================*/
38
39/**
40 * @name Version identification
41 * @{
42 */
43/**
44 * @brief LPS22HB driver version string.
45 */
46#define EX_LPS22HB_VERSION "1.0.2"
47
48/**
49 * @brief LPS22HB driver version major number.
50 */
51#define EX_LPS22HB_MAJOR 1
52
53/**
54 * @brief LPS22HB driver version minor number.
55 */
56#define EX_LPS22HB_MINOR 0
57
58/**
59 * @brief LPS22HB driver version patch number.
60 */
61#define EX_LPS22HB_PATCH 2
62/** @} */
63
64/**
65 * @brief LPS22HB barometer subsystem characteristics.
66 * @note Sensitivity is expressed as hPa/LSB whereas hPa stand for
67 * hectopascal.
68 * @note Bias is expressed as hPa.
69 *
70 * @{
71 */
72#define LPS22HB_BARO_NUMBER_OF_AXES 1U
73
74#define LPS22HB_BARO_SENS 0.00024414f
75#define LPS22HB_BARO_BIAS 0.0f
76/** @} */
77
78/**
79 * @brief LPS22HB thermometer subsystem characteristics.
80 * @note Sensitivity is expressed as �C/LSB.
81 * @note Bias is expressed as �C.
82 *
83 * @{
84 */
85#define LPS22HB_THERMO_NUMBER_OF_AXES 1U
86
87#define LPS22HB_THERMO_SENS 0.01f
88#define LPS22HB_THERMO_BIAS 0.0f
89/** @} */
90
91/**
92 * @name LPS22HB communication interfaces related bit masks
93 * @{
94 */
95#define LPS22HB_DI_MASK 0xFF
96#define LPS22HB_DI(n) (1 << n)
97#define LPS22HB_AD_MASK 0x3F
98#define LPS22HB_AD(n) (1 << n)
99#define LPS22HB_MS (1 << 6)
100#define LPS22HB_RW (1 << 7)
101
102#define LPS22HB_SUB_MS (1 << 7)
103/** @} */
104
105/**
106 * @name LPS22HB register addresses
107 * @{
108 */
109#define LPS22HB_AD_INT_CFG 0x0B
110#define LPS22HB_AD_THS_P_L 0x0C
111#define LPS22HB_AD_THS_P_H 0x0D
112#define LPS22HB_AD_WHO_AM_I 0x0F
113#define LPS22HB_AD_CTRL_REG1 0x10
114#define LPS22HB_AD_CTRL_REG2 0x11
115#define LPS22HB_AD_CTRL_REG3 0x12
116#define LPS22HB_AD_FIFO_CTRL 0x14
117#define LPS22HB_AD_REF_P_XL 0x15
118#define LPS22HB_AD_REF_P_L 0x16
119#define LPS22HB_AD_REF_P_H 0x17
120#define LPS22HB_AD_RPDS_L 0x18
121#define LPS22HB_AD_RPDS_H 0x19
122#define LPS22HB_AD_RES_CONF 0x1A
123#define LPS22HB_AD_INT_SRC 0x25
124#define LPS22HB_AD_FIFO_SRC 0x26
125#define LPS22HB_AD_STATUS_REG 0x27
126#define LPS22HB_AD_PRESS_OUT_XL 0x28
127#define LPS22HB_AD_PRESS_OUT_L 0x29
128#define LPS22HB_AD_PRESS_OUT_H 0x2A
129#define LPS22HB_AD_TEMP_OUT_L 0x2B
130#define LPS22HB_AD_TEMP_OUT_H 0x2C
131#define LPS22HB_AD_LPFP_RES 0x33
132/** @} */
133
134/**
135 * @name LPS22HB_INT_CFG register bits definitions
136 * @{
137 */
138#define LPS22HB_INT_CFG_MASK 0xFF
139#define LPS22HB_INT_CFG_PHE (1 << 0)
140#define LPS22HB_INT_CFG_PLE (1 << 1)
141#define LPS22HB_INT_CFG_LIR (1 << 2)
142#define LPS22HB_INT_CFG_DIFF_EN (1 << 3)
143#define LPS22HB_INT_CFG_RESET_AZ (1 << 4)
144#define LPS22HB_INT_CFG_AUTOZERO (1 << 5)
145#define LPS22HB_INT_CFG_RESET_ARP (1 << 6)
146#define LPS22HB_INT_CFG_AUTORIFP (1 << 7)
147/** @} */
148
149/**
150 * @name LPS22HB_CTRL_REG1 register bits definitions
151 * @{
152 */
153#define LPS22HB_CTRL_REG1_MASK 0x7F
154#define LPS22HB_CTRL_REG1_SIM (1 << 0)
155#define LPS22HB_CTRL_REG1_BDU (1 << 1)
156#define LPS22HB_CTRL_REG1_LPFP_CFG (1 << 2)
157#define LPS22HB_CTRL_REG1_LPFP_EN (1 << 3)
158#define LPS22HB_CTRL_REG1_ODR0 (1 << 4)
159#define LPS22HB_CTRL_REG1_ODR1 (1 << 5)
160#define LPS22HB_CTRL_REG1_ODR2 (1 << 6)
161/** @} */
162
163/**
164 * @name LPS22HB_CTRL_REG2 register bits definitions
165 * @{
166 */
167#define LPS22HB_CTRL_REG2_MASK 0xFD
168#define LPS22HB_CTRL_REG2_ONE_SHOT (1 << 0)
169#define LPS22HB_CTRL_REG2_SWRESET (1 << 2)
170#define LPS22HB_CTRL_REG2_I2C_DIS (1 << 3)
171#define LPS22HB_CTRL_REG2_IF_ADD_INC (1 << 4)
172#define LPS22HB_CTRL_REG2_STOP_ON_FTH (1 << 5)
173#define LPS22HB_CTRL_REG2_FIFO_EN (1 << 6)
174#define LPS22HB_CTRL_REG2_BOOT (1 << 7)
175/** @} */
176
177/**
178 * @name LPS22HB_CTRL_REG3 register bits definitions
179 * @{
180 */
181#define LPS22HB_CTRL_REG3_MASK 0xFF
182#define LPS22HB_CTRL_REG3_INT_S1 (1 << 0)
183#define LPS22HB_CTRL_REG3_INT_S2 (1 << 1)
184#define LPS22HB_CTRL_REG3_DRDY (1 << 2)
185#define LPS22HB_CTRL_REG3_F_OVR (1 << 3)
186#define LPS22HB_CTRL_REG3_F_FTH (1 << 4)
187#define LPS22HB_CTRL_REG3_F_FSS5 (1 << 5)
188#define LPS22HB_CTRL_REG3_PP_OD (1 << 6)
189#define LPS22HB_CTRL_REG3_INT_H_L (1 << 7)
190/** @} */
191
192/**
193 * @name LPS22HB_INT_SRC register bits definitions
194 * @{
195 */
196#define LPS22HB_INT_SRC_MASK 0x87
197#define LPS22HB_INT_SRC_PH (1 << 0)
198#define LPS22HB_INT_SRC_PL (1 << 1)
199#define LPS22HB_INT_SRC_IA (1 << 2)
200#define LPS22HB_INT_SRC_BOOT_STATUS (1 << 8)
201/** @} */
202
203/*===========================================================================*/
204/* Driver pre-compile time settings. */
205/*===========================================================================*/
206
207/**
208 * @name Configuration options
209 * @{
210 */
211/**
212 * @brief LPS22HB SPI interface switch.
213 * @details If set to @p TRUE the support for SPI is included.
214 * @note The default is @p FALSE.
215 */
216#if !defined(LPS22HB_USE_SPI) || defined(__DOXYGEN__)
217#define LPS22HB_USE_SPI FALSE
218#endif
219
220/**
221 * @brief LPS22HB shared SPI switch.
222 * @details If set to @p TRUE the device acquires SPI bus ownership
223 * on each transaction.
224 * @note The default is @p FALSE. Requires SPI_USE_MUTUAL_EXCLUSION.
225 */
226#if !defined(LPS22HB_SHARED_SPI) || defined(__DOXYGEN__)
227#define LPS22HB_SHARED_SPI FALSE
228#endif
229
230/**
231 * @brief LPS22HB I2C interface switch.
232 * @details If set to @p TRUE the support for I2C is included.
233 * @note The default is @p TRUE.
234 */
235#if !defined(LPS22HB_USE_I2C) || defined(__DOXYGEN__)
236#define LPS22HB_USE_I2C TRUE
237#endif
238
239/**
240 * @brief LPS22HB shared I2C switch.
241 * @details If set to @p TRUE the device acquires I2C bus ownership
242 * on each transaction.
243 * @note The default is @p FALSE. Requires I2C_USE_MUTUAL_EXCLUSION.
244 */
245#if !defined(LPS22HB_SHARED_I2C) || defined(__DOXYGEN__)
246#define LPS22HB_SHARED_I2C FALSE
247#endif
248
249/**
250 * @brief LPS22HB advanced configurations switch.
251 * @details If set to @p TRUE more configurations are available.
252 * @note The default is @p FALSE.
253 */
254#if !defined(LPS22HB_USE_ADVANCED) || defined(__DOXYGEN__)
255#define LPS22HB_USE_ADVANCED FALSE
256#endif
257/** @} */
258
259/*===========================================================================*/
260/* Derived constants and error checks. */
261/*===========================================================================*/
262
263#if !(LPS22HB_USE_SPI ^ LPS22HB_USE_I2C)
264#error "LPS22HB_USE_SPI and LPS22HB_USE_I2C cannot be both true or both false"
265#endif
266
267#if LPS22HB_USE_SPI && !HAL_USE_SPI
268#error "LPS22HB_USE_SPI requires HAL_USE_SPI"
269#endif
270
271#if LPS22HB_SHARED_SPI && !SPI_USE_MUTUAL_EXCLUSION
272#error "LPS22HB_SHARED_SPI requires SPI_USE_MUTUAL_EXCLUSION"
273#endif
274
275#if LPS22HB_USE_I2C && !HAL_USE_I2C
276#error "LPS22HB_USE_I2C requires HAL_USE_I2C"
277#endif
278
279#if LPS22HB_SHARED_I2C && !I2C_USE_MUTUAL_EXCLUSION
280#error "LPS22HB_SHARED_I2C requires I2C_USE_MUTUAL_EXCLUSION"
281#endif
282
283/*
284 * CHTODO: Add support for LPS22HB over SPI.
285 */
286#if LPS22HB_USE_SPI
287#error "LPS22HB over SPI still not supported"
288#endif
289
290/*===========================================================================*/
291/* Driver data structures and types. */
292/*===========================================================================*/
293
294/**
295 * @name LPS22HB data structures and types.
296 * @{
297 */
298/**
299 * @brief Structure representing a LPS22HB driver.
300 */
302
303/**
304 * @brief LPS22HB slave address
305 */
306typedef enum {
307 LPS22HB_SAD_GND = 0x5C, /**< Slave Address when SA0 is to GND */
308 LPS22HB_SAD_VCC = 0x5D /**< Slave Address when SA0 is to VCC */
310
311/**
312 * @brief LPS22HB output data rate and bandwidth.
313 */
314typedef enum {
315 LPS22HB_ODR_PD = 0x00, /**< Power down. */
316 LPS22HB_ODR_1HZ = 0x10, /**< Output data rate 1 Hz. */
317 LPS22HB_ODR_10HZ = 0x20, /**< Output data rate 10 Hz. */
318 LPS22HB_ODR_25HZ = 0x30, /**< Output data rate 25 Hz. */
319 LPS22HB_ODR_50HZ = 0x40, /**< Output data rate 50 Hz. */
320 LPS22HB_ODR_75HZ = 0x50 /**< Output data rate 75 Hz. */
322
323/**
324 * @brief LPS22HB pressure resolution.
325 */
326typedef enum {
327 LPS22HB_LP_DISABLED = 0x00, /**< LP Filter disabled. */
328 LPS22HB_LP_ODR_9 = 0x08, /**< LP Filter enabled. Cut-off ORD/9. */
329 LPS22HB_LP_ODR_20 = 0x0C /**< LP Filter enabled. Cut-off ORD/20. */
331
332/**
333 * @brief LPS22HB block data update.
334 */
335typedef enum {
336 LPS22HB_BDU_CONTINUOUS = 0x00, /**< Block data continuously updated. */
337 LPS22HB_BDU_BLOCKED = 0x40 /**< Block data updated after reading. */
339
340/**
341 * @brief Driver state machine possible states.
342 */
343typedef enum {
344 LPS22HB_UNINIT = 0, /**< Not initialized. */
345 LPS22HB_STOP = 1, /**< Stopped. */
346 LPS22HB_READY = 2, /**< Ready. */
348
349/**
350 * @brief LPS22HB configuration structure.
351 */
352typedef struct {
353
354#if LPS22HB_USE_SPI || defined(__DOXYGEN__)
355 /**
356 * @brief SPI driver associated to this LPS22HB.
357 */
359 /**
360 * @brief SPI configuration associated to this LPS22HB.
361 */
363#endif /* LPS22HB_USE_SPI */
364#if LPS22HB_USE_I2C || defined(__DOXYGEN__)
365 /**
366 * @brief I2C driver associated to this LPS22HB.
367 */
369 /**
370 * @brief I2C configuration associated to this LPS22HB.
371 */
373 /**
374 * @brief LPS22HB slave address
375 */
377#endif /* LPS22HB_USE_I2C */
378 /**
379 * @brief LPS22HB barometer subsystem initial sensitivity.
380 */
382 /**
383 * @brief LPS22HB barometer subsystem initial bias.
384 */
385 float *barobias;
386 /**
387 * @brief LPS22HB thermometer subsystem initial sensitivity.
388 */
390 /**
391 * @brief LPS22HB thermometer subsystem initial bias.
392 */
394 /**
395 * @brief LPS22HB output data rate selection.
396 */
398#if LPS22HB_USE_ADVANCED || defined(__DOXYGEN__)
399 /**
400 * @brief LPS22HB block data update.
401 */
403 /**
404 * @brief LPS22HB barometer subsystem resolution.
405 */
407#endif
409
410/**
411 * @brief @p LPS22HB specific methods.
412 * @note No methods so far, just a common ancestor interface.
413 */
414#define _lps22hb_methods_alone
415
416/**
417 * @brief @p LPS22HB specific methods with inherited ones.
418 */
419#define _lps22hb_methods \
420 _base_object_methods \
421 _lps22hb_methods_alone
422
423/**
424 * @extends BaseObjectVMT
425 *
426 * @brief @p LPS22HB virtual methods table.
427 */
430};
431
432/**
433 * @brief @p LPS22HBDriver specific data.
434 */
435#define _lps22hb_data \
436 /* Driver state.*/ \
437 lps22hb_state_t state; \
438 /* Current configuration data.*/ \
439 const LPS22HBConfig *config; \
440 /* Barometer subsystem axes number.*/ \
441 size_t baroaxes; \
442 /* Barometer subsystem current sensitivity.*/ \
443 float barosensitivity; \
444 /* Barometer subsystem current bias .*/ \
445 float barobias; \
446 /* Thermometer subsystem axes number.*/ \
447 size_t thermoaxes; \
448 /* Thermometer subsystem current sensitivity.*/ \
449 float thermosensitivity; \
450 /* Thermometer subsystem current bias.*/ \
451 float thermobias;
452
453/**
454 * @brief LPS22HB 2-axis barometer/thermometer class.
455 */
457 /** @brief Virtual Methods Table.*/
458 const struct LPS22HBVMT *vmt;
459 /** @brief Base barometer interface.*/
461 /** @brief Base thermometer interface.*/
464};
465/** @} */
466
467/*===========================================================================*/
468/* Driver macros. */
469/*===========================================================================*/
470
471/**
472 * @brief Return the number of axes of the BaseBarometer.
473 *
474 * @param[in] devp pointer to @p LPS22HBDriver.
475 *
476 * @return the number of axes.
477 *
478 * @api
479 */
480#define lps22hbBarometerGetAxesNumber(devp) \
481 barometerGetAxesNumber(&((devp)->baro_if))
482
483/**
484 * @brief Retrieves raw data from the BaseBarometer.
485 * @note This data is retrieved from MEMS register without any algebraical
486 * manipulation.
487 * @note The axes array must be at least the same size of the
488 * BaseBarometer axes number.
489 *
490 * @param[in] devp pointer to @p LPS22HBDriver.
491 * @param[out] axes a buffer which would be filled with raw data.
492 *
493 * @return The operation status.
494 * @retval MSG_OK if the function succeeded.
495 * @retval MSG_RESET if one or more I2C errors occurred, the errors can
496 * be retrieved using @p i2cGetErrors().
497 * @retval MSG_TIMEOUT if a timeout occurred before operation end.
498 *
499 * @api
500 */
501#define lps22hbBarometerReadRaw(devp, axes) \
502 barometerReadRaw(&((devp)->baro_if), axes)
503
504/**
505 * @brief Retrieves cooked data from the BaseBarometer.
506 * @note This data is manipulated according to the formula
507 * cooked = (raw * sensitivity) - bias.
508 * @note Final data is expressed as hPa.
509 * @note The axes array must be at least the same size of the
510 * BaseBarometer axes number.
511 *
512 * @param[in] devp pointer to @p LPS22HBDriver.
513 * @param[out] axes a buffer which would be filled with cooked data.
514 *
515 * @return The operation status.
516 * @retval MSG_OK if the function succeeded.
517 * @retval MSG_RESET if one or more I2C errors occurred, the errors can
518 * be retrieved using @p i2cGetErrors().
519 * @retval MSG_TIMEOUT if a timeout occurred before operation end.
520 *
521 * @api
522 */
523#define lps22hbBarometerReadCooked(devp, axes) \
524 barometerReadCooked(&((devp)->baro_if), axes)
525
526/**
527 * @brief Set bias values for the BaseBarometer.
528 * @note Bias must be expressed as hPa.
529 * @note The bias buffer must be at least the same size of the
530 * BaseBarometer axes number.
531 *
532 * @param[in] devp pointer to @p LPS22HBDriver.
533 * @param[in] bp a buffer which contains biases.
534 *
535 * @return The operation status.
536 * @retval MSG_OK if the function succeeded.
537 *
538 * @api
539 */
540#define lps22hbBarometerSetBias(devp, bp) \
541 barometerSetBias(&((devp)->baro_if), bp)
542
543/**
544 * @brief Reset bias values for the BaseBarometer.
545 * @note Default biases value are obtained from device datasheet when
546 * available otherwise they are considered zero.
547 *
548 * @param[in] devp pointer to @p LPS22HBDriver.
549 *
550 * @return The operation status.
551 * @retval MSG_OK if the function succeeded.
552 *
553 * @api
554 */
555#define lps22hbBarometerResetBias(devp) \
556 barometerResetBias(&((devp)->baro_if))
557
558/**
559 * @brief Set sensitivity values for the BaseBarometer.
560 * @note Sensitivity must be expressed as hPa/LSB.
561 * @note The sensitivity buffer must be at least the same size of the
562 * BaseBarometer axes number.
563 *
564 * @param[in] devp pointer to @p LPS22HBDriver.
565 * @param[in] sp a buffer which contains sensitivities.
566 *
567 * @return The operation status.
568 * @retval MSG_OK if the function succeeded.
569 *
570 * @api
571 */
572#define lps22hbBarometerSetSensitivity(devp, sp) \
573 barometerSetSensitivity(&((devp)->baro_if), sp)
574
575/**
576 * @brief Reset sensitivity values for the BaseBarometer.
577 * @note Default sensitivities value are obtained from device datasheet.
578 *
579 * @param[in] devp pointer to @p LPS22HBDriver.
580 *
581 * @return The operation status.
582 * @retval MSG_OK if the function succeeded.
583 *
584 * @api
585 */
586#define lps22hbBarometerResetSensitivity(devp) \
587 barometerResetSensitivity(&((devp)->baro_if))
588
589/**
590 * @brief Return the number of axes of the BaseThermometer.
591 *
592 * @param[in] devp pointer to @p LPS22HBDriver.
593 *
594 * @return the number of axes.
595 *
596 * @api
597 */
598#define lps22hbThermometerGetAxesNumber(devp) \
599 thermometerGetAxesNumber(&((devp)->thermo_if))
600
601/**
602 * @brief Retrieves raw data from the BaseThermometer.
603 * @note This data is retrieved from MEMS register without any algebraical
604 * manipulation.
605 * @note The axes array must be at least the same size of the
606 * BaseThermometer axes number.
607 *
608 * @param[in] devp pointer to @p LPS22HBDriver.
609 * @param[out] axes a buffer which would be filled with raw data.
610 *
611 * @return The operation status.
612 * @retval MSG_OK if the function succeeded.
613 * @retval MSG_RESET if one or more I2C errors occurred, the errors can
614 * be retrieved using @p i2cGetErrors().
615 * @retval MSG_TIMEOUT if a timeout occurred before operation end.
616 *
617 * @api
618 */
619#define lps22hbThermometerReadRaw(devp, axes) \
620 thermometerReadRaw(&((devp)->thermo_if), axes)
621
622/**
623 * @brief Retrieves cooked data from the BaseThermometer.
624 * @note This data is manipulated according to the formula
625 * cooked = (raw * sensitivity) - bias.
626 * @note Final data is expressed as °C.
627 * @note The axes array must be at least the same size of the
628 * BaseThermometer axes number.
629 *
630 * @param[in] devp pointer to @p LPS22HBDriver.
631 * @param[out] axes a buffer which would be filled with cooked data.
632 *
633 * @return The operation status.
634 * @retval MSG_OK if the function succeeded.
635 * @retval MSG_RESET if one or more I2C errors occurred, the errors can
636 * be retrieved using @p i2cGetErrors().
637 * @retval MSG_TIMEOUT if a timeout occurred before operation end.
638 *
639 * @api
640 */
641#define lps22hbThermometerReadCooked(devp, axes) \
642 thermometerReadCooked(&((devp)->thermo_if), axes)
643
644/**
645 * @brief Set bias values for the BaseThermometer.
646 * @note Bias must be expressed as °C.
647 * @note The bias buffer must be at least the same size of the
648 * BaseThermometer axes number.
649 *
650 * @param[in] devp pointer to @p LPS22HBDriver.
651 * @param[in] bp a buffer which contains biases.
652 *
653 * @return The operation status.
654 * @retval MSG_OK if the function succeeded.
655 *
656 * @api
657 */
658#define lps22hbThermometerSetBias(devp, bp) \
659 thermometerSetBias(&((devp)->thermo_if), bp)
660
661/**
662 * @brief Reset bias values for the BaseThermometer.
663 * @note Default biases value are obtained from device datasheet when
664 * available otherwise they are considered zero.
665 *
666 * @param[in] devp pointer to @p LPS22HBDriver.
667 *
668 * @return The operation status.
669 * @retval MSG_OK if the function succeeded.
670 *
671 * @api
672 */
673#define lps22hbThermometerResetBias(devp) \
674 thermometerResetBias(&((devp)->thermo_if))
675
676/**
677 * @brief Set sensitivity values for the BaseThermometer.
678 * @note Sensitivity must be expressed as °C/LSB.
679 * @note The sensitivity buffer must be at least the same size of the
680 * BaseThermometer axes number.
681 *
682 * @param[in] devp pointer to @p LPS22HBDriver.
683 * @param[in] sp a buffer which contains sensitivities.
684 *
685 * @return The operation status.
686 * @retval MSG_OK if the function succeeded.
687 *
688 * @api
689 */
690#define lps22hbThermometerSetSensitivity(devp, sp) \
691 thermometerSetSensitivity(&((devp)->thermo_if), sp)
692
693/**
694 * @brief Reset sensitivity values for the BaseThermometer.
695 * @note Default sensitivities value are obtained from device datasheet.
696 *
697 * @param[in] devp pointer to @p LPS22HBDriver.
698 *
699 * @return The operation status.
700 * @retval MSG_OK if the function succeeded.
701 *
702 * @api
703 */
704#define lps22hbThermometerResetSensitivity(devp) \
705 thermometerResetSensitivity(&((devp)->thermo_if))
706
707/*===========================================================================*/
708/* External declarations. */
709/*===========================================================================*/
710
711#ifdef __cplusplus
712extern "C" {
713#endif
715 void lps22hbStart(LPS22HBDriver *devp, const LPS22HBConfig *config);
716 void lps22hbStop(LPS22HBDriver *devp);
717#ifdef __cplusplus
718}
719#endif
720
721#endif /* _LPS22HB_H_ */
722
723/** @} */
724
Generic barometer interface header.
Generic thermometer interface header.
struct hal_i2c_config I2CConfig
Type of a structure representing an I2C configuration.
Definition hal_i2c_lld.h:83
struct hal_i2c_driver I2CDriver
Type of a structure representing an I2C driver.
Definition hal_i2c_lld.h:88
lps22hb_lp_t
LPS22HB pressure resolution.
Definition lps22hb.h:326
void lps22hbObjectInit(LPS22HBDriver *devp)
Initializes an instance.
Definition lps22hb.c:543
lps22hb_sad_t
LPS22HB slave address.
Definition lps22hb.h:306
#define _lps22hb_data
LPS22HBDriver specific data.
Definition lps22hb.h:435
void lps22hbStart(LPS22HBDriver *devp, const LPS22HBConfig *config)
Configures and activates LPS22HB Complex Driver peripheral.
Definition lps22hb.c:565
lps22hb_bdu_t
LPS22HB block data update.
Definition lps22hb.h:335
#define _lps22hb_methods
LPS22HB specific methods with inherited ones.
Definition lps22hb.h:419
lps22hb_odr_t
LPS22HB output data rate and bandwidth.
Definition lps22hb.h:314
lps22hb_state_t
Driver state machine possible states.
Definition lps22hb.h:343
void lps22hbStop(LPS22HBDriver *devp)
Deactivates the LPS22HB Complex Driver peripheral.
Definition lps22hb.c:659
@ LPS22HB_LP_DISABLED
Definition lps22hb.h:327
@ LPS22HB_LP_ODR_20
Definition lps22hb.h:329
@ LPS22HB_LP_ODR_9
Definition lps22hb.h:328
@ LPS22HB_SAD_VCC
Definition lps22hb.h:308
@ LPS22HB_SAD_GND
Definition lps22hb.h:307
@ LPS22HB_BDU_CONTINUOUS
Definition lps22hb.h:336
@ LPS22HB_BDU_BLOCKED
Definition lps22hb.h:337
@ LPS22HB_ODR_50HZ
Definition lps22hb.h:319
@ LPS22HB_ODR_10HZ
Definition lps22hb.h:317
@ LPS22HB_ODR_75HZ
Definition lps22hb.h:320
@ LPS22HB_ODR_1HZ
Definition lps22hb.h:316
@ LPS22HB_ODR_PD
Definition lps22hb.h:315
@ LPS22HB_ODR_25HZ
Definition lps22hb.h:318
@ LPS22HB_STOP
Definition lps22hb.h:345
@ LPS22HB_READY
Definition lps22hb.h:346
@ LPS22HB_UNINIT
Definition lps22hb.h:344
struct hal_spi_config SPIConfig
Type of a SPI driver configuration structure.
Definition hal_spi_v1.h:121
struct hal_spi_driver SPIDriver
Type of a structure representing an SPI driver.
Definition hal_spi_v1.h:117
Base barometer class.
Base thermometer class.
LPS22HB configuration structure.
Definition lps22hb.h:352
float * barosensitivity
LPS22HB barometer subsystem initial sensitivity.
Definition lps22hb.h:381
const SPIConfig * spicfg
SPI configuration associated to this LPS22HB.
Definition lps22hb.h:362
lps22hb_odr_t outputdatarate
LPS22HB output data rate selection.
Definition lps22hb.h:397
float * barobias
LPS22HB barometer subsystem initial bias.
Definition lps22hb.h:385
float * thermosensitivity
LPS22HB thermometer subsystem initial sensitivity.
Definition lps22hb.h:389
float * thermobias
LPS22HB thermometer subsystem initial bias.
Definition lps22hb.h:393
SPIDriver * spip
SPI driver associated to this LPS22HB.
Definition lps22hb.h:358
lps22hb_sad_t slaveaddress
LPS22HB slave address.
Definition lps22hb.h:376
lps22hb_bdu_t blockdataupdate
LPS22HB block data update.
Definition lps22hb.h:402
I2CDriver * i2cp
I2C driver associated to this LPS22HB.
Definition lps22hb.h:368
const I2CConfig * i2ccfg
I2C configuration associated to this LPS22HB.
Definition lps22hb.h:372
lps22hb_lp_t lowpass_filter
LPS22HB barometer subsystem resolution.
Definition lps22hb.h:406
LPS22HB 2-axis barometer/thermometer class.
Definition lps22hb.h:456
const struct LPS22HBVMT * vmt
Virtual Methods Table.
Definition lps22hb.h:458
BaseBarometer baro_if
Base barometer interface.
Definition lps22hb.h:460
BaseThermometer thermo_if
Base thermometer interface.
Definition lps22hb.h:462
LPS22HB virtual methods table.
Definition lps22hb.h:428