ChibiOS  0.0.0
hts221.h
Go to the documentation of this file.
1 /*
2  ChibiOS - Copyright (C) 2016..2018 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 hts221.h
23  * @brief HTS221 MEMS interface module header.
24  *
25  *
26  * @addtogroup HTS221
27  * @ingroup EX_ST
28  * @{
29  */
30 #ifndef _HTS221_H_
31 #define _HTS221_H_
32 
33 #include "hal_hygrometer.h"
34 #include "hal_thermometer.h"
35 
36 /*===========================================================================*/
37 /* Driver constants. */
38 /*===========================================================================*/
39 
40 /**
41  * @name Version identification
42  * @{
43  */
44 /**
45  * @brief HTS221 driver version string.
46  */
47 #define EX_HTS221_VERSION "1.1.1"
48 
49 /**
50  * @brief HTS221 driver version major number.
51  */
52 #define EX_HTS221_MAJOR 1
53 
54 /**
55  * @brief HTS221 driver version minor number.
56  */
57 #define EX_HTS221_MINOR 1
58 
59 /**
60  * @brief HTS221 driver version patch number.
61  */
62 #define EX_HTS221_PATCH 1
63 /** @} */
64 
65 /**
66  * @brief HTS221 hygrometer subsystem characteristics.
67  * @note Sensitivity is expressed as %rH/LSB whereas %rH stand for percentage
68  * of relative humidity.
69  * @note Bias is expressed as %rH.
70  * @{
71  */
72 #define HTS221_HYGRO_NUMBER_OF_AXES 1U
73 
74 #define HTS221_HYGRO_SENS 0.00390625f
75 #define HTS221_HYGRO_BIAS 0.0f
76 /** @} */
77 
78 /**
79  * @brief HTS221 thermometer subsystem characteristics.
80  * @note Sensitivity is expressed as °C/LSB.
81  * @note Bias is expressed as °C.
82  *
83  * @{
84  */
85 #define HTS221_THERMO_NUMBER_OF_AXES 1U
86 
87 #define HTS221_THERMO_SENS 0.0015625f
88 #define HTS221_THERMO_BIAS 0.0f
89 /** @} */
90 
91 /**
92  * @name HTS221 communication interfaces related bit masks
93  * @{
94  */
95 #define HTS221_DI_MASK 0xFF
96 #define HTS221_DI(n) (1 << n)
97 #define HTS221_AD_MASK 0x3F
98 #define HTS221_AD(n) (1 << n)
99 #define HTS221_MS (1 << 6)
100 #define HTS221_RW (1 << 7)
101 
102 #define HTS221_SUB_MS (1 << 7)
103 
104 #define HTS221_SAD 0x5F
105 /** @} */
106 
107 /**
108  * @name HTS221 register addresses
109  * @{
110  */
111 #define HTS221_AD_WHO_AM_I 0x0F
112 #define HTS221_AD_AV_CONF 0x10
113 #define HTS221_AD_CTRL_REG1 0x20
114 #define HTS221_AD_CTRL_REG2 0x21
115 #define HTS221_AD_CTRL_REG3 0x22
116 #define HTS221_AD_STATUS_REG 0x27
117 #define HTS221_AD_HUMIDITY_OUT_L 0x28
118 #define HTS221_AD_HUMIDITY_OUT_H 0x29
119 #define HTS221_AD_TEMP_OUT_L 0x2A
120 #define HTS221_AD_TEMP_OUT_H 0x2B
121 #define HTS221_AD_CALIB_0 0x30
122 #define HTS221_AD_CALIB_1 0x31
123 #define HTS221_AD_CALIB_2 0x32
124 #define HTS221_AD_CALIB_3 0x33
125 #define HTS221_AD_CALIB_4 0x34
126 #define HTS221_AD_CALIB_5 0x35
127 #define HTS221_AD_CALIB_6 0x36
128 #define HTS221_AD_CALIB_7 0x37
129 #define HTS221_AD_CALIB_8 0x38
130 #define HTS221_AD_CALIB_9 0x39
131 #define HTS221_AD_CALIB_A 0x3A
132 #define HTS221_AD_CALIB_B 0x3B
133 #define HTS221_AD_CALIB_C 0x3C
134 #define HTS221_AD_CALIB_D 0x3D
135 #define HTS221_AD_CALIB_E 0x3E
136 #define HTS221_AD_CALIB_F 0x3F
137 /** @} */
138 
139 /**
140  * @name HTS221_CTRL_REG1 register bits definitions
141  * @{
142  */
143 #define HTS221_CTRL_REG1_MASK 0x87
144 #define HTS221_CTRL_REG1_ODR0 (1 << 0)
145 #define HTS221_CTRL_REG1_ODR1 (1 << 1)
146 #define HTS221_CTRL_REG1_BDU (1 << 2)
147 #define HTS221_CTRL_REG1_PD (1 << 7)
148 /** @} */
149 
150 /**
151  * @name HTS221_CTRL_REG2 register bits definitions
152  * @{
153  */
154 #define HTS221_CTRL_REG2_MASK 0x83
155 #define HTS221_CTRL_REG2_ONE_SHOT (1 << 0)
156 #define HTS221_CTRL_REG2_HEATER (1 << 1)
157 #define HTS221_CTRL_REG2_BOOT (1 << 7)
158 /** @} */
159 
160 /**
161  * @name HTS221_CTRL_REG3 register bits definitions
162  * @{
163  */
164 #define HTS221_CTRL_REG3_MASK 0xC4
165 #define HTS221_CTRL_REG3_DRDY (1 << 2)
166 #define HTS221_CTRL_REG3_PP_OD (1 << 6)
167 #define HTS221_CTRL_REG3_INT_H_L (1 << 7)
168 /** @} */
169 
170 /*===========================================================================*/
171 /* Driver pre-compile time settings. */
172 /*===========================================================================*/
173 
174 /**
175  * @name Configuration options
176  * @{
177  */
178 /**
179  * @brief HTS221 SPI interface switch.
180  * @details If set to @p TRUE the support for SPI is included.
181  * @note The default is @p FALSE.
182  */
183 #if !defined(HTS221_USE_SPI) || defined(__DOXYGEN__)
184 #define HTS221_USE_SPI FALSE
185 #endif
186 
187 /**
188  * @brief HTS221 shared SPI switch.
189  * @details If set to @p TRUE the device acquires SPI bus ownership
190  * on each transaction.
191  * @note The default is @p FALSE. Requires SPI_USE_MUTUAL_EXCLUSION
192  */
193 #if !defined(HTS221_SHARED_SPI) || defined(__DOXYGEN__)
194 #define HTS221_SHARED_SPI FALSE
195 #endif
196 
197 /**
198  * @brief HTS221 I2C interface switch.
199  * @details If set to @p TRUE the support for I2C is included.
200  * @note The default is @p TRUE.
201  */
202 #if !defined(HTS221_USE_I2C) || defined(__DOXYGEN__)
203 #define HTS221_USE_I2C TRUE
204 #endif
205 
206 /**
207  * @brief HTS221 shared I2C switch.
208  * @details If set to @p TRUE the device acquires I2C bus ownership
209  * on each transaction.
210  * @note The default is @p FALSE. Requires I2C_USE_MUTUAL_EXCLUSION
211  */
212 #if !defined(HTS221_SHARED_I2C) || defined(__DOXYGEN__)
213 #define HTS221_SHARED_I2C FALSE
214 #endif
215 
216 /**
217  * @brief HTS221 advanced configurations switch.
218  * @details If set to @p TRUE more configurations are available.
219  * @note The default is @p FALSE.
220  */
221 #if !defined(HTS221_USE_ADVANCED) || defined(__DOXYGEN__)
222 #define HTS221_USE_ADVANCED FALSE
223 #endif
224 /** @} */
225 
226 /*===========================================================================*/
227 /* Derived constants and error checks. */
228 /*===========================================================================*/
229 
230 #if !(HTS221_USE_SPI ^ HTS221_USE_I2C)
231 #error "HTS221_USE_SPI and HTS221_USE_I2C cannot be both true or both false"
232 #endif
233 
234 #if HTS221_USE_SPI && !HAL_USE_SPI
235 #error "HTS221_USE_SPI requires HAL_USE_SPI"
236 #endif
237 
238 #if HTS221_SHARED_SPI && !SPI_USE_MUTUAL_EXCLUSION
239 #error "HTS221_SHARED_SPI requires SPI_USE_MUTUAL_EXCLUSION"
240 #endif
241 
242 #if HTS221_USE_I2C && !HAL_USE_I2C
243 #error "HTS221_USE_I2C requires HAL_USE_I2C"
244 #endif
245 
246 #if HTS221_SHARED_I2C && !I2C_USE_MUTUAL_EXCLUSION
247 #error "HTS221_SHARED_I2C requires I2C_USE_MUTUAL_EXCLUSION"
248 #endif
249 
250 /**
251  * @todo Add support for HTS221 over SPI.
252  */
253 #if HTS221_USE_SPI
254 #error "HTS221 over SPI still not supported."
255 #endif
256 
257 /*===========================================================================*/
258 /* Driver data structures and types. */
259 /*===========================================================================*/
260 
261 /**
262  * @name HTS221 data structures and types.
263  * @{
264  */
265 /**
266  * @brief Structure representing a HTS221 driver.
267  */
268 typedef struct HTS221Driver HTS221Driver;
269 
270 /**
271  * @brief HTS221 output data rate and bandwidth.
272  */
273 typedef enum {
274  HTS221_ODR_ONE_SHOT = 0x00, /**< One shot. */
275  HTS221_ODR_1HZ = 0x01, /**< Output data rate 1 Hz. */
276  HTS221_ODR_7HZ = 0x02, /**< Output data rate 7 Hz. */
277  HTS221_ODR_12P5HZ = 0x03, /**< Output data rate 12.5 Hz. */
278 }hts221_odr_t;
279 
280 /**
281  * @brief HTS221 humidity resolution.
282  */
283 typedef enum {
284  HTS221_AVGH_4 = 0x00, /**< Number of internal average is 4. */
285  HTS221_AVGH_8 = 0x01, /**< Number of internal average is 8. */
286  HTS221_AVGH_16 = 0x02, /**< Number of internal average is 16. */
287  HTS221_AVGH_32 = 0x03, /**< Number of internal average is 32. */
288  HTS221_AVGH_64 = 0x04, /**< Number of internal average is 64. */
289  HTS221_AVGH_128 = 0x05, /**< Number of internal average is 128. */
290  HTS221_AVGH_256 = 0x06, /**< Number of internal average is 256. */
291  HTS221_AVGH_512 = 0x07 /**< Number of internal average is 512. */
293 
294 /**
295  * @brief HTS221 temperature resolution.
296  */
297 typedef enum {
298  HTS221_AVGT_2 = 0x00, /**< Number of internal average is 2. */
299  HTS221_AVGT_4 = 0x08, /**< Number of internal average is 4. */
300  HTS221_AVGT_8 = 0x10, /**< Number of internal average is 8. */
301  HTS221_AVGT_16 = 0x18, /**< Number of internal average is 16. */
302  HTS221_AVGT_32 = 0x20, /**< Number of internal average is 32. */
303  HTS221_AVGT_64 = 0x28, /**< Number of internal average is 64. */
304  HTS221_AVGT_128 = 0x30, /**< Number of internal average is 128. */
305  HTS221_AVGT_256 = 0x38, /**< Number of internal average is 256. */
307 
308 /**
309  * @brief HTS221 block data update.
310  */
311 typedef enum {
312  HTS221_BDU_CONTINUOUS = 0x00, /**< Block data continuously updated. */
313  HTS221_BDU_BLOCKED = 0x40 /**< Block data updated after reading. */
314 }hts221_bdu_t;
315 
316 /**
317  * @brief Driver state machine possible states.
318  */
319 typedef enum {
320  HTS221_UNINIT = 0, /**< Not initialized. */
321  HTS221_STOP = 1, /**< Stopped. */
322  HTS221_READY = 2, /**< Ready. */
324 
325 /**
326  * @brief HTS221 configuration structure.
327  */
328 typedef struct {
329 
330 #if HTS221_USE_SPI || defined(__DOXYGEN__)
331  /**
332  * @brief SPI driver associated to this HTS221.
333  */
335  /**
336  * @brief SPI configuration associated to this HTS221.
337  */
339 #endif /* HTS221_USE_SPI */
340 #if HTS221_USE_I2C || defined(__DOXYGEN__)
341  /**
342  * @brief I2C driver associated to this HTS221.
343  */
345  /**
346  * @brief I2C configuration associated to this HTS221.
347  */
349 #endif /* HTS221_USE_I2C */
350  /**
351  * @brief HTS221 hygrometer subsystem initial sensitivity.
352  */
354  /**
355  * @brief HTS221 hygrometer subsystem initial bias.
356  */
357  float *hygrobias;
358  /**
359  * @brief HTS221 thermometer subsystem initial sensitivity.
360  */
362  /**
363  * @brief HTS221 thermometer subsystem initial bias.
364  */
365  float *thermobias;
366  /**
367  * @brief HTS221 output data rate selection.
368  */
370 #if HTS221_USE_ADVANCED || defined(__DOXYGEN__)
371  /**
372  * @brief HTS221 block data update.
373  */
375  /**
376  * @brief HTS221 hygrometer subsystem resolution.
377  */
379  /**
380  * @brief HTS221 thermometer subsystem resolution.
381  */
383 #endif
384 } HTS221Config;
385 
386 /**
387  * @brief @p HTS221 specific methods.
388  * @note No methods so far, just a common ancestor interface.
389  */
390 #define _hts221_methods_alone
391 
392 /**
393  * @brief @p HTS221 specific methods with inherited ones.
394  */
395 #define _hts221_methods \
396  _base_object_methods \
397  _hts221_methods_alone
398 
399 /**
400  * @extends BaseObjectVMT
401  *
402  * @brief @p HTS221 virtual methods table.
403  */
404 struct HTS221VMT {
406 };
407 
408 /**
409  * @brief @p HTS221Driver specific data.
410  */
411 #define _hts221_data \
412  /* Driver state.*/ \
413  hts221_state_t state; \
414  /* Current configuration data.*/ \
415  const HTS221Config *config; \
416  /* Hygrometer subsystem axes number.*/ \
417  size_t hygroaxes; \
418  /* Hygrometer subsystem current sensitivity.*/ \
419  float hygrosensitivity; \
420  /* Hygrometer subsystem current bias .*/ \
421  float hygrobias; \
422  /* Hygrometer subsystem factory sensitivity.*/ \
423  float hygrofactorysensitivity; \
424  /* Hygrometer subsystem factory bias .*/ \
425  float hygrofactorybias; \
426  /* Thermometer subsystem axes number.*/ \
427  size_t thermoaxes; \
428  /* Thermometer subsystem current sensitivity.*/ \
429  float thermosensitivity; \
430  /* Thermometer subsystem current bias.*/ \
431  float thermobias; \
432  /* Thermometer subsystem factory sensitivity.*/ \
433  float thermofactorysensitivity; \
434  /* Thermometer subsystem factory bias.*/ \
435  float thermofactorybias;
436 
437 /**
438  * @brief HTS221 2-axis hygrometer/thermometer class.
439  */
440 struct HTS221Driver {
441  /** @brief Virtual Methods Table.*/
442  const struct HTS221VMT *vmt;
443  /** @brief Base hygrometer interface.*/
445  /** @brief Base thermometer interface.*/
448 };
449 /** @} */
450 
451 /*===========================================================================*/
452 /* Driver macros. */
453 /*===========================================================================*/
454 
455 /**
456  * @brief Return the number of axes of the BaseHygrometer.
457  *
458  * @param[in] devp pointer to @p HTS221Driver.
459  *
460  * @return the number of axes.
461  *
462  * @api
463  */
464 #define hts221HygrometerGetAxesNumber(devp) \
465  hygrometerGetAxesNumber(&((devp)->hygro_if))
466 
467 /**
468  * @brief Retrieves raw data from the BaseHygrometer.
469  * @note This data is retrieved from MEMS register without any algebraical
470  * manipulation.
471  * @note The axes array must be at least the same size of the
472  * BaseHygrometer axes number.
473  *
474  * @param[in] devp pointer to @p HTS221Driver.
475  * @param[out] axes a buffer which would be filled with raw data.
476  *
477  * @return The operation status.
478  * @retval MSG_OK if the function succeeded.
479  * @retval MSG_RESET if one or more I2C errors occurred, the errors can
480  * be retrieved using @p i2cGetErrors().
481  * @retval MSG_TIMEOUT if a timeout occurred before operation end.
482  *
483  * @api
484  */
485 #define hts221HygrometerReadRaw(devp, axes) \
486  hygrometerReadRaw(&((devp)->hygro_if), axes)
487 
488 /**
489  * @brief Retrieves cooked data from the BaseHygrometer.
490  * @note This data is manipulated according to the formula
491  * cooked = (raw * sensitivity) - bias.
492  * @note Final data is expressed as %rH.
493  * @note The axes array must be at least the same size of the
494  * BaseHygrometer axes number.
495  *
496  * @param[in] devp pointer to @p HTS221Driver.
497  * @param[out] axes a buffer which would be filled with cooked data.
498  *
499  * @return The operation status.
500  * @retval MSG_OK if the function succeeded.
501  * @retval MSG_RESET if one or more I2C errors occurred, the errors can
502  * be retrieved using @p i2cGetErrors().
503  * @retval MSG_TIMEOUT if a timeout occurred before operation end.
504  *
505  * @api
506  */
507 #define hts221HygrometerReadCooked(devp, axes) \
508  hygrometerReadCooked(&((devp)->hygro_if), axes)
509 
510 /**
511  * @brief Set bias values for the BaseHygrometer.
512  * @note Bias must be expressed as %rH.
513  * @note The bias buffer must be at least the same size of the
514  * BaseHygrometer axes number.
515  *
516  * @param[in] devp pointer to @p HTS221Driver.
517  * @param[in] bp a buffer which contains biases.
518  *
519  * @return The operation status.
520  * @retval MSG_OK if the function succeeded.
521  *
522  * @api
523  */
524 #define hts221HygrometerSetBias(devp, bp) \
525  hygrometerSetBias(&((devp)->hygro_if), bp)
526 
527 /**
528  * @brief Reset bias values for the BaseHygrometer.
529  * @note Default biases value are obtained from device datasheet when
530  * available otherwise they are considered zero.
531  *
532  * @param[in] devp pointer to @p HTS221Driver.
533  *
534  * @return The operation status.
535  * @retval MSG_OK if the function succeeded.
536  *
537  * @api
538  */
539 #define hts221HygrometerResetBias(devp) \
540  hygrometerResetBias(&((devp)->hygro_if))
541 
542 /**
543  * @brief Set sensitivity values for the BaseHygrometer.
544  * @note Sensitivity must be expressed as %rH/LSB.
545  * @note The sensitivity buffer must be at least the same size of the
546  * BaseHygrometer axes number.
547  *
548  * @param[in] devp pointer to @p HTS221Driver.
549  * @param[in] sp a buffer which contains sensitivities.
550  *
551  * @return The operation status.
552  * @retval MSG_OK if the function succeeded.
553  *
554  * @api
555  */
556 #define hts221HygrometerSetSensitivity(devp, sp) \
557  hygrometerSetSensitivity(&((devp)->hygro_if), sp)
558 
559 /**
560  * @brief Reset sensitivity values for the BaseHygrometer.
561  * @note Default sensitivities value are obtained from device datasheet.
562  *
563  * @param[in] devp pointer to @p HTS221Driver.
564  *
565  * @return The operation status.
566  * @retval MSG_OK if the function succeeded.
567  *
568  * @api
569  */
570 #define hts221HygrometerResetSensitivity(devp) \
571  hygrometerResetSensitivity(&((devp)->hygro_if))
572 
573 /**
574  * @brief Return the number of axes of the BaseThermometer.
575  *
576  * @param[in] devp pointer to @p HTS221Driver.
577  *
578  * @return the number of axes.
579  *
580  * @api
581  */
582 #define hts221ThermometerGetAxesNumber(devp) \
583  thermometerGetAxesNumber(&((devp)->thermo_if))
584 
585 /**
586  * @brief Retrieves raw data from the BaseThermometer.
587  * @note This data is retrieved from MEMS register without any algebraical
588  * manipulation.
589  * @note The axes array must be at least the same size of the
590  * BaseThermometer axes number.
591  *
592  * @param[in] devp pointer to @p HTS221Driver.
593  * @param[out] axes a buffer which would be filled with raw data.
594  *
595  * @return The operation status.
596  * @retval MSG_OK if the function succeeded.
597  * @retval MSG_RESET if one or more I2C errors occurred, the errors can
598  * be retrieved using @p i2cGetErrors().
599  * @retval MSG_TIMEOUT if a timeout occurred before operation end.
600  *
601  * @api
602  */
603 #define hts221ThermometerReadRaw(devp, axes) \
604  thermometerReadRaw(&((devp)->thermo_if), axes)
605 
606 /**
607  * @brief Retrieves cooked data from the BaseThermometer.
608  * @note This data is manipulated according to the formula
609  * cooked = (raw * sensitivity) - bias.
610  * @note Final data is expressed as °C.
611  * @note The axes array must be at least the same size of the
612  * BaseThermometer axes number.
613  *
614  * @param[in] devp pointer to @p HTS221Driver.
615  * @param[out] axes a buffer which would be filled with cooked data.
616  *
617  * @return The operation status.
618  * @retval MSG_OK if the function succeeded.
619  * @retval MSG_RESET if one or more I2C errors occurred, the errors can
620  * be retrieved using @p i2cGetErrors().
621  * @retval MSG_TIMEOUT if a timeout occurred before operation end.
622  *
623  * @api
624  */
625 #define hts221ThermometerReadCooked(devp, axes) \
626  thermometerReadCooked(&((devp)->thermo_if), axes)
627 
628 /**
629  * @brief Set bias values for the BaseThermometer.
630  * @note Bias must be expressed as °C.
631  * @note The bias buffer must be at least the same size of the
632  * BaseThermometer axes number.
633  *
634  * @param[in] devp pointer to @p HTS221Driver.
635  * @param[in] bp a buffer which contains biases.
636  *
637  * @return The operation status.
638  * @retval MSG_OK if the function succeeded.
639  *
640  * @api
641  */
642 #define hts221ThermometerSetBias(devp, bp) \
643  thermometerSetBias(&((devp)->thermo_if), bp)
644 
645 /**
646  * @brief Reset bias values for the BaseThermometer.
647  * @note Default biases value are obtained from device datasheet when
648  * available otherwise they are considered zero.
649  *
650  * @param[in] devp pointer to @p HTS221Driver.
651  *
652  * @return The operation status.
653  * @retval MSG_OK if the function succeeded.
654  *
655  * @api
656  */
657 #define hts221ThermometerResetBias(devp) \
658  thermometerResetBias(&((devp)->thermo_if))
659 
660 /**
661  * @brief Set sensitivity values for the BaseThermometer.
662  * @note Sensitivity must be expressed as °C/LSB.
663  * @note The sensitivity buffer must be at least the same size of the
664  * BaseThermometer axes number.
665  *
666  * @param[in] devp pointer to @p HTS221Driver.
667  * @param[in] sp a buffer which contains sensitivities.
668  *
669  * @return The operation status.
670  * @retval MSG_OK if the function succeeded.
671  *
672  * @api
673  */
674 #define hts221ThermometerSetSensitivity(devp, sp) \
675  thermometerSetSensitivity(&((devp)->thermo_if), sp)
676 
677 /**
678  * @brief Reset sensitivity values for the BaseThermometer.
679  * @note Default sensitivities value are obtained from device datasheet.
680  *
681  * @param[in] devp pointer to @p HTS221Driver.
682  *
683  * @return The operation status.
684  * @retval MSG_OK if the function succeeded.
685  *
686  * @api
687  */
688 #define hts221ThermometerResetSensitivity(devp) \
689  thermometerResetSensitivity(&((devp)->thermo_if))
690 
691 /*===========================================================================*/
692 /* External declarations. */
693 /*===========================================================================*/
694 
695 #ifdef __cplusplus
696 extern "C" {
697 #endif
698  void hts221ObjectInit(HTS221Driver *devp);
699  void hts221Start(HTS221Driver *devp, const HTS221Config *config);
700  void hts221Stop(HTS221Driver *devp);
701 #ifdef __cplusplus
702 }
703 #endif
704 
705 #endif /* _HTS221_H_ */
706 
707 /** @} */
hts221_state_t
Driver state machine possible states.
Definition: hts221.h:319
Type of I2C driver configuration structure.
Definition: hal_i2c_lld.h:75
Base thermometer class.
const struct HTS221VMT * vmt
Virtual Methods Table.
Definition: hts221.h:442
float * hygrosensitivity
HTS221 hygrometer subsystem initial sensitivity.
Definition: hts221.h:353
#define _hts221_data
HTS221Driver specific data.
Definition: hts221.h:411
BaseHygrometer hygro_if
Base hygrometer interface.
Definition: hts221.h:444
hts221_avgt_t thermoresolution
HTS221 thermometer subsystem resolution.
Definition: hts221.h:382
void hts221ObjectInit(HTS221Driver *devp)
Initializes an instance.
Definition: hts221.c:631
hts221_odr_t outputdatarate
HTS221 output data rate selection.
Definition: hts221.h:369
float * thermosensitivity
HTS221 thermometer subsystem initial sensitivity.
Definition: hts221.h:361
HTS221 2-axis hygrometer/thermometer class.
Definition: hts221.h:440
hts221_odr_t
HTS221 output data rate and bandwidth.
Definition: hts221.h:273
BaseThermometer thermo_if
Base thermometer interface.
Definition: hts221.h:446
Generic hygrometer interface header.
HTS221 virtual methods table.
Definition: hts221.h:404
Base hygrometer class.
SPIDriver * spip
SPI driver associated to this HTS221.
Definition: hts221.h:334
Structure representing an I2C driver.
Definition: hal_i2c_lld.h:88
float * thermobias
HTS221 thermometer subsystem initial bias.
Definition: hts221.h:365
const SPIConfig * spicfg
SPI configuration associated to this HTS221.
Definition: hts221.h:338
Driver configuration structure.
Definition: hal_spi_lld.h:83
hts221_bdu_t blockdataupdate
HTS221 block data update.
Definition: hts221.h:374
hts221_avgt_t
HTS221 temperature resolution.
Definition: hts221.h:297
void hts221Stop(HTS221Driver *devp)
Deactivates the HTS221 Complex Driver peripheral.
Definition: hts221.c:761
Generic thermometer interface header.
I2CDriver * i2cp
I2C driver associated to this HTS221.
Definition: hts221.h:344
hts221_bdu_t
HTS221 block data update.
Definition: hts221.h:311
float * hygrobias
HTS221 hygrometer subsystem initial bias.
Definition: hts221.h:357
hts221_avgh_t
HTS221 humidity resolution.
Definition: hts221.h:283
void hts221Start(HTS221Driver *devp, const HTS221Config *config)
Configures and activates HTS221 Complex Driver peripheral.
Definition: hts221.c:656
const I2CConfig * i2ccfg
I2C configuration associated to this HTS221.
Definition: hts221.h:348
hts221_avgh_t hygroresolution
HTS221 hygrometer subsystem resolution.
Definition: hts221.h:378
Structure representing an SPI driver.
Definition: hal_spi_lld.h:128
#define _hts221_methods
HTS221 specific methods with inherited ones.
Definition: hts221.h:395
HTS221 configuration structure.
Definition: hts221.h:328