-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbme280.h
716 lines (659 loc) · 34.1 KB
/
bme280.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
/**
*******************************************
* @file bme280.h
* @author Łukasz Juraszek / JuraszekL
* @date 20.04.2023
* @brief Header for BME280 Driver
* @note https://github.com/JuraszekL/BME280_Driver
*******************************************
*/
/**
* @addtogroup BME280_Driver
* @{
*/
//***************************************
#ifndef BME280_H
#define BME280_H
//***************************************
#ifdef __cplusplus /* CPP */
extern "C" {
#endif
//***************************************
#include "bme280_definitions.h"
/**
* @defgroup BME280_libconf Library Configuration
* @brief Set library options here
* @{
*/
/// comment this line if you don't want to use 64bit variables in calculations
#define USE_64BIT
/// comment this line if you don't need to use functions with floating point results
#define USE_FLOATS_RESULTS
/// comment this line if you don't need to use functions with integer results
#define USE_INTEGER_RESULTS
/// comment this line if you don't need to read single setting with any getX function
#define USE_GETTERS
/// comment this line if you don't need to write single setting with any setX function
#define USE_SETTERS
/// comment this line if you don't use functionns to read data in normal mode (BME280_ReadxxxLast/BME280_ReadxxxLast_F)
#define USE_NORMAL_MODE
/// comment this line if you don't use functionns to read data in forced mode (BME280_ReadxxxForce/BME280_ReadxxxForce_F)
#define USE_FORCED_MODE
///@}
/**
* @defgroup BME280_Pubfunc Public functions
* @brief Use these functions only
* @{
*/
/**
* @brief Function to initialize sensor and resources
* @note This must be a first function usend in code before any other opearion can be performed!
*
* Init funtion performs sensor reset and checks #BME280_ID. It doesn't set any sensor's parameters. Calibration
* data specific for each one sensor are read while Init function. If operation is completed with
* success function sets "initialized" value in #BME280_t structure.
* @param[in] *Dev pointer to #BME280_t structure which should be initialized
* @param[in] *Driver pointer to BME280_Driver_t structure where all platform specific data are stored. This structure
* MUST exist while program is running - do not use local structures to init sensor!
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_ID_ERR sensor's id doesnt match with #BME280_ID
*/
int8_t BME280_Init(BME280_t *Dev, BME280_Driver_t *Driver);
/**
* @brief Function to perform sensor's software reset
*
* Function sends #BME280_RESET_VALUE to #BME280_RESET_ADDR. To perform this operation #bme280_writeregister
* function must be set inside #BME280_t *Dev structure. Function sets "sleep_mode" inside *Dev structure after reset.
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed or #bme280_writeregister function is not set
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
*/
int8_t BME280_Reset(BME280_t *Dev);
#ifdef USE_GETTERS
/**
* @defgroup BME280_getfunctions Get Functions
* @brief Read sensor's settings
* @note #USE_GETTERS in @ref BME280_libconf must be uncommented tu use these functions
* @{
*/
/**
* @brief Function gets current @ref BME280_mode from sensor
*
* Function updates current operating mode inside *Dev structure as well.
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *Mode pointer to vartiable where result will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
*/
int8_t BME280_GetMode(BME280_t *Dev, uint8_t *Mode);
/**
* @brief Function gets current pressure @ref BME280_Ovs from sensor
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *POvs pointer to vartiable where result will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
*/
int8_t BME280_GetPOvs(BME280_t *Dev, uint8_t *POvs);
/**
* @brief Function gets current temperature @ref BME280_Ovs from sensor
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *TOvs pointer to vartiable where result will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
*/
int8_t BME280_GetTOvs(BME280_t *Dev, uint8_t *TOvs);
/**
* @brief Function gets current humidity @ref BME280_Ovs from sensor
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *HOvs pointer to vartiable where result will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
*/
int8_t BME280_GetHOvs(BME280_t *Dev, uint8_t *HOvs);
/**
* @brief Function gets current @ref BME280_tstby from sensor
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *TStby pointer to vartiable where result will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
*/
int8_t BME280_GetTStby(BME280_t *Dev, uint8_t *TStby);
/**
* @brief Function gets current @ref BME280_filter coeficient from sensor
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *Filter pointer to vartiable where result will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
*/
int8_t BME280_GetTFilter(BME280_t *Dev, uint8_t *Filter);
/**
* @brief Function checks if 3-wire SPI is enabled
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *Result pointer to vartiable where result will be stored, 0 - disabled, 1 - enabled
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
*/
int8_t BME280_Is3WireSPIEnabled(BME280_t *Dev, uint8_t *Result);
///@}
#endif
/**
* @brief Function to set all sensor settings at once
* @note Sensor must be in #BME280_SLEEPMODE to set all parameters. Force #BME280_SLEEPMODE with #BME280_SetMode
* function before or use it directly after #BME280_Init function only.
*
* Function writes all 3 config registers without reading them before. It can be usefull after power-up or reset.
* It sets current operating mode inside *Dev structure at the end.
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[in] *Config pointer to #BME280_Config_t structure which contains all paramaters to be set
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_SLEEPMODE
*/
int8_t BME280_ConfigureAll(BME280_t *Dev, BME280_Config_t *Config);
#ifdef USE_SETTERS
/**
* @defgroup BME280_setfunctions Set Functions
* @brief change sensor's settings
* @note #USE_SETTERS in @ref BME280_libconf must be uncommented to use these functions
* @note Sensor must be in #BME280_SLEEPMODE to change settings. Only #BME280_SetMode function can be used when
* sensors is in different working mode,
* @{
*/
/**
* @brief Function sets sensor's @ref BME280_mode
*
* Function reads single register from sensor, and checks if current mode matches mode requested by user.
* If matches, function skips write operation and returns #BME280_OK. If doesnt, it prepares and sends new register
* value, then sets correct operating mode inside *Dev structure.
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[in] Mode value to be set, must be in range of @ref BME280_mode
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
*/
int8_t BME280_SetMode(BME280_t *Dev, uint8_t Mode);
/**
* @brief Function sets sensor's pressure @ref BME280_Ovs
* @note Sensor must be in #BME280_SLEEPMODE to set this parameter. Force #BME280_SLEEPMODE with #BME280_SetMode
* function before or use it directly after #BME280_Init function only.
*
* Function reads single register from sensor, and checks if current value matches value requested by user.
* If matches, function skips write operation and returns #BME280_OK. If doesnt, it prepares and sends new register
* value.
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[in] POvs value to be set, must be in range of @ref BME280_Ovs
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_SLEEPMODE
*/
int8_t BME280_SetPOvs(BME280_t *Dev, uint8_t POvs);
/**
* @brief Function sets sensor's temperature @ref BME280_Ovs
* @note Sensor must be in #BME280_SLEEPMODE to set this parameter. Force #BME280_SLEEPMODE with #BME280_SetMode
* function before or use it directly after #BME280_Init function only.
*
* Function reads single register from sensor, and checks if current value matches value requested by user.
* If matches, function skips write operation and returns #BME280_OK. If doesnt, it prepares and sends new register
* value.
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[in] TOvs value to be set, must be in range of @ref BME280_Ovs
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_SLEEPMODE
*/
int8_t BME280_SetTOvs(BME280_t *Dev, uint8_t TOvs);
/**
* @brief Function sets sensor's humidity @ref BME280_Ovs
* @note Sensor must be in #BME280_SLEEPMODE to set this parameter. Force #BME280_SLEEPMODE with #BME280_SetMode
* function before or use it directly after #BME280_Init function only.
*
* Function reads single register from sensor, and checks if current value matches value requested by user.
* If matches, function skips write operation and returns #BME280_OK. If doesnt, it prepares and sends new register
* value.
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[in] HOvs value to be set, must be in range of @ref BME280_Ovs
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_SLEEPMODE
*/
int8_t BME280_SetHOvs(BME280_t *Dev, uint8_t HOvs);
/**
* @brief Function sets sensor's @ref BME280_tstby
* @note Sensor must be in #BME280_SLEEPMODE to set this parameter. Force #BME280_SLEEPMODE with #BME280_SetMode
* function before or use it directly after #BME280_Init function only.
*
* Function reads single register from sensor, and checks if current value matches value requested by user.
* If matches, function skips write operation and returns #BME280_OK. If doesnt, it prepares and sends new register
* value.
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[in] TStby value to be set, must be in range of @ref BME280_tstby
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_SLEEPMODE
*/
int8_t BME280_SetTStby(BME280_t *Dev, uint8_t TStby);
/**
* @brief Function sets sensor's @ref BME280_filter coeficient
* @note Sensor must be in #BME280_SLEEPMODE to set this parameter. Force #BME280_SLEEPMODE with #BME280_SetMode
* function before or use it directly after #BME280_Init function only.
*
* Function reads single register from sensor, and checks if current value matches value requested by user.
* If matches, function skips write operation and returns #BME280_OK. If doesnt, it prepares and sends new register
* value.
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[in] Filter value to be set, must be in range of @ref BME280_filter
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_SLEEPMODE
*/
int8_t BME280_SetFilter(BME280_t *Dev, uint8_t Filter);
/**
* @brief Function enables 3-wire SPI bus
* @note Sensor must be in #BME280_SLEEPMODE to set this parameter. Force #BME280_SLEEPMODE with #BME280_SetMode
* function before or use it directly after #BME280_Init function only.
*
* Function reads single register from sensor, and checks if current value matches value requested by user.
* If matches, function skips write operation and returns #BME280_OK. If doesnt, it prepares and sends new register
* value.
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_SLEEPMODE
*/
int8_t BME280_Enable3WireSPI(BME280_t *Dev);
/**
* @brief Function disables 3-wire SPI bus
* @note Sensor must be in #BME280_SLEEPMODE to set this parameter. Force #BME280_SLEEPMODE with #BME280_SetMode
* function before or use it directly after #BME280_Init function only.
*
* Function reads single register from sensor, and checks if current value matches value requested by user.
* If matches, function skips write operation and returns #BME280_OK. If doesnt, it prepares and sends new register
* value.
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_SLEEPMODE
*/
int8_t BME280_Disable3WireSPI(BME280_t *Dev);
///@}
#endif
#ifdef USE_INTEGER_RESULTS
/**
* @defgroup BME280_readnofl Read Functions (int)
* @brief read measured data from sensor as integers
* @note #USE_INTEGER_RESULTS in @ref BME280_libconf must be uncommented to use these functions
* @{
*/
#ifdef USE_NORMAL_MODE
/**
* @defgroup BME280_readnormalmodei Read in normal mode
* @brief read last measured data from sensor in normal mode
* @note #USE_NORMAL_MODE in @ref BME280_libconf must be uncommented to use these functions
* @{
*/
/**
* @brief Function reads all measured data at once
* @note Sensor must be in #BME280_NORMALMODE to read last measured values.
*
* Function reads all adc values from sensor, converts them into single variables and compensate
* with use #BME280_calibration_data. Compensated values are then converted into #BME280_Data_t structure.
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *Data pointer to structure where result will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_NORMALMODE
*/
int8_t BME280_ReadAllLast(BME280_t *Dev, BME280_Data_t *Data);
/**
* @brief Function reads last measured temperature
* @note Sensor must be in #BME280_NORMALMODE to read last measured values.
*
* Function reads temperature related adc values from sensor, converts them into single variable and compensate
* with use #BME280_calibration_data. Compensated value is then converted into integer part and fractial part and
* stored in external variables
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *TempInt pointer to variable where integer part of temperature will be stored
* @param[out] *TempFract pointer to variable where fractial part of temperature will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_NORMALMODE
*/
int8_t BME280_ReadTempLast(BME280_t *Dev, int8_t *TempInt, uint8_t *TempFract);
/**
* @brief Function reads last measured pressure
* @note Sensor must be in #BME280_NORMALMODE to read last measured values.
*
* Function reads temperature and pressure related adc values from sensor, converts them into single variables and compensate
* with use #BME280_calibration_data. Compensated value is then converted into integer part and fractial part and
* stored in external variables
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *PressInt pointer to variable where integer part of pressure will be stored
* @param[out] *PressFract pointer to variable where fractial part of pressure will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_NORMALMODE
*/
int8_t BME280_ReadPressLast(BME280_t *Dev, uint16_t *PressInt, uint16_t *PressFract);
/**
* @brief Function reads last measured humidity
* @note Sensor must be in #BME280_NORMALMODE to read last measured values.
*
* Function reads temperature and humidity related adc values from sensor, converts them into single variables and compensate
* with use #BME280_calibration_data. Compensated value is then converted into integer part and fractial part and
* stored in external variables
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *HumInt pointer to variable where integer part of humidity will be stored
* @param[out] *HumFract pointer to variable where fractial part of humidity will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_NORMALMODE
*/
int8_t BME280_ReadHumLast(BME280_t *Dev, uint8_t *HumInt, uint16_t *HumFract);
///@}
#endif
#ifdef USE_FORCED_MODE
/**
* @defgroup BME280_readforcedmodei Read in forced mode
* @brief force single measure and read data when finished
* @note #USE_FORCED_MODE in @ref BME280_libconf must be uncommented to use these functions
* @{
*/
/**
* @brief Function forces single measure and returns all data as integers
* @note Sensor must be in #BME280_SLEEPMODE to force a single measurement.
*
* Function reads sensor's configuration to check conditions and calculate max. delay time
* required for measure cycle. Then sends command to force single measurement and calls used-defined
* delay function. When delay function returns ir reads all adc values from sensor, converts them into
* single variables and compensate with use #BME280_calibration_data. Compensated values are then
* converted into #BME280_Data_t structure.
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *Data pointer to structure where result will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_SLEEPMODE
* @return #BME280_BUSY_ERR sensor is busy so cannot proceed
*/
int8_t BME280_ReadAllForce(BME280_t *Dev, BME280_Data_t *Data);
/**
* @brief Function forces single measure and returns temperatrue as integers (forced mode)
* @note Sensor must be in #BME280_SLEEPMODE to force a single measurement.
*
* Function reads sensor's configuration to check conditions and calculate max. delay time
* required for measure cycle. Then sends command to force single measurement and calls used-defined
* delay function. When delay function returns ir reads temperature related adc values from sensor, converts them into
* single variables and compensate with use #BME280_calibration_data. Compensated values are then
* converted into integer (*TempInt) and fractial part (*TempFract).
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *TempInt pointer to variable where integer part of temperature will be stored
* @param[out] *TempFract pointer to variable where fractial part of temperature will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_SLEEPMODE
* @return #BME280_BUSY_ERR sensor is busy so cannot proceed
*/
int8_t BME280_ReadTempForce(BME280_t *Dev, int8_t *TempInt, uint8_t *TempFract);
/**
* @brief Function forces single measure and returns pressure as integers (forced mode)
* @note Sensor must be in #BME280_SLEEPMODE to force a single measurement.
*
* Function reads sensor's configuration to check conditions and calculate max. delay time
* required for measure cycle. Then sends command to force single measurement and calls used-defined
* delay function. When delay function returns ir reads temperarure and pressure related adc values from sensor,
* converts them into single variables and compensate with use #BME280_calibration_data. Compensated values are
* then converted into integer (*PressInt) and fractial part (*PressFract).
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *PressInt pointer to variable where integer part of pressure will be stored
* @param[out] *PressFract pointer to variable where fractial part of pressure will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_SLEEPMODE
* @return #BME280_BUSY_ERR sensor is busy so cannot proceed
*/
int8_t BME280_ReadPressForce(BME280_t *Dev, uint16_t *PressInt, uint16_t *PressFract);
/**
* @brief Function forces single measure and returns humidity as integers (forced mode)
* @note Sensor must be in #BME280_SLEEPMODE to force a single measurement.
*
* Function reads sensor's configuration to check conditions and calculate max. delay time
* required for measure cycle. Then sends command to force single measurement and calls used-defined
* delay function. When delay function returns ir reads temperarure and humidity related adc values from sensor,
* converts them into single variables and compensate with use #BME280_calibration_data. Compensated values are
* then converted into integer (*HumInt) and fractial part (*HumFract).
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *HumInt pointer to variable where integer part of humidity will be stored
* @param[out] *HumFract pointer to variable where fractial part of humidity will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_SLEEPMODE
* @return #BME280_BUSY_ERR sensor is busy so cannot proceed
*/
int8_t BME280_ReadHumForce(BME280_t *Dev, uint8_t *HumInt, uint16_t *HumFract);
///@}
#endif
///@}
#endif
#ifdef USE_FLOATS_RESULTS
/**
* @defgroup BME280_readfl Read Functions (float)
* @brief read measured data from sensor as floating point values
* @note #USE_FLOATS_RESULTS in @ref BME280_libconf must be uncommented to use these functions
* @{
*/
#ifdef USE_NORMAL_MODE
/**
* @defgroup BME280_readnormalmodef Read in normal mode
* @brief read last measured data from sensor in normal mode
* @note #USE_NORMAL_MODE in @ref BME280_libconf must be uncommented to use these functions
* @{
*/
/**
* @brief Function reads all measured data at once
* @note Sensor must be in #BME280_NORMALMODE to read last measured values.
*
* Function reads all adc values from sensor, converts them into single variables and compensate
* with use #BME280_calibration_data. Compensated values are then converted into #BME280_DataF_t structure.
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *Data pointer to structure where result will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_NORMALMODE
*/
int8_t BME280_ReadAllLast_F(BME280_t *Dev, BME280_DataF_t *Data);
/**
* @brief Function reads last measured temperature
* @note Sensor must be in #BME280_NORMALMODE to read last measured values.
*
* Function reads temperature related adc values from sensor, converts them into single variable and compensate
* with use #BME280_calibration_data. Compensated value is then converted into floating point value and stored in
* external variable
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *Temp pointer to variable where temperature will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_NORMALMODE
*/
int8_t BME280_ReadTempLast_F(BME280_t *Dev, float *Temp);
/**
* @brief Function reads last measured pressure
* @note Sensor must be in #BME280_NORMALMODE to read last measured values.
*
* Function reads temperature and pressure related adc values from sensor, converts them into single variables and compensate
* with use #BME280_calibration_data. Compensated value is then converted into floating point value and stored in
* external variable
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *Press pointer to variable where temperature will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_NORMALMODE
*/
int8_t BME280_ReadPressLast_F(BME280_t *Dev, float *Press);
/**
* @brief Function reads last measured humidity
* @note Sensor must be in #BME280_NORMALMODE to read last measured values.
*
* Function reads temperature and humidity related adc values from sensor, converts them into single variables and compensate
* with use #BME280_calibration_data. Compensated value is then converted into floating point value and stored in
* external variable
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *Hum pointer to variable where temperature will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_NORMALMODE
*/
int8_t BME280_ReadHumLast_F(BME280_t *Dev, float *Hum);
/// @}
#endif
#ifdef USE_FORCED_MODE
/**
* @defgroup BME280_readforcedmodef Read in forced mode
* @brief force single measure and read data when finished
* @note #USE_FORCED_MODE in @ref BME280_libconf must be uncommented to use these functions
* @{
*/
/**
* @brief Function forces single measure and returns all data as floats
* @note Sensor must be in #BME280_SLEEPMODE to force a single measurement.
*
* Function reads sensor's configuration to check conditions and calculate max. delay time
* required for measure cycle. Then sends command to force single measurement and calls used-defined
* delay function. When delay function returns ir reads all adc values from sensor, converts them into
* single variables and compensate with use #BME280_calibration_data. Compensated values are then
* converted into #BME280_DataF_t structure.
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *Data pointer to structure where result will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_SLEEPMODE
* @return #BME280_BUSY_ERR sensor is busy so cannot proceed
*/
int8_t BME280_ReadAllForce_F(BME280_t *Dev, BME280_DataF_t *Data);
/**
* @brief Function forces single measure and returns temperatrue as floats (forced mode)
* @note Sensor must be in #BME280_SLEEPMODE to force a single measurement.
*
* Function reads sensor's configuration to check conditions and calculate max. delay time
* required for measure cycle. Then sends command to force single measurement and calls used-defined
* delay function. When delay function returns ir reads temperature related adc values from sensor, converts them into
* single variables and compensate with use #BME280_calibration_data. Compensated values are then
* converted into float.
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *Temp pointer to variable where temperature will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_SLEEPMODE
* @return #BME280_BUSY_ERR sensor is busy so cannot proceed
*/
int8_t BME280_ReadTempForce_F(BME280_t *Dev, float *Temp);
/**
* @brief Function forces single measure and returns pressure as floats (forced mode)
* @note Sensor must be in #BME280_SLEEPMODE to force a single measurement.
*
* Function reads sensor's configuration to check conditions and calculate max. delay time
* required for measure cycle. Then sends command to force single measurement and calls used-defined
* delay function. When delay function returns ir reads temperature and pressure related adc values
* from sensor, converts them into single variables and compensate with use #BME280_calibration_data.
* Compensated values are then converted into float.
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *Press pointer to variable where pressure will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_SLEEPMODE
* @return #BME280_BUSY_ERR sensor is busy so cannot proceed
*/
int8_t BME280_ReadPressForce_F(BME280_t *Dev, float *Press);
/**
* @brief Function forces single measure and returns humidity as floats (forced mode)
* @note Sensor must be in #BME280_SLEEPMODE to force a single measurement.
*
* Function reads sensor's configuration to check conditions and calculate max. delay time
* required for measure cycle. Then sends command to force single measurement and calls used-defined
* delay function. When delay function returns ir reads temperature and humidity related adc values
* from sensor, converts them into single variables and compensate with use #BME280_calibration_data.
* Compensated values are then converted into float.
* @param[in] *Dev pointer to sensor's #BME280_t structure
* @param[out] *Hum pointer to variable where humidity will be stored
* @return #BME280_OK success
* @return #BME280_PARAM_ERR wrong parameter passed
* @return #BME280_INTERFACE_ERR user defined read/write function returned non-zero value
* @return #BME280_NO_INIT_ERR sensor was not initialized before
* @return #BME280_CONDITION_ERR sensor is not in #BME280_SLEEPMODE
* @return #BME280_BUSY_ERR sensor is busy so cannot proceed
*/
int8_t BME280_ReadHumForce_F(BME280_t *Dev, float *Hum);
///@}
#endif
///@}
#endif
///@}
//***************************************
#ifdef __cplusplus
}
#endif /* CPP */
//***************************************
#endif /* BME280_H */
///@}