]> git.itanic.dy.fi Git - BME280_driver/blob - bme280.h
Created Bosch Sensortec BME280 driver
[BME280_driver] / bme280.h
1 /** \mainpage
2 *
3 ****************************************************************************
4 * Copyright (C) 2013 - 2014 Bosch Sensortec GmbH
5 *
6 * File : bme280.h
7 *
8 * Date : 2014/12/12
9 *
10 * Revision : 2.0.3(Pressure and Temperature compensation code revision is 1.1
11 *               and Humidity compensation code revision is 1.0)
12 *
13 * Usage: Sensor Driver for BME280 sensor
14 *
15 ****************************************************************************
16 *
17 * \section License
18 *
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions are met:
21 *
22 *   Redistributions of source code must retain the above copyright
23 *   notice, this list of conditions and the following disclaimer.
24 *
25 *   Redistributions in binary form must reproduce the above copyright
26 *   notice, this list of conditions and the following disclaimer in the
27 *   documentation and/or other materials provided with the distribution.
28 *
29 *   Neither the name of the copyright holder nor the names of the
30 *   contributors may be used to endorse or promote products derived from
31 *   this software without specific prior written permission.
32 *
33 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
34 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
35 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
36 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
37 * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
38 * OR CONTRIBUTORS BE LIABLE FOR ANY
39 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
40 * OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,
41 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
42 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
43 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
44 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
45 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
46 * ANY WAY OUT OF THE USE OF THIS
47 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
48 *
49 * The information provided is believed to be accurate and reliable.
50 * The copyright holder assumes no responsibility
51 * for the consequences of use
52 * of such information nor for any infringement of patents or
53 * other rights of third parties which may result from its use.
54 * No license is granted by implication or otherwise under any patent or
55 * patent rights of the copyright holder.
56 **************************************************************************/
57 /*! \file bme280.h
58     \brief BME280 Sensor Driver Support Header File */
59 #ifndef __BME280_H__
60 #define __BME280_H__
61
62
63 /*!
64 * @brief The following definition uses for define the data types
65 *
66 * @note While porting the API please consider the following
67 * @note Please check the version of C standard
68 * @note Are you using Linux platform
69 */
70
71 /*!
72 * @brief For the Linux platform support
73 * Please use the types.h for your data types definitions
74 */
75 #ifdef  __KERNEL__
76
77 #include <linux/types.h>
78 #include <linux/math64.h>
79 #define BME280_64BITSUPPORT_PRESENT
80 /* singed integer type*/
81 typedef int8_t s8;/**< used for signed 8bit */
82 typedef int16_t s16;/**< used for signed 16bit */
83 typedef int32_t s32;/**< used for signed 32bit */
84 typedef int64_t s64;/**< used for signed 64bit */
85
86 typedef u_int8_t u8;/**< used for unsigned 8bit */
87 typedef u_int16_t u16;/**< used for unsigned 16bit */
88 typedef u_int32_t u32;/**< used for unsigned 32bit */
89 typedef u_int64_t u64;/**< used for unsigned 64bit */
90
91
92
93 #else /* ! __KERNEL__ */
94 /**********************************************************
95 * These definition uses for define the C
96 * standard version data types
97 ***********************************************************/
98 # if !defined(__STDC_VERSION__)
99
100 /************************************************
101  * compiler is C11 C standard
102 ************************************************/
103 #if (__STDC_VERSION__ == 201112L)
104
105 /************************************************/
106 #include <stdint.h>
107 /************************************************/
108
109 /*unsigned integer types*/
110 typedef uint8_t u8;/**< used for unsigned 8bit */
111 typedef uint16_t u16;/**< used for unsigned 16bit */
112 typedef uint32_t u32;/**< used for unsigned 32bit */
113 typedef uint64_t u64;/**< used for unsigned 64bit */
114
115 /*signed integer types*/
116 typedef int8_t s8;/**< used for signed 8bit */
117 typedef int16_t s16;/**< used for signed 16bit */
118 typedef int32_t s32;/**< used for signed 32bit */
119 typedef int64_t s64;/**< used for signed 64bit */
120 #define BME280_64BITSUPPORT_PRESENT
121 /************************************************
122  * compiler is C99 C standard
123 ************************************************/
124
125 #elif (__STDC_VERSION__ == 199901L)
126
127 /* stdint.h is a C99 supported c library.
128 which is used to fixed the integer size*/
129 /************************************************/
130 #include <stdint.h>
131 /************************************************/
132
133 /*unsigned integer types*/
134 typedef uint8_t u8;/**< used for unsigned 8bit */
135 typedef uint16_t u16;/**< used for unsigned 16bit */
136 typedef uint32_t u32;/**< used for unsigned 32bit */
137 typedef uint64_t u64;/**< used for unsigned 64bit */
138
139 /*signed integer types*/
140 typedef int8_t s8;/**< used for signed 8bit */
141 typedef int16_t s16;/**< used for signed 16bit */
142 typedef int32_t s32;/**< used for signed 32bit */
143 typedef int64_t s64;/**< used for signed 64bit */
144 #define BME280_64BITSUPPORT_PRESENT
145 /************************************************
146  * compiler is C89 or other C standard
147 ************************************************/
148
149 #else /*  !defined(__STDC_VERSION__) */
150 /*!
151 * @brief By default it is defined as 32 bit machine configuration
152 *       define your data types based on your
153 *       machine/compiler/controller configuration
154 */
155 #define  MACHINE_32_BIT
156
157 /*! @brief
158  *      If your machine support 16 bit
159  *      define the MACHINE_16_BIT
160  */
161 #ifdef MACHINE_16_BIT
162 #include <limits.h>
163 /*signed integer types*/
164 typedef signed char  s8;/**< used for signed 8bit */
165 typedef signed short int s16;/**< used for signed 16bit */
166 typedef signed long int s32;/**< used for signed 32bit */
167
168 #if defined(LONG_MAX) && LONG_MAX == 0x7fffffffffffffffL
169 typedef long int s64;/**< used for signed 64bit */
170 typedef unsigned long int u64;/**< used for unsigned 64bit */
171 #define BME280_64BITSUPPORT_PRESENT
172 #elif defined(LLONG_MAX) && (LLONG_MAX == 0x7fffffffffffffffLL)
173 typedef long long int s64;/**< used for signed 64bit */
174 typedef unsigned long long int u64;/**< used for unsigned 64bit */
175 #define BME280_64BITSUPPORT_PRESENT
176 #else
177 #warning Either the correct data type for signed 64 bit integer \
178 could not be found, or 64 bit integers are not supported in your environment.
179 #warning The API will only offer 32 bit pressure calculation.This will \
180 slightly impede accuracy(noise of ~1 pascal RMS will be added to output).
181 #warning If 64 bit integers are supported on your platform, \
182 please set s64 manually and "#define(BMPE80_64BITSUPPORT_PRESENT)" manually.
183 #endif
184
185 /*unsigned integer types*/
186 typedef unsigned char u8;/**< used for unsigned 8bit */
187 typedef unsigned short int u16;/**< used for unsigned 16bit */
188 typedef unsigned long int u32;/**< used for unsigned 32bit */
189
190 /* If your machine support 32 bit
191 define the MACHINE_32_BIT*/
192 #elif defined MACHINE_32_BIT
193 /*signed integer types*/
194 typedef signed char  s8;/**< used for signed 8bit */
195 typedef signed short int s16;/**< used for signed 16bit */
196 typedef signed int s32;/**< used for signed 32bit */
197 typedef signed long long int s64;/**< used for signed 64bit */
198
199 /*unsigned integer types*/
200 typedef unsigned char u8;/**< used for unsigned 8bit */
201 typedef unsigned short int u16;/**< used for unsigned 16bit */
202 typedef unsigned int u32;/**< used for unsigned 32bit */
203 typedef unsigned long long int u64;/**< used for unsigned 64bit */
204 #define BME280_64BITSUPPORT_PRESENT
205
206 /* If your machine support 64 bit
207 define the MACHINE_64_BIT*/
208 #elif defined MACHINE_64_BIT
209 /*signed integer types*/
210 typedef signed char  s8;/**< used for signed 8bit */
211 typedef signed short int s16;/**< used for signed 16bit */
212 typedef signed int s32;/**< used for signed 32bit */
213 typedef signed long int s64;/**< used for signed 64bit */
214
215 /*unsigned integer types*/
216 typedef unsigned char u8;/**< used for unsigned 8bit */
217 typedef unsigned short int u16;/**< used for unsigned 16bit */
218 typedef unsigned int u32;/**< used for unsigned 32bit */
219 typedef unsigned long int u64;/**< used for unsigned 64bit */
220 #define BME280_64BITSUPPORT_PRESENT
221
222 #else
223 #warning The data types defined above which not supported \
224 define the data types manually
225 #endif
226 #endif
227
228 /*** This else will execute for the compilers
229  *      which are not supported the C standards
230  *      Like C89/C99/C11***/
231 #else
232 /*!
233 * @brief By default it is defined as 32 bit machine configuration
234 *       define your data types based on your
235 *       machine/compiler/controller configuration
236 */
237 #define  MACHINE_32_BIT
238
239 /* If your machine support 16 bit
240 define the MACHINE_16_BIT*/
241 #ifdef MACHINE_16_BIT
242 #include <limits.h>
243 /*signed integer types*/
244 typedef signed char  s8;/**< used for signed 8bit */
245 typedef signed short int s16;/**< used for signed 16bit */
246 typedef signed long int s32;/**< used for signed 32bit */
247
248 #if defined(LONG_MAX) && LONG_MAX == 0x7fffffffffffffffL
249 typedef long int s64;/**< used for signed 64bit */
250 typedef unsigned long int u64;/**< used for unsigned 64bit */
251 #define BME280_64BITSUPPORT_PRESENT
252 #elif defined(LLONG_MAX) && (LLONG_MAX == 0x7fffffffffffffffLL)
253 typedef long long int s64;/**< used for signed 64bit */
254 typedef unsigned long long int u64;/**< used for unsigned 64bit */
255 #define BME280_64BITSUPPORT_PRESENT
256 #else
257 #warning Either the correct data type for signed 64 bit integer \
258 could not be found, or 64 bit integers are not supported in your environment.
259 #warning The API will only offer 32 bit pressure calculation.This will \
260 slightly impede accuracy(noise of ~1 pascal RMS will be added to output).
261 #warning If 64 bit integers are supported on your platform, \
262 please set s64 manually and "#define(BME280_64BITSUPPORT_PRESENT)" manually.
263 #endif
264
265 /*unsigned integer types*/
266 typedef unsigned char u8;/**< used for unsigned 8bit */
267 typedef unsigned short int u16;/**< used for unsigned 16bit */
268 typedef unsigned long int u32;/**< used for unsigned 32bit */
269
270 /*! @brief If your machine support 32 bit
271 define the MACHINE_32_BIT*/
272 #elif defined MACHINE_32_BIT
273 /*signed integer types*/
274 typedef signed char  s8;/**< used for signed 8bit */
275 typedef signed short int s16;/**< used for signed 16bit */
276 typedef signed int s32;/**< used for signed 32bit */
277 typedef signed long long int s64;/**< used for signed 64bit */
278
279 /*unsigned integer types*/
280 typedef unsigned char u8;/**< used for unsigned 8bit */
281 typedef unsigned short int u16;/**< used for unsigned 16bit */
282 typedef unsigned int u32;/**< used for unsigned 32bit */
283 typedef unsigned long long int u64;/**< used for unsigned 64bit */
284 #define BME280_64BITSUPPORT_PRESENT
285
286 /* If your machine support 64 bit
287 define the MACHINE_64_BIT*/
288 #elif defined MACHINE_64_BIT
289 /*signed integer types*/
290 typedef signed char  s8;/**< used for signed 8bit */
291 typedef signed short int s16;/**< used for signed 16bit */
292 typedef signed int s32;/**< used for signed 32bit */
293 typedef signed long int s64;/**< used for signed 64bit */
294
295 /*unsigned integer types*/
296 typedef unsigned char u8;/**< used for unsigned 8bit */
297 typedef unsigned short int u16;/**< used for unsigned 16bit */
298 typedef unsigned int u32;/**< used for unsigned 32bit */
299 typedef unsigned long int u64;/**< used for unsigned 64bit */
300 #define BME280_64BITSUPPORT_PRESENT
301
302 #else
303 #warning The data types defined above which not supported \
304 define the data types manually
305 #endif
306 #endif
307 #endif
308 /********************************************/
309 /**\name        ENABLE FLATING OUTPUT      */
310 /**************************************/
311 /*!
312 * @brief If the user wants to support floating point calculations, please set
313         the following define. If floating point
314         calculation is not wanted or allowed
315         (e.g. in Linux kernel), please do not set the define. */
316 #define BME280_ENABLE_FLOAT
317 /*!
318 * @brief If the user wants to support 64 bit integer calculation
319         (needed for optimal pressure accuracy) please set
320         the following define. If int64 calculation is not wanted
321         (e.g. because it would include
322         large libraries), please do not set the define. */
323 #define BME280_ENABLE_INT64
324 /***************************************************************/
325 /**\name        BUS READ AND WRITE FUNCTION POINTERS        */
326 /***************************************************************/
327 /*!
328         @brief Define the calling convention of YOUR bus communication routine.
329         @note This includes types of parameters. This example shows the
330         configuration for an SPI bus link.
331
332     If your communication function looks like this:
333
334     write_my_bus_xy(u8 device_addr, u8 register_addr,
335     u8 * data, u8 length);
336
337     The BME280_WR_FUNC_PTR would equal:
338
339         BME280_WR_FUNC_PTR s8 (* bus_write)(u8,
340     u8, u8 *, u8)
341
342     Parameters can be mixed as needed refer to the
343     refer BME280_BUS_WRITE_FUNC  macro.
344
345
346 */
347 /** defines the return parameter type of the BME280_WR_FUNCTION */
348 #define BME280_BUS_WR_RETURN_TYPE s8
349
350 /* links the order of parameters defined in
351 BME280_BUS_WR_PARAM_TYPE to function calls used inside the API*/
352 #define BME280_BUS_WR_PARAM_TYPES u8, u8,\
353                 u8 *, u8
354
355 /* links the order of parameters defined in
356 BME280_BUS_WR_PARAM_TYPE to function calls used inside the API*/
357 #define BME280_BUS_WR_PARAM_ORDER(device_addr, register_addr,\
358                 register_data, wr_len)
359
360 /* never change this line */
361 #define BME280_BUS_WRITE_FUNC(device_addr, register_addr,\
362 register_data, wr_len) bus_write(device_addr, register_addr,\
363                 register_data, wr_len)
364 /*!
365         @brief link macro between API function calls and bus read function
366         @note The bus write function can change since this is a
367         system dependant issue.
368
369     If the bus_read parameter calling order is like: reg_addr,
370     reg_data, wr_len it would be as it is here.
371
372     If the parameters are differently ordered or your communication
373     function like I2C need to know the device address,
374     you can change this macro accordingly.
375
376
377     BME280_BUS_READ_FUNC(dev_addr, reg_addr, reg_data, wr_len)\
378     bus_read(dev_addr, reg_addr, reg_data, wr_len)
379
380     This macro lets all API functions call YOUR communication routine in a
381     way that equals your definition in the
382     refer BME280_WR_FUNC_PTR definition.
383
384     @note: this macro also includes the "MSB='1'
385     for reading BME280 addresses.
386
387 */
388 /*defines the return parameter type of the BME280_RD_FUNCTION
389 */
390 #define BME280_BUS_RD_RETURN_TYPE s8
391
392 /**\brief defines the calling parameter types of the BME280_RD_FUNCTION
393 */
394 #define BME280_BUS_RD_PARAM_TYPES (u8, u8,\
395                 u8 *, u8)
396
397 /* links the order of parameters defined in \
398 BME280_BUS_RD_PARAM_TYPE to function calls used inside the API
399 */
400 #define BME280_BUS_RD_PARAM_ORDER (device_addr, register_addr,\
401                 register_data)
402
403 /* never change this line */
404 #define BME280_BUS_READ_FUNC(device_addr, register_addr,\
405                 register_data, rd_len)bus_read(device_addr, register_addr,\
406                 register_data, rd_len)
407 /****************************************/
408 /**\name        DELAY       */
409 /****************************************/
410 /* defines the return parameter type of the BME280_DELAY_FUNCTION
411 */
412 #define BME280_DELAY_RETURN_TYPE void
413
414 /* defines the calling parameter types of the BME280_DELAY_FUNCTION
415 */
416 #define BME280_DELAY_PARAM_TYPES u16
417 /***************************************************************/
418 /**\name        GET AND SET BITSLICE FUNCTIONS       */
419 /***************************************************************/
420 /* never change this line */
421 #define BME280_DELAY_FUNC(delay_in_msec)\
422                 delay_func(delay_in_msec)
423
424 #define BME280_GET_BITSLICE(regvar, bitname)\
425                 ((regvar & bitname##__MSK) >> bitname##__POS)
426
427 #define BME280_SET_BITSLICE(regvar, bitname, val)\
428 ((regvar & ~bitname##__MSK) | ((val<<bitname##__POS)&bitname##__MSK))
429
430 /***************************************************************/
431 /**\name        COMMON USED CONSTANTS      */
432 /***************************************************************/
433 /* Constants */
434 #define BME280_NULL                          0
435 #define BME280_RETURN_FUNCTION_TYPE          s8
436 /* right shift definitions*/
437 #define SHIFT_RIGHT_1_POSITION                           1
438 #define SHIFT_RIGHT_2_POSITION                           2
439 #define SHIFT_RIGHT_3_POSITION                           3
440 #define SHIFT_RIGHT_4_POSITION                           4
441 #define SHIFT_RIGHT_7_POSITION                           7
442 #define SHIFT_RIGHT_8_POSITION                           8
443 #define SHIFT_RIGHT_10_POSITION                          10
444 #define SHIFT_RIGHT_11_POSITION                          11
445 #define SHIFT_RIGHT_12_POSITION                          12
446 #define SHIFT_RIGHT_13_POSITION                          13
447 #define SHIFT_RIGHT_14_POSITION                          14
448 #define SHIFT_RIGHT_15_POSITION                          15
449 #define SHIFT_RIGHT_18_POSITION                          18
450 #define SHIFT_RIGHT_19_POSITION                          19
451 #define SHIFT_RIGHT_25_POSITION                          25
452 #define SHIFT_RIGHT_33_POSITION                          33
453 /* left shift definitions*/
454 #define SHIFT_LEFT_1_POSITION                1
455 #define SHIFT_LEFT_2_POSITION                2
456 #define SHIFT_LEFT_4_POSITION                4
457 #define SHIFT_LEFT_5_POSITION                5
458 #define SHIFT_LEFT_8_POSITION                8
459 #define SHIFT_LEFT_12_POSITION               12
460 #define SHIFT_LEFT_13_POSITION               13
461 #define SHIFT_LEFT_14_POSITION               14
462 #define SHIFT_LEFT_16_POSITION               16
463 #define SHIFT_LEFT_17_POSITION               17
464 #define SHIFT_LEFT_20_POSITION               20
465 #define SHIFT_LEFT_31_POSITION               31
466 #define SHIFT_LEFT_35_POSITION               35
467 #define SHIFT_LEFT_47_POSITION               47
468 /* numeric definitions*/
469 #define BME280_ONE_U8X                       1
470 #define BME280_TWO_U8X                       2
471 #define BME280_THREE_U8X                     3
472 #define BME280_FOUR_U8X                      4
473 #define BME280_FIVE_U8X                      5
474 #define BME280_SEVEN_U8X                     7
475 #define BME280_ZERO_U8X                      0
476 #define BME280_EIGHT_U8X                     8
477 #define BME280_FIVETEEN_U8X                  15
478 #define BME280_SIXTEEN_U8X                   16
479 #define BME280_TWENTY_FIVE_U8X               25
480 #define BME280_TWENTY_SIX_U8X                26
481 #define BME280_ONE_TWENTY_EIGHT_U8X          128
482
483 /***************************************************************/
484 /**\name        PRESSURE AND TEMPERATURE DEFINITIONS     */
485 /***************************************************************/
486 #define BME280_TEMP_1_2_2_8_8_0_DATA            122880
487 #define BME280_PRESSURE_6_4_0_0_0_DATA          64000
488 #define BME280_PRESSURE_3_1_2_5_DATA            3125
489 #define BME280_PRESSURE_3_2_7_6_8_DATA          32768
490 #define BME280_PRESSURE_1_0_4_8_5_7_6_DATA                      1048576
491 #define BME280_HEX_PRESSURE_8_0_0_0_0_0_0_0_DATA        0x80000000
492 /***************************************************************/
493 /**\name        HUMIDITY DEFINITIONS      */
494 /***************************************************************/
495 #define BME280_HUMIDITY_7_6_8_0_0_DATA                          76800
496 #define BME280_HUMIDITY_1_6_3_8_4_DATA                          16384
497 #define BME280_HUMIDITY_3_2_7_6_8_DATA                          32768
498 #define BME280_HUMIDITY_2_0_9_7_1_5_2_DATA                      2097152
499 #define BME280_HUMIDITY_8_1_9_2_DATA                            8192
500 #define BME280_HUMIDITY_4_1_9_4_3_0_4_0_0_DATA          419430400
501 /***************************************************************/
502 /**\name        CALIBRATION MASK DEFINITION      */
503 /***************************************************************/
504 #define BME280_HEX_CALIB_0_F_DATA               0x0F
505
506 /****************************************************/
507 /**\name        TRUE TEMPERATURE CALUCULATION PARAMETERS  */
508 /***************************************************/
509 #define BME280_DEC_TRUE_TEMP_FIVE_DATA                                  5
510 #define BME280_DEC_TRUE_TEMP_ONE_TWO_EIGHT_DATA                 128
511 /****************************************************/
512 /**\name        TRUE PRESSURE CALUCULATION PARAMETERS  */
513 /***************************************************/
514 #define BME280_DEC_TRUE_PRESSURE_6_4_0_0_0_DATA                 64000
515 #define BME280_DEC_TRUE_PRESSURE_TWO_DATA                               2
516 #define BME280_DEC_TRUE_PRESSURE_3_2_7_6_8_DATA                 32768
517 #define BME280_DEC_TRUE_PRESSURE_1_0_4_8_5_7_6_DATA             1048576
518 #define BME280_DEC_TRUE_PRESSURE_3_1_2_5_DATA                   3125
519 #define BME280_HEX_TRUE_PRESSURE_8_0_0_0_0_0_0_0_DATA   0x80000000
520
521 /****************************************************/
522 /**\name        TRUE TEMPERATURE CALUCULATION FLOAT RETURN  */
523 /***************************************************/
524 #define BME280_FLOAT_TRUE_TEMP_1_6_3_8_4_DATA           16384.0
525 #define BME280_FLOAT_TRUE_TEMP_1_0_2_4_DATA                     1024.0
526 #define BME280_FLOAT_TRUE_TEMP_1_3_1_0_7_2_DATA         131072.0
527 #define BME280_FLOAT_TRUE_TEMP_8_1_9_2_DATA                     8192.0
528 #define BME280_FLOAT_TRUE_TEMP_5_1_2_0_DATA                     5120.0
529
530 /****************************************************/
531 /**\name        TRUE PRESSURE CALUCULATION FLOAT RETURN  */
532 /***************************************************/
533 #define BME280_FLAOT_TRUE_PRESSURE_1_DATA               1.0
534 #define BME280_FLAOT_TRUE_PRESSURE_0_DATA               0.0
535 #define BME280_FLAOT_TRUE_PRESSURE_2_DATA               2.0
536 #define BME280_FLAOT_TRUE_PRESSURE_4_DATA               4.0
537 #define BME280_FLAOT_TRUE_PRESSURE_1_6_DATA                             16.0
538 #define BME280_FLAOT_TRUE_PRESSURE_6_4_0_0_0_DATA               64000.0
539 #define BME280_FLAOT_TRUE_PRESSURE_3_2_7_6_8_DATA               32768.0
540 #define BME280_FLAOT_TRUE_PRESSURE_6_5_5_3_6_DATA               65536.0
541 #define BME280_FLAOT_TRUE_PRESSURE_5_2_4_2_8_8_DATA             524288.0
542 #define BME280_FLAOT_TRUE_PRESSURE_1_0_4_8_5_7_6_DATA   1048576.0
543 #define BME280_FLAOT_TRUE_PRESSURE_4_0_9_6_DATA                 4096.0
544 #define BME280_FLAOT_TRUE_PRESSURE_6_2_5_0_DATA                 6250.0
545 #define BME280_FLAOT_TRUE_PRESSURE_2_1_4_7_4_8_3_6_4_8_DATA             \
546 2147483648.0
547
548 /****************************************************/
549 /**\name        TRUE PRESSURE CALUCULATION 64BIT RETURN  */
550 /***************************************************/
551 #define BME280_TRUE_PRESSURE_1_2_8_0_0_0_DATA           128000
552 #define BME280_TRUE_PRESSURE_1_0_4_8_5_7_6_DATA         1048576
553 #define BME280_TRUE_PRESSURE_3_1_2_5_DATA                       3125
554 #define BME280_TRUE_PRESSURE_1_DATA                                     1
555 /****************************************************/
556 /**\name        TRUE HUMIDITY CALUCULATION FLOAT RETURN  */
557 /***************************************************/
558 #define BME280_TRUE_HUMIDITY_7_6_8_0_0_DATA                     76800.0
559 #define BME280_TRUE_HUMIDITY_6_4_DATA                           64.0
560 #define BME280_TRUE_HUMIDITY_1_6_3_8_4_DATA                     16384.0
561 #define BME280_TRUE_HUMIDITY_6_5_5_3_6_DATA                     65536.0
562 #define BME280_TRUE_HUMIDITY_0_DATA                                     0.0
563 #define BME280_TRUE_HUMIDITY_1_DATA                                     1.0
564 #define BME280_TRUE_HUMIDITY_1_0_0_DATA                         100.0
565 #define BME280_TRUE_HUMIDITY_6_7_1_0_8_8_6_4_DATA       67108864.0
566 #define BME280_TRUE_HUMIDITY_5_2_4_2_8_8_DATA           524288.0
567 #define BME280_TRUE_HUMIDITY_
568 /****************************************************/
569 /**\name        ERROR CODE DEFINITIONS  */
570 /***************************************************/
571 #define SUCCESS                                 ((u8)0)
572 #define E_BME280_NULL_PTR       ((s8)-127)
573 #define E_BME280_COMM_RES       ((s8)-1)
574 #define E_BME280_OUT_OF_RANGE   ((s8)-2)
575 #define ERROR                                   ((s8)-1)
576 /****************************************************/
577 /**\name        I2C ADDRESS DEFINITIONS  */
578 /***************************************************/
579 #define BME280_I2C_ADDRESS1                  0x76
580 #define BME280_I2C_ADDRESS2                  0x77
581 /****************************************************/
582 /**\name        POWER MODE DEFINITIONS  */
583 /***************************************************/
584 /* Sensor Specific constants */
585 #define BME280_SLEEP_MODE                    0x00
586 #define BME280_FORCED_MODE                   0x01
587 #define BME280_NORMAL_MODE                   0x03
588 #define BME280_SOFT_RESET_CODE               0xB6
589 /****************************************************/
590 /**\name        STANDBY DEFINITIONS  */
591 /***************************************************/
592 #define BME280_STANDBY_TIME_1_MS              0x00
593 #define BME280_STANDBY_TIME_63_MS             0x01
594 #define BME280_STANDBY_TIME_125_MS                        0x02
595 #define BME280_STANDBY_TIME_250_MS            0x03
596 #define BME280_STANDBY_TIME_500_MS            0x04
597 #define BME280_STANDBY_TIME_1000_MS           0x05
598 #define BME280_STANDBY_TIME_10_MS             0x06
599 #define BME280_STANDBY_TIME_20_MS             0x07
600 /****************************************************/
601 /**\name        OVER SAMPLING DEFINITIONS  */
602 /***************************************************/
603 #define BME280_OVERSAMP_SKIPPED          0x00
604 #define BME280_OVERSAMP_1X               0x01
605 #define BME280_OVERSAMP_2X               0x02
606 #define BME280_OVERSAMP_4X               0x03
607 #define BME280_OVERSAMP_8X               0x04
608 #define BME280_OVERSAMP_16X              0x05
609 /****************************************************/
610 /**\name        WORK MODE DEFINITIONS  */
611 /***************************************************/
612 /*#define BME280_ULTRALOWPOWER_MODE            0x00
613 #define BME280_LOWPOWER_MODE                 0x01
614 #define BME280_STANDARDRESOLUTION_MODE       0x02
615 #define BME280_HIGHRESOLUTION_MODE           0x03
616 #define BME280_ULTRAHIGHRESOLUTION_MODE      0x04
617
618 #define BME280_ULTRALOWPOWER_OSRS_P          BME280_OVERSAMP_1X
619 #define BME280_ULTRALOWPOWER_OSRS_T          BME280_OVERSAMP_1X
620
621 #define BME280_LOWPOWER_OSRS_P               BME280_OVERSAMP_2X
622 #define BME280_LOWPOWER_OSRS_T               BME280_OVERSAMP_1X
623
624 #define BME280_STANDARDRESOLUTION_OSRS_P     BME280_OVERSAMP_4X
625 #define BME280_STANDARDRESOLUTION_OSRS_T     BME280_OVERSAMP_1X
626
627 #define BME280_HIGHRESOLUTION_OSRS_P         BME280_OVERSAMP_8X
628 #define BME280_HIGHRESOLUTION_OSRS_T         BME280_OVERSAMP_1X
629
630 #define BME280_ULTRAHIGHRESOLUTION_OSRS_P    BME280_OVERSAMP_16X
631 #define BME280_ULTRAHIGHRESOLUTION_OSRS_T    BME280_OVERSAMP_2X */
632
633 #define BME280_STANDARD_OVERSAMP_HUMIDITY       BME280_OVERSAMP_1X
634 /****************************************************/
635 /**\name        FILTER DEFINITIONS  */
636 /***************************************************/
637 #define BME280_FILTER_COEFF_OFF               0x00
638 #define BME280_FILTER_COEFF_2                 0x01
639 #define BME280_FILTER_COEFF_4                 0x02
640 #define BME280_FILTER_COEFF_8                 0x03
641 #define BME280_FILTER_COEFF_16                0x04
642 /****************************************************/
643 /**\name        DELAY DEFINITIONS  */
644 /***************************************************/
645 #define T_INIT_MAX                             20
646                 /* 20/16 = 1.25 ms */
647 #define T_MEASURE_PER_OSRS_MAX                 37
648                 /* 37/16 = 2.3125 ms*/
649
650 #define T_SETUP_PRESSURE_MAX                   10
651                 /* 10/16 = 0.625 ms */
652
653 #define T_SETUP_HUMIDITY_MAX                   10
654                 /* 10/16 = 0.625 ms */
655 /****************************************************/
656 /**\name        ARRAY SIZE DEFINITIONS      */
657 /***************************************************/
658 #define ARRAY_SIZE_TWO          2
659 #define ARRAY_SIZE_THREE        3
660 #define ARRAY_SIZE_SIX          6
661 #define ARRAY_SIZE_FIVE         5
662 #define ARRAY_SIZE_EIGHT        8
663 #define ARRAY_SIZE_TWELVE       12
664 #define ARRAY_SIZE_FOURTEEN     14
665 #define ARRAY_SIZE_TWENTY_SIX   26
666
667 #define INDEX_ZERO              0
668 #define INDEX_ONE               1
669 #define INDEX_TWO               2
670 #define INDEX_THREE             3
671 #define INDEX_FOUR              4
672 #define INDEX_FIVE              5
673 #define INDEX_SIX               6
674 #define INDEX_SEVEN             7
675 #define INDEX_EIGHT             8
676 #define INDEX_NINE              9
677 #define INDEX_TEN               10
678 #define INDEX_ELEVEN    11
679 #define INDEX_TWELVE    12
680 #define INDEX_THIRTEEN  13
681 #define INDEX_FOURTEEN  14
682 #define INDEX_FIVETEEN  15
683 #define INDEX_SIXTEEN   16
684 #define INDEX_SEVENTEEN 17
685 #define INDEX_EIGHTEEN  18
686 #define INDEX_NINETEEN  19
687 #define INDEX_TWENTY    20
688 #define INDEX_TWENTY_ONE        21
689 #define INDEX_TWENTY_TWO        22
690 #define INDEX_TWENTY_THREE      23
691 #define INDEX_TWENTY_FIVE       25
692 /****************************************************/
693 /**\name        ARRAY PARAMETERS      */
694 /***************************************************/
695 #define LSB_ZERO        0
696 #define MSB_ONE         1
697 #define LSB_TWO         2
698 #define MSB_THREE       3
699 #define LSB_FOUR        4
700 #define MSB_FIVE        5
701 #define LSB_SIX         6
702 #define MSB_SEVEN       7
703 /****************************************************/
704 /**\name        CALIBRATION REGISTER ADDRESS DEFINITIONS  */
705 /***************************************************/
706 /*calibration parameters */
707 #define BME280_DIG_T1_LSB_REG                0x88
708 #define BME280_DIG_T1_MSB_REG                0x89
709 #define BME280_DIG_T2_LSB_REG                0x8A
710 #define BME280_DIG_T2_MSB_REG                0x8B
711 #define BME280_DIG_T3_LSB_REG                0x8C
712 #define BME280_DIG_T3_MSB_REG                0x8D
713 #define BME280_DIG_P1_LSB_REG                0x8E
714 #define BME280_DIG_P1_MSB_REG                0x8F
715 #define BME280_DIG_P2_LSB_REG                0x90
716 #define BME280_DIG_P2_MSB_REG                0x91
717 #define BME280_DIG_P3_LSB_REG                0x92
718 #define BME280_DIG_P3_MSB_REG                0x93
719 #define BME280_DIG_P4_LSB_REG                0x94
720 #define BME280_DIG_P4_MSB_REG                0x95
721 #define BME280_DIG_P5_LSB_REG                0x96
722 #define BME280_DIG_P5_MSB_REG                0x97
723 #define BME280_DIG_P6_LSB_REG                0x98
724 #define BME280_DIG_P6_MSB_REG                0x99
725 #define BME280_DIG_P7_LSB_REG                0x9A
726 #define BME280_DIG_P7_MSB_REG                0x9B
727 #define BME280_DIG_P8_LSB_REG                0x9C
728 #define BME280_DIG_P8_MSB_REG                0x9D
729 #define BME280_DIG_P9_LSB_REG                0x9E
730 #define BME280_DIG_P9_MSB_REG                0x9F
731
732 #define BME280_DIG_H1_REG                    0xA1
733
734 #define BME280_DIG_H2_LSB_REG                0xE1
735 #define BME280_DIG_H2_MSB_REG                0xE2
736 #define BME280_DIG_H3_REG                    0xE3
737 #define BME280_DIG_H4_MSB_REG                0xE4
738 #define BME280_DIG_H5_LSB_H4_LSB_REG         0xE5
739 #define BME280_DIG_H5_MSB_REG                0xE6
740 #define BME280_DIG_H6_REG                    0xE7
741 /****************************************************/
742 /**\name        REGISTER ADDRESS DEFINITIONS  */
743 /***************************************************/
744 #define BME280_CHIP_ID_REG                   0xD0  /*Chip ID Register */
745 #define BME280_RST_REG                       0xE0  /*Softreset Register */
746 #define BME280_STAT_REG                      0xF3  /*Status Register */
747 #define BME280_CTRL_MEAS_REG                 0xF4  /*Ctrl Measure Register */
748 #define BME280_CTRL_HUMIDITY_REG             0xF2  /*Ctrl Humidity Register*/
749 #define BME280_CONFIG_REG                    0xF5  /*Configuration Register */
750 #define BME280_PRESSURE_MSB_REG              0xF7  /*Pressure MSB Register */
751 #define BME280_PRESSURE_LSB_REG              0xF8  /*Pressure LSB Register */
752 #define BME280_PRESSURE_XLSB_REG             0xF9  /*Pressure XLSB Register */
753 #define BME280_TEMPERATURE_MSB_REG           0xFA  /*Temperature MSB Reg */
754 #define BME280_TEMPERATURE_LSB_REG           0xFB  /*Temperature LSB Reg */
755 #define BME280_TEMPERATURE_XLSB_REG          0xFC  /*Temperature XLSB Reg */
756 #define BME280_HUMIDITY_MSB_REG              0xFD  /*Humidity MSB Reg */
757 #define BME280_HUMIDITY_LSB_REG              0xFE  /*Humidity LSB Reg */
758 /****************************************************/
759 /**\name        BIT MASK, LENGTH AND POSITION DEFINITIONS  */
760 /***************************************************/
761 /* Status Register */
762 #define BME280_STAT_REG_MEASURING__POS           3
763 #define BME280_STAT_REG_MEASURING__MSK           0x08
764 #define BME280_STAT_REG_MEASURING__LEN           1
765 #define BME280_STAT_REG_MEASURING__REG           BME280_STAT_REG
766
767 #define BME280_STAT_REG_IM_UPDATE__POS            0
768 #define BME280_STAT_REG_IM_UPDATE__MSK            0x01
769 #define BME280_STAT_REG_IM_UPDATE__LEN            1
770 #define BME280_STAT_REG_IM_UPDATE__REG            BME280_STAT_REG
771 /****************************************************/
772 /**\name        BIT MASK, LENGTH AND POSITION DEFINITIONS
773 FOR TEMPERATURE OVERSAMPLING  */
774 /***************************************************/
775 /* Control Measurement Register */
776 #define BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__POS             5
777 #define BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__MSK             0xE0
778 #define BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__LEN             3
779 #define BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__REG             \
780 BME280_CTRL_MEAS_REG
781 /****************************************************/
782 /**\name        BIT MASK, LENGTH AND POSITION DEFINITIONS
783 FOR PRESSURE OVERSAMPLING  */
784 /***************************************************/
785 #define BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__POS             2
786 #define BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__MSK             0x1C
787 #define BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__LEN             3
788 #define BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__REG             \
789 BME280_CTRL_MEAS_REG
790 /****************************************************/
791 /**\name        BIT MASK, LENGTH AND POSITION DEFINITIONS
792 FOR POWER MODE  */
793 /***************************************************/
794 #define BME280_CTRL_MEAS_REG_POWER_MODE__POS              0
795 #define BME280_CTRL_MEAS_REG_POWER_MODE__MSK              0x03
796 #define BME280_CTRL_MEAS_REG_POWER_MODE__LEN              2
797 #define BME280_CTRL_MEAS_REG_POWER_MODE__REG              \
798 BME280_CTRL_MEAS_REG
799 /****************************************************/
800 /**\name        BIT MASK, LENGTH AND POSITION DEFINITIONS
801 FOR HUMIDITY OVERSAMPLING  */
802 /***************************************************/
803 #define BME280_CTRL_HUMIDITY_REG_OVERSAM_HUMIDITY__POS             0
804 #define BME280_CTRL_HUMIDITY_REG_OVERSAM_HUMIDITY__MSK             0x07
805 #define BME280_CTRL_HUMIDITY_REG_OVERSAM_HUMIDITY__LEN             3
806 #define BME280_CTRL_HUMIDITY_REG_OVERSAM_HUMIDITY__REG            \
807 BME280_CTRL_HUMIDITY_REG
808 /****************************************************/
809 /**\name        BIT MASK, LENGTH AND POSITION DEFINITIONS
810 FOR STANDBY TIME  */
811 /***************************************************/
812 /* Configuration Register */
813 #define BME280_CONFIG_REG_TSB__POS                 5
814 #define BME280_CONFIG_REG_TSB__MSK                 0xE0
815 #define BME280_CONFIG_REG_TSB__LEN                 3
816 #define BME280_CONFIG_REG_TSB__REG                 BME280_CONFIG_REG
817 /****************************************************/
818 /**\name        BIT MASK, LENGTH AND POSITION DEFINITIONS
819 FOR FILTER */
820 /***************************************************/
821 #define BME280_CONFIG_REG_FILTER__POS              2
822 #define BME280_CONFIG_REG_FILTER__MSK              0x1C
823 #define BME280_CONFIG_REG_FILTER__LEN              3
824 #define BME280_CONFIG_REG_FILTER__REG              BME280_CONFIG_REG
825 /****************************************************/
826 /**\name        BIT MASK, LENGTH AND POSITION DEFINITIONS
827 FOR SPI ENABLE  */
828 /***************************************************/
829 #define BME280_CONFIG_REG_SPI3_ENABLE__POS             0
830 #define BME280_CONFIG_REG_SPI3_ENABLE__MSK             0x01
831 #define BME280_CONFIG_REG_SPI3_ENABLE__LEN             1
832 #define BME280_CONFIG_REG_SPI3_ENABLE__REG             BME280_CONFIG_REG
833 /****************************************************/
834 /**\name        BIT MASK, LENGTH AND POSITION DEFINITIONS
835 FOR PRESSURE AND TEMPERATURE DATA  */
836 /***************************************************/
837 /* Data Register */
838 #define BME280_PRESSURE_XLSB_REG_DATA__POS         4
839 #define BME280_PRESSURE_XLSB_REG_DATA__MSK         0xF0
840 #define BME280_PRESSURE_XLSB_REG_DATA__LEN         4
841 #define BME280_PRESSURE_XLSB_REG_DATA__REG         BME280_PRESSURE_XLSB_REG
842
843 #define BME280_TEMPERATURE_XLSB_REG_DATA__POS      4
844 #define BME280_TEMPERATURE_XLSB_REG_DATA__MSK      0xF0
845 #define BME280_TEMPERATURE_XLSB_REG_DATA__LEN      4
846 #define BME280_TEMPERATURE_XLSB_REG_DATA__REG      BME280_TEMPERATURE_XLSB_REG
847 /****************************************************/
848 /**\name        BUS READ AND WRITE FUNCTION POINTERS */
849 /***************************************************/
850 #define BME280_WR_FUNC_PTR\
851                 s8 (*bus_write)(u8, u8,\
852                 u8 *, u8)
853
854 #define BME280_RD_FUNC_PTR\
855                 s8 (*bus_read)(u8, u8,\
856                 u8 *, u8)
857
858 #define BME280_MDELAY_DATA_TYPE u16
859
860 #define BME280_3MS_DELAY        3
861 /**************************************************************/
862 /**\name        STRUCTURE DEFINITIONS                         */
863 /**************************************************************/
864 /*!
865  * @brief This structure holds all device specific calibration parameters
866  */
867 struct bme280_calibration_param_t {
868         u16 dig_T1;/**<calibration T1 data*/
869         s16 dig_T2;/**<calibration T2 data*/
870         s16 dig_T3;/**<calibration T3 data*/
871         u16 dig_P1;/**<calibration P1 data*/
872         s16 dig_P2;/**<calibration P2 data*/
873         s16 dig_P3;/**<calibration P3 data*/
874         s16 dig_P4;/**<calibration P4 data*/
875         s16 dig_P5;/**<calibration P5 data*/
876         s16 dig_P6;/**<calibration P6 data*/
877         s16 dig_P7;/**<calibration P7 data*/
878         s16 dig_P8;/**<calibration P8 data*/
879         s16 dig_P9;/**<calibration P9 data*/
880
881         u8  dig_H1;/**<calibration H1 data*/
882         s16 dig_H2;/**<calibration H2 data*/
883         u8  dig_H3;/**<calibration H3 data*/
884         s16 dig_H4;/**<calibration H4 data*/
885         s16 dig_H5;/**<calibration H5 data*/
886         s8  dig_H6;/**<calibration H6 data*/
887
888         s32 t_fine;/**<calibration T_FINE data*/
889 };
890 /*!
891  * @brief This structure holds BME280 initialization parameters
892  */
893 struct bme280_t {
894         struct bme280_calibration_param_t cal_param;
895         /**< calibration parameters*/
896
897         u8 chip_id;/**< chip id of the sensor*/
898         u8 dev_addr;/**< device address of the sensor*/
899
900         u8 oversamp_temperature;/**< temperature over sampling*/
901         u8 oversamp_pressure;/**< pressure over sampling*/
902         u8 oversamp_humidity;/**< humidity over sampling*/
903         u8 ctrl_hum_reg;/**< status of control humidity register*/
904         u8 ctrl_meas_reg;/**< status of control measurement register*/
905         u8 config_reg;/**< status of configuration register*/
906         BME280_WR_FUNC_PTR;/**< bus write function pointer*/
907         BME280_RD_FUNC_PTR;/**< bus read function pointer*/
908         void(*delay_msec)(BME280_MDELAY_DATA_TYPE);/**< delay function pointer*/
909 };
910 /**************************************************************/
911 /**\name        FUNCTION DECLARATIONS                         */
912 /**************************************************************/
913 /**************************************************************/
914 /**\name        FUNCTION FOR  INTIALIZATION                       */
915 /**************************************************************/
916 /*!
917  *      @brief This function is used for initialize
918  *      the bus read and bus write functions
919  *  and assign the chip id and I2C address of the BME280 sensor
920  *      chip id is read in the register 0xD0 bit from 0 to 7
921  *
922  *       @param bme280 structure pointer.
923  *
924  *      @note While changing the parameter of the bme280_t
925  *      @note consider the following point:
926  *      Changing the reference value of the parameter
927  *      will changes the local copy or local reference
928  *      make sure your changes will not
929  *      affect the reference value of the parameter
930  *      (Better case don't change the reference value of the parameter)
931  *
932  *
933  *
934  *
935  *      @return results of bus communication function
936  *      @retval 0 -> Success
937  *      @retval -1 -> Error
938  *
939  *
940 */
941 BME280_RETURN_FUNCTION_TYPE bme280_init(struct bme280_t *bme280);
942 /**************************************************************/
943 /**\name        FUNCTION FOR  INTIALIZATION UNCOMPENSATED TEMPERATURE */
944 /**************************************************************/
945 /*!
946  *      @brief This API is used to read uncompensated temperature
947  *      in the registers 0xFA, 0xFB and 0xFC
948  *      @note 0xFA -> MSB -> bit from 0 to 7
949  *      @note 0xFB -> LSB -> bit from 0 to 7
950  *      @note 0xFC -> LSB -> bit from 4 to 7
951  *
952  * @param v_uncomp_temperature_s32 : The value of uncompensated temperature
953  *
954  *
955  *
956  *      @return results of bus communication function
957  *      @retval 0 -> Success
958  *      @retval -1 -> Error
959  *
960  *
961 */
962 BME280_RETURN_FUNCTION_TYPE bme280_read_uncomp_temperature(
963 s32 *v_uncomp_temperature_s32);
964 /**************************************************************/
965 /**\name        FUNCTION FOR  INTIALIZATION TRUE TEMPERATURE */
966 /**************************************************************/
967 /*!
968  * @brief Reads actual temperature from uncompensated temperature
969  * @note Returns the value in 0.01 degree Centigrade
970  * Output value of "5123" equals 51.23 DegC.
971  *
972  *
973  *
974  *  @param  v_uncomp_temperature_s32 : value of uncompensated temperature
975  *
976  *
977  *  @return Returns the actual temperature
978  *
979 */
980 s32 bme280_compensate_T_int32(s32 v_uncomp_temperature_s32);
981 /*!
982  * @brief Reads actual temperature from uncompensated temperature
983  * @note Returns the value with 500LSB/DegC centred around 24 DegC
984  * output value of "5123" equals(5123/500)+24 = 34.246DegC
985  *
986  *
987  *  @param v_uncomp_temperature_s32: value of uncompensated temperature
988  *
989  *
990  *
991  *  @return Return the actual temperature as s16 output
992  *
993 */
994 s16 bme280_compensate_T_int32_sixteen_bit_output(s32 v_uncomp_temperature_s32);
995 /**************************************************************/
996 /**\name        FUNCTION FOR  INTIALIZATION UNCOMPENSATED PRESSURE */
997 /**************************************************************/
998 /*!
999  *      @brief This API is used to read uncompensated pressure.
1000  *      in the registers 0xF7, 0xF8 and 0xF9
1001  *      @note 0xF7 -> MSB -> bit from 0 to 7
1002  *      @note 0xF8 -> LSB -> bit from 0 to 7
1003  *      @note 0xF9 -> LSB -> bit from 4 to 7
1004  *
1005  *
1006  *
1007  *      @param v_uncomp_pressure_s32 : The value of uncompensated pressure
1008  *
1009  *
1010  *
1011  *      @return results of bus communication function
1012  *      @retval 0 -> Success
1013  *      @retval -1 -> Error
1014  *
1015  *
1016 */
1017 BME280_RETURN_FUNCTION_TYPE bme280_read_uncomp_pressure(
1018 s32 *v_uncomp_pressure_s32);
1019 /**************************************************************/
1020 /**\name        FUNCTION FOR  INTIALIZATION TRUE PRESSURE */
1021 /**************************************************************/
1022 /*!
1023  * @brief Reads actual pressure from uncompensated pressure
1024  * @note Returns the value in Pascal(Pa)
1025  * Output value of "96386" equals 96386 Pa =
1026  * 963.86 hPa = 963.86 millibar
1027  *
1028  *
1029  *
1030  *  @param v_uncomp_pressure_s32 : value of uncompensated pressure
1031  *
1032  *
1033  *
1034  *  @return Return the actual pressure output as u32
1035  *
1036 */
1037 u32 bme280_compensate_P_int32(s32 v_uncomp_pressure_s32);
1038 /**************************************************************/
1039 /**\name        FUNCTION FOR  INTIALIZATION UNCOMPENSATED HUMIDITY */
1040 /**************************************************************/
1041 /*!
1042  *      @brief This API is used to read uncompensated humidity.
1043  *      in the registers 0xF7, 0xF8 and 0xF9
1044  *      @note 0xFD -> MSB -> bit from 0 to 7
1045  *      @note 0xFE -> LSB -> bit from 0 to 7
1046  *
1047  *
1048  *
1049  *      @param v_uncomp_humidity_s32 : The value of uncompensated humidity
1050  *
1051  *
1052  *
1053  *      @return results of bus communication function
1054  *      @retval 0 -> Success
1055  *      @retval -1 -> Error
1056  *
1057  *
1058 */
1059 BME280_RETURN_FUNCTION_TYPE bme280_read_uncomp_humidity(
1060 s32 *v_uncomp_humidity_s32);
1061 /**************************************************************/
1062 /**\name        FUNCTION FOR  INTIALIZATION RELATIVE HUMIDITY */
1063 /**************************************************************/
1064 /*!
1065  * @brief Reads actual humidity from uncompensated humidity
1066  * @note Returns the value in %rH as unsigned 32bit integer
1067  * in Q22.10 format(22 integer 10 fractional bits).
1068  * @note An output value of 42313
1069  * represents 42313 / 1024 = 41.321 %rH
1070  *
1071  *
1072  *
1073  *  @param  v_uncomp_humidity_s32: value of uncompensated humidity
1074  *
1075  *  @return Return the actual relative humidity output as u32
1076  *
1077 */
1078 u32 bme280_compensate_H_int32(s32 v_uncomp_humidity_s32);
1079 /*!
1080  * @brief Reads actual humidity from uncompensated humidity
1081  * @note Returns the value in %rH as unsigned 16bit integer
1082  * @note An output value of 42313
1083  * represents 42313/512 = 82.643 %rH
1084  *
1085  *
1086  *
1087  *  @param v_uncomp_humidity_s32: value of uncompensated humidity
1088  *
1089  *
1090  *  @return Return the actual relative humidity output as u16
1091  *
1092 */
1093 u16 bme280_compensate_H_int32_sixteen_bit_output(s32 v_uncomp_humidity_s32);
1094 /**************************************************************/
1095 /**\name        FUNCTION FOR  INTIALIZATION UNCOMPENSATED PRESSURE,
1096  TEMPERATURE AND HUMIDITY */
1097 /**************************************************************/
1098 /*!
1099  * @brief This API used to read uncompensated
1100  * pressure,temperature and humidity
1101  *
1102  *
1103  *
1104  *
1105  *  @param  v_uncomp_pressure_s32: The value of uncompensated pressure.
1106  *  @param  v_uncomp_temperature_s32: The value of uncompensated temperature
1107  *  @param  v_uncomp_humidity_s32: The value of uncompensated humidity.
1108  *
1109  *
1110  *
1111  *      @return results of bus communication function
1112  *      @retval 0 -> Success
1113  *      @retval -1 -> Error
1114  *
1115  *
1116 */
1117 BME280_RETURN_FUNCTION_TYPE bme280_read_uncomp_pressure_temperature_humidity(
1118 s32 *v_uncomp_pressure_s32,
1119 s32 *v_uncomp_temperature_s32, s32 *v_uncomp_humidity_s32);
1120 /**************************************************************/
1121 /**\name        FUNCTION FOR TRUE UNCOMPENSATED PRESSURE,
1122  TEMPERATURE AND HUMIDITY */
1123 /**************************************************************/
1124 /*!
1125  * @brief This API used to read true pressure, temperature and humidity
1126  *
1127  *
1128  *
1129  *
1130  *      @param  v_pressure_u32 : The value of compensated pressure.
1131  *      @param  v_temperature_s32 : The value of compensated temperature.
1132  *      @param  v_humidity_u32 : The value of compensated humidity.
1133  *
1134  *
1135  *      @return results of bus communication function
1136  *      @retval 0 -> Success
1137  *      @retval -1 -> Error
1138  *
1139  *
1140 */
1141 BME280_RETURN_FUNCTION_TYPE bme280_read_pressure_temperature_humidity(
1142 u32 *v_pressure_u32, s32 *v_temperature_s32, u32 *v_humidity_u32);
1143 /**************************************************************/
1144 /**\name        FUNCTION FOR CALIBRATION */
1145 /**************************************************************/
1146 /*!
1147  *      @brief This API is used to
1148  *      calibration parameters used for calculation in the registers
1149  *
1150  *  parameter | Register address |   bit
1151  *------------|------------------|----------------
1152  *      dig_T1    |  0x88 and 0x89   | from 0 : 7 to 8: 15
1153  *      dig_T2    |  0x8A and 0x8B   | from 0 : 7 to 8: 15
1154  *      dig_T3    |  0x8C and 0x8D   | from 0 : 7 to 8: 15
1155  *      dig_P1    |  0x8E and 0x8F   | from 0 : 7 to 8: 15
1156  *      dig_P2    |  0x90 and 0x91   | from 0 : 7 to 8: 15
1157  *      dig_P3    |  0x92 and 0x93   | from 0 : 7 to 8: 15
1158  *      dig_P4    |  0x94 and 0x95   | from 0 : 7 to 8: 15
1159  *      dig_P5    |  0x96 and 0x97   | from 0 : 7 to 8: 15
1160  *      dig_P6    |  0x98 and 0x99   | from 0 : 7 to 8: 15
1161  *      dig_P7    |  0x9A and 0x9B   | from 0 : 7 to 8: 15
1162  *      dig_P8    |  0x9C and 0x9D   | from 0 : 7 to 8: 15
1163  *      dig_P9    |  0x9E and 0x9F   | from 0 : 7 to 8: 15
1164  *      dig_H1    |         0xA1     | from 0 to 7
1165  *      dig_H2    |  0xE1 and 0xE2   | from 0 : 7 to 8: 15
1166  *      dig_H3    |         0xE3     | from 0 to 7
1167  *
1168  *      @return results of bus communication function
1169  *      @retval 0 -> Success
1170  *      @retval -1 -> Error
1171  *
1172  *
1173 */
1174 BME280_RETURN_FUNCTION_TYPE bme280_get_calib_param(void);
1175 /**************************************************************/
1176 /**\name        FUNCTION FOR TEMPERATURE OVER SAMPLING */
1177 /**************************************************************/
1178 /*!
1179  *      @brief This API is used to get
1180  *      the temperature oversampling setting in the register 0xF4
1181  *      bits from 5 to 7
1182  *
1183  *      value               |   Temperature oversampling
1184  * ---------------------|---------------------------------
1185  *      0x00                | Skipped
1186  *      0x01                | BME280_OVERSAMP_1X
1187  *      0x02                | BME280_OVERSAMP_2X
1188  *      0x03                | BME280_OVERSAMP_4X
1189  *      0x04                | BME280_OVERSAMP_8X
1190  *      0x05,0x06 and 0x07  | BME280_OVERSAMP_16X
1191  *
1192  *
1193  *  @param v_value_u8 : The value of temperature over sampling
1194  *
1195  *
1196  *
1197  *      @return results of bus communication function
1198  *      @retval 0 -> Success
1199  *      @retval -1 -> Error
1200  *
1201  *
1202 */
1203 BME280_RETURN_FUNCTION_TYPE bme280_get_oversamp_temperature(
1204 u8 *v_value_u8);
1205 /*!
1206  *      @brief This API is used to set
1207  *      the temperature oversampling setting in the register 0xF4
1208  *      bits from 5 to 7
1209  *
1210  *      value               |   Temperature oversampling
1211  * ---------------------|---------------------------------
1212  *      0x00                | Skipped
1213  *      0x01                | BME280_OVERSAMP_1X
1214  *      0x02                | BME280_OVERSAMP_2X
1215  *      0x03                | BME280_OVERSAMP_4X
1216  *      0x04                | BME280_OVERSAMP_8X
1217  *      0x05,0x06 and 0x07  | BME280_OVERSAMP_16X
1218  *
1219  *
1220  *  @param v_value_u8 : The value of temperature over sampling
1221  *
1222  *
1223  *
1224  *      @return results of bus communication function
1225  *      @retval 0 -> Success
1226  *      @retval -1 -> Error
1227  *
1228  *
1229 */
1230 BME280_RETURN_FUNCTION_TYPE bme280_set_oversamp_temperature(
1231 u8 v_value_u8);
1232 /**************************************************************/
1233 /**\name        FUNCTION FOR PRESSURE OVER SAMPLING */
1234 /**************************************************************/
1235 /*!
1236  *      @brief This API is used to get
1237  *      the pressure oversampling setting in the register 0xF4
1238  *      bits from 2 to 4
1239  *
1240  *      value              | Pressure oversampling
1241  * --------------------|--------------------------
1242  *      0x00               | Skipped
1243  *      0x01               | BME280_OVERSAMP_1X
1244  *      0x02               | BME280_OVERSAMP_2X
1245  *      0x03               | BME280_OVERSAMP_4X
1246  *      0x04               | BME280_OVERSAMP_8X
1247  *      0x05,0x06 and 0x07 | BME280_OVERSAMP_16X
1248  *
1249  *
1250  *  @param v_value_u8 : The value of pressure oversampling
1251  *
1252  *
1253  *
1254  *      @return results of bus communication function
1255  *      @retval 0 -> Success
1256  *      @retval -1 -> Error
1257  *
1258  *
1259 */
1260 BME280_RETURN_FUNCTION_TYPE bme280_get_oversamp_pressure(
1261 u8 *v_value_u8);
1262 /*!
1263  *      @brief This API is used to set
1264  *      the pressure oversampling setting in the register 0xF4
1265  *      bits from 2 to 4
1266  *
1267  *      value              | Pressure oversampling
1268  * --------------------|--------------------------
1269  *      0x00               | Skipped
1270  *      0x01               | BME280_OVERSAMP_1X
1271  *      0x02               | BME280_OVERSAMP_2X
1272  *      0x03               | BME280_OVERSAMP_4X
1273  *      0x04               | BME280_OVERSAMP_8X
1274  *      0x05,0x06 and 0x07 | BME280_OVERSAMP_16X
1275  *
1276  *
1277  *  @param v_value_u8 : The value of pressure oversampling
1278  *
1279  *
1280  *
1281  *      @return results of bus communication function
1282  *      @retval 0 -> Success
1283  *      @retval -1 -> Error
1284  *
1285  *
1286 */
1287 BME280_RETURN_FUNCTION_TYPE bme280_set_oversamp_pressure(
1288 u8 v_value_u8);
1289 /**************************************************************/
1290 /**\name        FUNCTION FOR HUMIDITY OVER SAMPLING */
1291 /**************************************************************/
1292 /*!
1293  *      @brief This API is used to get
1294  *      the humidity oversampling setting in the register 0xF2
1295  *      bits from 0 to 2
1296  *
1297  *      value               | Humidity oversampling
1298  * ---------------------|-------------------------
1299  *      0x00                | Skipped
1300  *      0x01                | BME280_OVERSAMP_1X
1301  *      0x02                | BME280_OVERSAMP_2X
1302  *      0x03                | BME280_OVERSAMP_4X
1303  *      0x04                | BME280_OVERSAMP_8X
1304  *      0x05,0x06 and 0x07  | BME280_OVERSAMP_16X
1305  *
1306  *
1307  *  @param  v_value_u8 : The value of humidity over sampling
1308  *
1309  *
1310  *
1311  *      @return results of bus communication function
1312  *      @retval 0 -> Success
1313  *      @retval -1 -> Error
1314  *
1315  *
1316 */
1317 BME280_RETURN_FUNCTION_TYPE bme280_get_oversamp_humidity(u8 *v_value_u8);
1318 /*!
1319  *      @brief This API is used to set
1320  *      the humidity oversampling setting in the register 0xF2
1321  *      bits from 0 to 2
1322  *
1323  *      value               | Humidity oversampling
1324  * ---------------------|-------------------------
1325  *      0x00                | Skipped
1326  *      0x01                | BME280_OVERSAMP_1X
1327  *      0x02                | BME280_OVERSAMP_2X
1328  *      0x03                | BME280_OVERSAMP_4X
1329  *      0x04                | BME280_OVERSAMP_8X
1330  *      0x05,0x06 and 0x07  | BME280_OVERSAMP_16X
1331  *
1332  *
1333  *  @param  v_value_u8 : The value of humidity over sampling
1334  *
1335  *
1336  *
1337  * @note The "BME280_CTRL_HUMIDITY_REG_OVERSAM_HUMIDITY"
1338  * register sets the humidity
1339  * data acquisition options of the device.
1340  * @note changes to this registers only become
1341  * effective after a write operation to
1342  * "BME280_CTRL_MEAS_REG" register.
1343  * @note In the code automated reading and writing of
1344  *      "BME280_CTRL_HUMIDITY_REG_OVERSAM_HUMIDITY"
1345  * @note register first set the
1346  * "BME280_CTRL_HUMIDITY_REG_OVERSAM_HUMIDITY"
1347  *  and then read and write
1348  *  the "BME280_CTRL_MEAS_REG" register in the function.
1349  *
1350  *
1351  *      @return results of bus communication function
1352  *      @retval 0 -> Success
1353  *      @retval -1 -> Error
1354  *
1355  *
1356 */
1357 BME280_RETURN_FUNCTION_TYPE bme280_set_oversamp_humidity(
1358 u8 v_value_u8);
1359 /**************************************************************/
1360 /**\name        FUNCTION FOR POWER MODE*/
1361 /**************************************************************/
1362 /*!
1363  *      @brief This API used to get the
1364  *      Operational Mode from the sensor in the register 0xF4 bit 0 and 1
1365  *
1366  *
1367  *
1368  *      @param v_power_mode_u8 : The value of power mode
1369  *  value           |    mode
1370  * -----------------|------------------
1371  *      0x00            | BME280_SLEEP_MODE
1372  *      0x01 and 0x02   | BME280_FORCED_MODE
1373  *      0x03            | BME280_NORMAL_MODE
1374  *
1375  *      @return results of bus communication function
1376  *      @retval 0 -> Success
1377  *      @retval -1 -> Error
1378  *
1379  *
1380 */
1381 BME280_RETURN_FUNCTION_TYPE bme280_get_power_mode(u8 *v_power_mode_u8);
1382 /*!
1383  *      @brief This API used to set the
1384  *      Operational Mode from the sensor in the register 0xF4 bit 0 and 1
1385  *
1386  *
1387  *
1388  *      @param v_power_mode_u8 : The value of power mode
1389  *  value           |    mode
1390  * -----------------|------------------
1391  *      0x00            | BME280_SLEEP_MODE
1392  *      0x01 and 0x02   | BME280_FORCED_MODE
1393  *      0x03            | BME280_NORMAL_MODE
1394  *
1395  *      @return results of bus communication function
1396  *      @retval 0 -> Success
1397  *      @retval -1 -> Error
1398  *
1399  *
1400 */
1401 BME280_RETURN_FUNCTION_TYPE bme280_set_power_mode(u8 v_power_mode_u8);
1402 /**************************************************************/
1403 /**\name        FUNCTION FOR SOFT RESET*/
1404 /**************************************************************/
1405 /*!
1406  * @brief Used to reset the sensor
1407  * The value 0xB6 is written to the 0xE0
1408  * register the device is reset using the
1409  * complete power-on-reset procedure.
1410  * @note Soft reset can be easily set using bme280_set_softreset().
1411  * @note Usage Hint : bme280_set_softreset()
1412  *
1413  *
1414  *      @return results of bus communication function
1415  *      @retval 0 -> Success
1416  *      @retval -1 -> Error
1417  *
1418  *
1419 */
1420 BME280_RETURN_FUNCTION_TYPE bme280_set_soft_rst(void);
1421 /**************************************************************/
1422 /**\name        FUNCTION FOR SPI ENABLE*/
1423 /**************************************************************/
1424 /*!
1425  *      @brief This API used to get the sensor
1426  *      SPI mode(communication type) in the register 0xF5 bit 0
1427  *
1428  *
1429  *
1430  *      @param v_enable_disable_u8 : The value of SPI enable
1431  *      value  | Description
1432  * --------|--------------
1433  *   0     | Disable
1434  *   1     | Enable
1435  *
1436  *
1437  *
1438  *      @return results of bus communication function
1439  *      @retval 0 -> Success
1440  *      @retval -1 -> Error
1441  *
1442  *
1443 */
1444 BME280_RETURN_FUNCTION_TYPE bme280_get_spi3(u8 *v_enable_disable_u8);
1445 /*!
1446  *      @brief This API used to set the sensor
1447  *      SPI mode(communication type) in the register 0xF5 bit 0
1448  *
1449  *
1450  *
1451  *      @param v_enable_disable_u8 : The value of SPI enable
1452  *      value  | Description
1453  * --------|--------------
1454  *   0     | Disable
1455  *   1     | Enable
1456  *
1457  *
1458  *
1459  *      @return results of bus communication function
1460  *      @retval 0 -> Success
1461  *      @retval -1 -> Error
1462  *
1463  *
1464 */
1465 BME280_RETURN_FUNCTION_TYPE bme280_set_spi3(u8 v_enable_disable_u8);
1466 /**************************************************************/
1467 /**\name        FUNCTION FOR IIR FILTER*/
1468 /**************************************************************/
1469 /*!
1470  *      @brief This API is used to reads filter setting
1471  *      in the register 0xF5 bit 3 and 4
1472  *
1473  *
1474  *
1475  *      @param v_value_u8 : The value of IIR filter coefficient
1476  *
1477  *      value       |   Filter coefficient
1478  * -------------|-------------------------
1479  *      0x00        | BME280_FILTER_COEFF_OFF
1480  *      0x01        | BME280_FILTER_COEFF_2
1481  *      0x02        | BME280_FILTER_COEFF_4
1482  *      0x03        | BME280_FILTER_COEFF_8
1483  *      0x04        | BME280_FILTER_COEFF_16
1484  *
1485  *      @return results of bus communication function
1486  *      @retval 0 -> Success
1487  *      @retval -1 -> Error
1488  *
1489  *
1490 */
1491 BME280_RETURN_FUNCTION_TYPE bme280_get_filter(u8 *v_value_u8);
1492 /*!
1493  *      @brief This API is used to write filter setting
1494  *      in the register 0xF5 bit 3 and 4
1495  *
1496  *
1497  *
1498  *      @param v_value_u8 : The value of IIR filter coefficient
1499  *
1500  *      value       |   Filter coefficient
1501  * -------------|-------------------------
1502  *      0x00        | BME280_FILTER_COEFF_OFF
1503  *      0x01        | BME280_FILTER_COEFF_2
1504  *      0x02        | BME280_FILTER_COEFF_4
1505  *      0x03        | BME280_FILTER_COEFF_8
1506  *      0x04        | BME280_FILTER_COEFF_16
1507  *
1508  *      @return results of bus communication function
1509  *      @retval 0 -> Success
1510  *      @retval -1 -> Error
1511  *
1512  *
1513 */
1514 BME280_RETURN_FUNCTION_TYPE bme280_set_filter(u8 v_value_u8);
1515 /**************************************************************/
1516 /**\name        FUNCTION FOR STANDBY DURATION*/
1517 /**************************************************************/
1518 /*!
1519  *      @brief This API used to Read the
1520  *      standby duration time from the sensor in the register 0xF5 bit 5 to 7
1521  *
1522  *      @param v_standby_durn_u8 : The value of standby duration time value.
1523  *  value       | standby duration
1524  * -------------|-----------------------
1525  *    0x00      | BME280_STANDBY_TIME_1_MS
1526  *    0x01      | BME280_STANDBY_TIME_63_MS
1527  *    0x02      | BME280_STANDBY_TIME_125_MS
1528  *    0x03      | BME280_STANDBY_TIME_250_MS
1529  *    0x04      | BME280_STANDBY_TIME_500_MS
1530  *    0x05      | BME280_STANDBY_TIME_1000_MS
1531  *    0x06      | BME280_STANDBY_TIME_2000_MS
1532  *    0x07      | BME280_STANDBY_TIME_4000_MS
1533  *
1534  *
1535  *      @return results of bus communication function
1536  *      @retval 0 -> Success
1537  *      @retval -1 -> Error
1538  *
1539  *
1540 */
1541 BME280_RETURN_FUNCTION_TYPE bme280_get_standby_durn(u8 *v_standby_durn_u8);
1542 /*!
1543  *      @brief This API used to write the
1544  *      standby duration time from the sensor in the register 0xF5 bit 5 to 7
1545  *
1546  *      @param v_standby_durn_u8 : The value of standby duration time value.
1547  *  value       | standby duration
1548  * -------------|-----------------------
1549  *    0x00      | BME280_STANDBY_TIME_1_MS
1550  *    0x01      | BME280_STANDBY_TIME_63_MS
1551  *    0x02      | BME280_STANDBY_TIME_125_MS
1552  *    0x03      | BME280_STANDBY_TIME_250_MS
1553  *    0x04      | BME280_STANDBY_TIME_500_MS
1554  *    0x05      | BME280_STANDBY_TIME_1000_MS
1555  *    0x06      | BME280_STANDBY_TIME_2000_MS
1556  *    0x07      | BME280_STANDBY_TIME_4000_MS
1557  *
1558  *      @note Normal mode comprises an automated perpetual
1559  *      cycling between an (active)
1560  *      Measurement period and an (inactive) standby period.
1561  *      @note The standby time is determined by
1562  *      the contents of the register t_sb.
1563  *      Standby time can be set using BME280_STANDBY_TIME_125_MS.
1564  *
1565  *      @note Usage Hint : bme280_set_standby_durn(BME280_STANDBY_TIME_125_MS)
1566  *
1567  *
1568  *
1569  *      @return results of bus communication function
1570  *      @retval 0 -> Success
1571  *      @retval -1 -> Error
1572  *
1573  *
1574 */
1575 BME280_RETURN_FUNCTION_TYPE bme280_set_standby_durn(u8 v_standby_durn_u8);
1576 /**************************************************************/
1577 /**\name        FUNCTION FOR WORK MODE*/
1578 /**************************************************************/
1579 /*
1580  * @brief Writes the working mode to the sensor
1581  *
1582  *
1583  *
1584  *
1585  *  @param v_work_mode_u8 : Mode to be set
1586  *  value    | Working mode
1587  * ----------|--------------------
1588  *   0       | BME280_ULTRALOWPOWER_MODE
1589  *   1       | BME280_LOWPOWER_MODE
1590  *   2       | BME280_STANDARDRESOLUTION_MODE
1591  *   3       | BME280_HIGHRESOLUTION_MODE
1592  *   4       | BME280_ULTRAHIGHRESOLUTION_MODE
1593  *
1594  *      @return results of bus communication function
1595  *      @retval 0 -> Success
1596  *      @retval -1 -> Error
1597  *
1598  *
1599 */
1600 /*BME280_RETURN_FUNCTION_TYPE bme280_set_work_mode(u8 v_work_mode_u8);*/
1601 /**************************************************************/
1602 /**\name        FUNCTION FOR FORCE MODE DATA READ*/
1603 /**************************************************************/
1604 /*!
1605  * @brief This API used to read uncompensated
1606  * temperature,pressure and humidity in forced mode
1607  *
1608  *
1609  *      @param v_uncom_pressure_s32: The value of uncompensated pressure
1610  *      @param v_uncom_temperature_s32: The value of uncompensated temperature
1611  *      @param v_uncom_humidity_s32: The value of uncompensated humidity
1612  *
1613  *
1614  *      @return results of bus communication function
1615  *      @retval 0 -> Success
1616  *      @retval -1 -> Error
1617  *
1618  *
1619 */
1620 BME280_RETURN_FUNCTION_TYPE
1621 bme280_get_forced_uncomp_pressure_temperature_humidity(
1622 s32 *v_uncom_pressure_s32,
1623 s32 *v_uncom_temperature_s32, s32 *v_uncom_humidity_s32);
1624 /**************************************************************/
1625 /**\name        FUNCTION FOR COMMON READ AND WRITE */
1626 /**************************************************************/
1627 /*!
1628  * @brief
1629  *      This API write the data to
1630  *      the given register
1631  *
1632  *
1633  *      @param v_addr_u8 -> Address of the register
1634  *      @param v_data_u8 -> The data from the register
1635  *      @param v_len_u8 -> no of bytes to read
1636  *
1637  *
1638  *      @return results of bus communication function
1639  *      @retval 0 -> Success
1640  *      @retval -1 -> Error
1641  *
1642  *
1643  */
1644 BME280_RETURN_FUNCTION_TYPE bme280_write_register(u8 v_addr_u8,
1645 u8 *v_data_u8, u8 v_len_u8);
1646 /*!
1647  * @brief
1648  *      This API reads the data from
1649  *      the given register
1650  *
1651  *
1652  *      @param v_addr_u8 -> Address of the register
1653  *      @param v_data_u8 -> The data from the register
1654  *      @param v_len_u8 -> no of bytes to read
1655  *
1656  *
1657  *      @return results of bus communication function
1658  *      @retval 0 -> Success
1659  *      @retval -1 -> Error
1660  *
1661  *
1662  */
1663 BME280_RETURN_FUNCTION_TYPE bme280_read_register(u8 v_addr_u8,
1664 u8 *v_data_u8, u8 v_len_u8);
1665 /**************************************************************/
1666 /**\name        FUNCTION FOR FLOAT OUTPUT TEMPERATURE*/
1667 /**************************************************************/
1668 #ifdef BME280_ENABLE_FLOAT
1669 /*!
1670  * @brief Reads actual temperature from uncompensated temperature
1671  * @note returns the value in Degree centigrade
1672  * @note Output value of "51.23" equals 51.23 DegC.
1673  *
1674  *
1675  *
1676  *  @param v_uncom_temperature_s32 : value of uncompensated temperature
1677  *
1678  *
1679  *
1680  *  @return  Return the actual temperature in floating point
1681  *
1682 */
1683 double bme280_compensate_T_double(s32 v_uncom_temperature_s32);
1684 /**************************************************************/
1685 /**\name        FUNCTION FOR FLOAT OUTPUT PRESSURE*/
1686 /**************************************************************/
1687 /*!
1688  * @brief Reads actual pressure from uncompensated pressure
1689  * @note Returns pressure in Pa as double.
1690  * @note Output value of "96386.2"
1691  * equals 96386.2 Pa = 963.862 hPa.
1692  *
1693  *
1694  *  @param v_uncom_pressure_s32 : value of uncompensated pressure
1695  *
1696  *
1697  *  @return  Return the actual pressure in floating point
1698  *
1699 */
1700 double bme280_compensate_P_double(s32 v_uncom_pressure_s32);
1701 /**************************************************************/
1702 /**\name        FUNCTION FOR FLOAT OUTPUT HUMIDITY*/
1703 /**************************************************************/
1704 /*!
1705  * @brief Reads actual humidity from uncompensated humidity
1706  * @note returns the value in relative humidity (%rH)
1707  * @note Output value of "42.12" equals 42.12 %rH
1708  *
1709  *  @param v_uncom_humidity_s32 : value of uncompensated humidity
1710  *
1711  *
1712  *
1713  *  @return Return the actual humidity in floating point
1714  *
1715 */
1716 double bme280_compensate_H_double(s32 v_uncom_humidity_s32);
1717 #endif
1718 /**************************************************************/
1719 /**\name        FUNCTION FOR 64BIT OUTPUT PRESSURE*/
1720 /**************************************************************/
1721 #if defined(BME280_ENABLE_INT64) && defined(BME280_64BITSUPPORT_PRESENT)
1722 /*!
1723  * @brief Reads actual pressure from uncompensated pressure
1724  * @note Returns the value in Pa as unsigned 32 bit
1725  * integer in Q24.8 format (24 integer bits and
1726  * 8 fractional bits).
1727  * @note Output value of "24674867"
1728  * represents 24674867 / 256 = 96386.2 Pa = 963.862 hPa
1729  *
1730  *
1731  *
1732  *  @param  v_uncom_pressure_s32 : value of uncompensated temperature
1733  *
1734  *
1735  *  @return Return the actual pressure in u32
1736  *
1737 */
1738 u32 bme280_compensate_P_int64(s32 v_uncom_pressure_s32);
1739 /**************************************************************/
1740 /**\name        FUNCTION FOR 24BIT OUTPUT PRESSURE*/
1741 /**************************************************************/
1742 /*!
1743  * @brief Reads actual pressure from uncompensated pressure
1744  * @note Returns the value in Pa.
1745  * @note Output value of "12337434"
1746  * @note represents 12337434 / 128 = 96386.2 Pa = 963.862 hPa
1747  *
1748  *
1749  *
1750  *  @param v_uncom_pressure_s32 : value of uncompensated pressure
1751  *
1752  *
1753  *  @return the actual pressure in u32
1754  *
1755 */
1756 u32 bme280_compensate_P_int64_twentyfour_bit_output(s32 v_uncom_pressure_s32);
1757 #endif
1758 /**************************************************************/
1759 /**\name        FUNCTION FOR WAIT PERIOD*/
1760 /**************************************************************/
1761 /*!
1762  * @brief Computing waiting time for sensor data read
1763  *
1764  *
1765  *
1766  *
1767  *  @param v_delaytime_u8 : The value of delay time for force mode
1768  *
1769  *
1770  *      @retval 0 -> Success
1771  *
1772  *
1773  */
1774 BME280_RETURN_FUNCTION_TYPE bme280_compute_wait_time(u8
1775 *v_delaytime_u8r);
1776 #endif