]> git.itanic.dy.fi Git - BME280_driver/blob - bme280.h
Corrected the magic numbers with valid names
[BME280_driver] / bme280.h
1 /** \mainpage
2 *
3 ****************************************************************************
4 * Copyright (C) 2013 - 2015 Bosch Sensortec GmbH
5 *
6 * File : bme280.h
7 *
8 * Date : 2015/03/27
9 *
10 * Revision : 2.0.4(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 /*! @brief
205  *      If your machine support 64 bit
206  *      define the MACHINE_64_BIT
207  */
208 #define BME280_64BITSUPPORT_PRESENT
209
210 /* If your machine support 64 bit
211 define the MACHINE_64_BIT*/
212 #elif defined MACHINE_64_BIT
213 /*signed integer types*/
214 typedef signed char  s8;/**< used for signed 8bit */
215 typedef signed short int s16;/**< used for signed 16bit */
216 typedef signed int s32;/**< used for signed 32bit */
217 typedef signed long int s64;/**< used for signed 64bit */
218
219 /*unsigned integer types*/
220 typedef unsigned char u8;/**< used for unsigned 8bit */
221 typedef unsigned short int u16;/**< used for unsigned 16bit */
222 typedef unsigned int u32;/**< used for unsigned 32bit */
223 typedef unsigned long int u64;/**< used for unsigned 64bit */
224 #define BME280_64BITSUPPORT_PRESENT
225
226 #else
227 #warning The data types defined above which not supported \
228 define the data types manually
229 #endif
230 #endif
231
232 /*** This else will execute for the compilers
233  *      which are not supported the C standards
234  *      Like C89/C99/C11***/
235 #else
236 /*!
237 * @brief By default it is defined as 32 bit machine configuration
238 *       define your data types based on your
239 *       machine/compiler/controller configuration
240 */
241 #define  MACHINE_32_BIT
242
243 /* If your machine support 16 bit
244 define the MACHINE_16_BIT*/
245 #ifdef MACHINE_16_BIT
246 #include <limits.h>
247 /*signed integer types*/
248 typedef signed char  s8;/**< used for signed 8bit */
249 typedef signed short int s16;/**< used for signed 16bit */
250 typedef signed long int s32;/**< used for signed 32bit */
251
252 #if defined(LONG_MAX) && LONG_MAX == 0x7fffffffffffffffL
253 typedef long int s64;/**< used for signed 64bit */
254 typedef unsigned long int u64;/**< used for unsigned 64bit */
255 #define BME280_64BITSUPPORT_PRESENT
256 #elif defined(LLONG_MAX) && (LLONG_MAX == 0x7fffffffffffffffLL)
257 typedef long long int s64;/**< used for signed 64bit */
258 typedef unsigned long long int u64;/**< used for unsigned 64bit */
259 #define BME280_64BITSUPPORT_PRESENT
260 #else
261 #warning Either the correct data type for signed 64 bit integer \
262 could not be found, or 64 bit integers are not supported in your environment.
263 #warning The API will only offer 32 bit pressure calculation.This will \
264 slightly impede accuracy(noise of ~1 pascal RMS will be added to output).
265 #warning If 64 bit integers are supported on your platform, \
266 please set s64 manually and "#define(BME280_64BITSUPPORT_PRESENT)" manually.
267 #endif
268
269 /*unsigned integer types*/
270 typedef unsigned char u8;/**< used for unsigned 8bit */
271 typedef unsigned short int u16;/**< used for unsigned 16bit */
272 typedef unsigned long int u32;/**< used for unsigned 32bit */
273
274 /*! @brief If your machine support 32 bit
275 define the MACHINE_32_BIT*/
276 #elif defined MACHINE_32_BIT
277 /*signed integer types*/
278 typedef signed char  s8;/**< used for signed 8bit */
279 typedef signed short int s16;/**< used for signed 16bit */
280 typedef signed int s32;/**< used for signed 32bit */
281 typedef signed long long int s64;/**< used for signed 64bit */
282
283 /*unsigned integer types*/
284 typedef unsigned char u8;/**< used for unsigned 8bit */
285 typedef unsigned short int u16;/**< used for unsigned 16bit */
286 typedef unsigned int u32;/**< used for unsigned 32bit */
287 typedef unsigned long long int u64;/**< used for unsigned 64bit */
288 #define BME280_64BITSUPPORT_PRESENT
289
290 /* If your machine support 64 bit
291 define the MACHINE_64_BIT*/
292 #elif defined MACHINE_64_BIT
293 /*signed integer types*/
294 typedef signed char  s8;/**< used for signed 8bit */
295 typedef signed short int s16;/**< used for signed 16bit */
296 typedef signed int s32;/**< used for signed 32bit */
297 typedef signed long int s64;/**< used for signed 64bit */
298
299 /*unsigned integer types*/
300 typedef unsigned char u8;/**< used for unsigned 8bit */
301 typedef unsigned short int u16;/**< used for unsigned 16bit */
302 typedef unsigned int u32;/**< used for unsigned 32bit */
303 typedef unsigned long int u64;/**< used for unsigned 64bit */
304 #define BME280_64BITSUPPORT_PRESENT
305
306 #else
307 #warning The data types defined above which not supported \
308 define the data types manually
309 #endif
310 #endif
311 #endif
312 /********************************************/
313 /**\name        ENABLE FLATING OUTPUT      */
314 /**************************************/
315 /*!
316 * @brief If the user wants to support floating point calculations, please set
317         the following define. If floating point
318         calculation is not wanted or allowed
319         (e.g. in Linux kernel), please do not set the define. */
320 #define BME280_ENABLE_FLOAT
321 /*!
322 * @brief If the user wants to support 64 bit integer calculation
323         (needed for optimal pressure accuracy) please set
324         the following define. If int64 calculation is not wanted
325         (e.g. because it would include
326         large libraries), please do not set the define. */
327 #define BME280_ENABLE_INT64
328 /***************************************************************/
329 /**\name        BUS READ AND WRITE FUNCTION POINTERS        */
330 /***************************************************************/
331 /*!
332         @brief Define the calling convention of YOUR bus communication routine.
333         @note This includes types of parameters. This example shows the
334         configuration for an SPI bus link.
335
336     If your communication function looks like this:
337
338     write_my_bus_xy(u8 device_addr, u8 register_addr,
339     u8 * data, u8 length);
340
341     The BME280_WR_FUNC_PTR would equal:
342
343         BME280_WR_FUNC_PTR s8 (* bus_write)(u8,
344     u8, u8 *, u8)
345
346     Parameters can be mixed as needed refer to the
347     refer BME280_BUS_WRITE_FUNC  macro.
348
349
350 */
351 /** defines the return parameter type of the BME280_WR_FUNCTION */
352 #define BME280_BUS_WR_RETURN_TYPE s8
353
354 /* links the order of parameters defined in
355 BME280_BUS_WR_PARAM_TYPE to function calls used inside the API*/
356 #define BME280_BUS_WR_PARAM_TYPES u8, u8,\
357                 u8 *, u8
358
359 /* links the order of parameters defined in
360 BME280_BUS_WR_PARAM_TYPE to function calls used inside the API*/
361 #define BME280_BUS_WR_PARAM_ORDER(device_addr, register_addr,\
362                 register_data, wr_len)
363
364 /* never change this line */
365 #define BME280_BUS_WRITE_FUNC(device_addr, register_addr,\
366 register_data, wr_len) bus_write(device_addr, register_addr,\
367                 register_data, wr_len)
368 /*!
369         @brief link macro between API function calls and bus read function
370         @note The bus write function can change since this is a
371         system dependant issue.
372
373     If the bus_read parameter calling order is like: reg_addr,
374     reg_data, wr_len it would be as it is here.
375
376     If the parameters are differently ordered or your communication
377     function like I2C need to know the device address,
378     you can change this macro accordingly.
379
380
381     BME280_BUS_READ_FUNC(dev_addr, reg_addr, reg_data, wr_len)\
382     bus_read(dev_addr, reg_addr, reg_data, wr_len)
383
384     This macro lets all API functions call YOUR communication routine in a
385     way that equals your definition in the
386     refer BME280_WR_FUNC_PTR definition.
387
388     @note: this macro also includes the "MSB='1'
389     for reading BME280 addresses.
390
391 */
392 /*defines the return parameter type of the BME280_RD_FUNCTION
393 */
394 #define BME280_BUS_RD_RETURN_TYPE s8
395
396 /**\brief defines the calling parameter types of the BME280_RD_FUNCTION
397 */
398 #define BME280_BUS_RD_PARAM_TYPES (u8, u8,\
399                 u8 *, u8)
400
401 /* links the order of parameters defined in \
402 BME280_BUS_RD_PARAM_TYPE to function calls used inside the API
403 */
404 #define BME280_BUS_RD_PARAM_ORDER (device_addr, register_addr,\
405                 register_data)
406
407 /* never change this line */
408 #define BME280_BUS_READ_FUNC(device_addr, register_addr,\
409                 register_data, rd_len)bus_read(device_addr, register_addr,\
410                 register_data, rd_len)
411 /****************************************/
412 /**\name        DELAY       */
413 /****************************************/
414 /* defines the return parameter type of the BME280_DELAY_FUNCTION
415 */
416 #define BME280_DELAY_RETURN_TYPE void
417
418 /* defines the calling parameter types of the BME280_DELAY_FUNCTION
419 */
420 #define BME280_DELAY_PARAM_TYPES u16
421 /***************************************************************/
422 /**\name        GET AND SET BITSLICE FUNCTIONS       */
423 /***************************************************************/
424 /* never change this line */
425 #define BME280_DELAY_FUNC(delay_in_msec)\
426                 delay_func(delay_in_msec)
427
428 #define BME280_GET_BITSLICE(regvar, bitname)\
429                 ((regvar & bitname##__MSK) >> bitname##__POS)
430
431 #define BME280_SET_BITSLICE(regvar, bitname, val)\
432 ((regvar & ~bitname##__MSK) | ((val<<bitname##__POS)&bitname##__MSK))
433
434 /***************************************************************/
435 /**\name        COMMON USED CONSTANTS      */
436 /***************************************************************/
437 /* Constants */
438 #define BME280_NULL                          (0)
439 #define BME280_RETURN_FUNCTION_TYPE          s8
440 /* shift definitions*/
441 #define BME280_SHIFT_BIT_POSITION_BY_01_BIT                             (1)
442 #define BME280_SHIFT_BIT_POSITION_BY_02_BITS                    (2)
443 #define BME280_SHIFT_BIT_POSITION_BY_03_BITS                    (3)
444 #define BME280_SHIFT_BIT_POSITION_BY_04_BITS                    (4)
445 #define BME280_SHIFT_BIT_POSITION_BY_07_BITS                    (7)
446 #define BME280_SHIFT_BIT_POSITION_BY_08_BITS                    (8)
447 #define BME280_SHIFT_BIT_POSITION_BY_10_BITS                    (10)
448 #define BME280_SHIFT_BIT_POSITION_BY_11_BITS                    (11)
449 #define BME280_SHIFT_BIT_POSITION_BY_12_BITS                    (12)
450 #define BME280_SHIFT_BIT_POSITION_BY_13_BITS                    (13)
451 #define BME280_SHIFT_BIT_POSITION_BY_14_BITS                    (14)
452 #define BME280_SHIFT_BIT_POSITION_BY_15_BITS                    (15)
453 #define BME280_SHIFT_BIT_POSITION_BY_16_BITS                    (16)
454 #define BME280_SHIFT_BIT_POSITION_BY_17_BITS                    (17)
455 #define BME280_SHIFT_BIT_POSITION_BY_18_BITS                    (18)
456 #define BME280_SHIFT_BIT_POSITION_BY_19_BITS                    (19)
457 #define BME280_SHIFT_BIT_POSITION_BY_20_BITS                    (20)
458 #define BME280_SHIFT_BIT_POSITION_BY_25_BITS                    (25)
459 #define BME280_SHIFT_BIT_POSITION_BY_31_BITS                    (31)
460 #define BME280_SHIFT_BIT_POSITION_BY_33_BITS                    (33)
461 #define BME280_SHIFT_BIT_POSITION_BY_35_BITS                    (35)
462 #define BME280_SHIFT_BIT_POSITION_BY_47_BITS                    (47)
463
464 /* numeric definitions */
465 #define BME280_PRESSURE_TEMPERATURE_CALIB_DATA_LENGTH       (26)
466 #define BME280_HUMIDITY_CALIB_DATA_LENGTH           (7)
467 #define BME280_GEN_READ_WRITE_DATA_LENGTH               (1)
468 #define BME280_HUMIDITY_DATA_LENGTH                             (2)
469 #define BME280_TEMPERATURE_DATA_LENGTH                  (3)
470 #define BME280_PRESSURE_DATA_LENGTH                             (3)
471 #define BME280_ALL_DATA_FRAME_LENGTH                    (8)
472 #define BME280_INIT_VALUE                                               (0)
473 #define BME280_INVALID_DATA                                             (0)
474
475 /****************************************************/
476 /**\name        ERROR CODE DEFINITIONS  */
477 /***************************************************/
478 #define SUCCESS                                 ((u8)0)
479 #define E_BME280_NULL_PTR       ((s8)-127)
480 #define E_BME280_COMM_RES       ((s8)-1)
481 #define E_BME280_OUT_OF_RANGE   ((s8)-2)
482 #define ERROR                                   ((s8)-1)
483 /****************************************************/
484 /**\name        I2C ADDRESS DEFINITIONS  */
485 /***************************************************/
486 #define BME280_I2C_ADDRESS1                  (0x76)
487 #define BME280_I2C_ADDRESS2                  (0x77)
488 /****************************************************/
489 /**\name        POWER MODE DEFINITIONS  */
490 /***************************************************/
491 /* Sensor Specific constants */
492 #define BME280_SLEEP_MODE                    (0x00)
493 #define BME280_FORCED_MODE                   (0x01)
494 #define BME280_NORMAL_MODE                   (0x03)
495 #define BME280_SOFT_RESET_CODE               (0xB6)
496 /****************************************************/
497 /**\name        STANDBY DEFINITIONS  */
498 /***************************************************/
499 #define BME280_STANDBY_TIME_1_MS              (0x00)
500 #define BME280_STANDBY_TIME_63_MS             (0x01)
501 #define BME280_STANDBY_TIME_125_MS                        (0x02)
502 #define BME280_STANDBY_TIME_250_MS            (0x03)
503 #define BME280_STANDBY_TIME_500_MS            (0x04)
504 #define BME280_STANDBY_TIME_1000_MS           (0x05)
505 #define BME280_STANDBY_TIME_10_MS             (0x06)
506 #define BME280_STANDBY_TIME_20_MS             (0x07)
507 /****************************************************/
508 /**\name        OVER SAMPLING DEFINITIONS  */
509 /***************************************************/
510 #define BME280_OVERSAMP_SKIPPED          (0x00)
511 #define BME280_OVERSAMP_1X               (0x01)
512 #define BME280_OVERSAMP_2X               (0x02)
513 #define BME280_OVERSAMP_4X               (0x03)
514 #define BME280_OVERSAMP_8X               (0x04)
515 #define BME280_OVERSAMP_16X              (0x05)
516 /****************************************************/
517 /**\name        WORK MODE DEFINITIONS  */
518 /***************************************************/
519 /*#define BME280_ULTRALOWPOWER_MODE          (0x00)
520 #define BME280_LOWPOWER_MODE                 (0x01)
521 #define BME280_STANDARDRESOLUTION_MODE       (0x02)
522 #define BME280_HIGHRESOLUTION_MODE           (0x03)
523 #define BME280_ULTRAHIGHRESOLUTION_MODE      (0x04)
524
525 #define BME280_ULTRALOWPOWER_OSRS_P          BME280_OVERSAMP_1X
526 #define BME280_ULTRALOWPOWER_OSRS_T          BME280_OVERSAMP_1X
527
528 #define BME280_LOWPOWER_OSRS_P               BME280_OVERSAMP_2X
529 #define BME280_LOWPOWER_OSRS_T               BME280_OVERSAMP_1X
530
531 #define BME280_STANDARDRESOLUTION_OSRS_P     BME280_OVERSAMP_4X
532 #define BME280_STANDARDRESOLUTION_OSRS_T     BME280_OVERSAMP_1X
533
534 #define BME280_HIGHRESOLUTION_OSRS_P         BME280_OVERSAMP_8X
535 #define BME280_HIGHRESOLUTION_OSRS_T         BME280_OVERSAMP_1X
536
537 #define BME280_ULTRAHIGHRESOLUTION_OSRS_P    BME280_OVERSAMP_16X
538 #define BME280_ULTRAHIGHRESOLUTION_OSRS_T    BME280_OVERSAMP_2X */
539
540 #define BME280_STANDARD_OVERSAMP_HUMIDITY       BME280_OVERSAMP_1X
541 /****************************************************/
542 /**\name        FILTER DEFINITIONS  */
543 /***************************************************/
544 #define BME280_FILTER_COEFF_OFF               (0x00)
545 #define BME280_FILTER_COEFF_2                 (0x01)
546 #define BME280_FILTER_COEFF_4                 (0x02)
547 #define BME280_FILTER_COEFF_8                 (0x03)
548 #define BME280_FILTER_COEFF_16                (0x04)
549 /****************************************************/
550 /**\name        DELAY DEFINITIONS  */
551 /***************************************************/
552 #define T_INIT_MAX                             (20)
553                 /* 20/16 = 1.25 ms */
554 #define T_MEASURE_PER_OSRS_MAX                 (37)
555                 /* 37/16 = 2.3125 ms*/
556
557 #define T_SETUP_PRESSURE_MAX                   (10)
558                 /* 10/16 = 0.625 ms */
559
560 #define T_SETUP_HUMIDITY_MAX                   (10)
561                 /* 10/16 = 0.625 ms */
562 /****************************************************/
563 /**\name        DEFINITIONS FOR ARRAY SIZE OF DATA   */
564 /***************************************************/
565 #define BME280_HUMIDITY_DATA_SIZE               (2)
566 #define BME280_TEMPERATURE_DATA_SIZE    (3)
567 #define BME280_PRESSURE_DATA_SIZE               (3)
568 #define BME280_DATA_FRAME_SIZE                  (8)
569 /**< data frames includes temperature,
570 pressure and humidity*/
571 #define BME280_CALIB_DATA_SIZE                  (26)
572
573 #define BME280_TEMPERATURE_MSB_DATA             (0)
574 #define BME280_TEMPERATURE_LSB_DATA             (1)
575 #define BME280_TEMPERATURE_XLSB_DATA    (2)
576 #define BME280_PRESSURE_MSB_DATA                (0)
577 #define BME280_PRESSURE_LSB_DATA                (1)
578 #define BME280_PRESSURE_XLSB_DATA           (2)
579 #define BME280_HUMIDITY_MSB_DATA                (0)
580 #define BME280_HUMIDITY_LSB_DATA                (1)
581
582 #define BME280_DATA_FRAME_PRESSURE_MSB_BYTE         (0)
583 #define BME280_DATA_FRAME_PRESSURE_LSB_BYTE             (1)
584 #define BME280_DATA_FRAME_PRESSURE_XLSB_BYTE    (2)
585 #define BME280_DATA_FRAME_TEMPERATURE_MSB_BYTE  (3)
586 #define BME280_DATA_FRAME_TEMPERATURE_LSB_BYTE  (4)
587 #define BME280_DATA_FRAME_TEMPERATURE_XLSB_BYTE (5)
588 #define BME280_DATA_FRAME_HUMIDITY_MSB_BYTE             (6)
589 #define BME280_DATA_FRAME_HUMIDITY_LSB_BYTE             (7)
590 /****************************************************/
591 /**\name        ARRAY PARAMETER FOR CALIBRATION     */
592 /***************************************************/
593 #define BME280_TEMPERATURE_CALIB_DIG_T1_LSB             (0)
594 #define BME280_TEMPERATURE_CALIB_DIG_T1_MSB             (1)
595 #define BME280_TEMPERATURE_CALIB_DIG_T2_LSB             (2)
596 #define BME280_TEMPERATURE_CALIB_DIG_T2_MSB             (3)
597 #define BME280_TEMPERATURE_CALIB_DIG_T3_LSB             (4)
598 #define BME280_TEMPERATURE_CALIB_DIG_T3_MSB             (5)
599 #define BME280_PRESSURE_CALIB_DIG_P1_LSB       (6)
600 #define BME280_PRESSURE_CALIB_DIG_P1_MSB       (7)
601 #define BME280_PRESSURE_CALIB_DIG_P2_LSB       (8)
602 #define BME280_PRESSURE_CALIB_DIG_P2_MSB       (9)
603 #define BME280_PRESSURE_CALIB_DIG_P3_LSB       (10)
604 #define BME280_PRESSURE_CALIB_DIG_P3_MSB       (11)
605 #define BME280_PRESSURE_CALIB_DIG_P4_LSB       (12)
606 #define BME280_PRESSURE_CALIB_DIG_P4_MSB       (13)
607 #define BME280_PRESSURE_CALIB_DIG_P5_LSB       (14)
608 #define BME280_PRESSURE_CALIB_DIG_P5_MSB       (15)
609 #define BME280_PRESSURE_CALIB_DIG_P6_LSB       (16)
610 #define BME280_PRESSURE_CALIB_DIG_P6_MSB       (17)
611 #define BME280_PRESSURE_CALIB_DIG_P7_LSB       (18)
612 #define BME280_PRESSURE_CALIB_DIG_P7_MSB       (19)
613 #define BME280_PRESSURE_CALIB_DIG_P8_LSB       (20)
614 #define BME280_PRESSURE_CALIB_DIG_P8_MSB       (21)
615 #define BME280_PRESSURE_CALIB_DIG_P9_LSB       (22)
616 #define BME280_PRESSURE_CALIB_DIG_P9_MSB       (23)
617 #define BME280_HUMIDITY_CALIB_DIG_H1           (25)
618 #define BME280_HUMIDITY_CALIB_DIG_H2_LSB                (0)
619 #define BME280_HUMIDITY_CALIB_DIG_H2_MSB                (1)
620 #define BME280_HUMIDITY_CALIB_DIG_H3                    (2)
621 #define BME280_HUMIDITY_CALIB_DIG_H4_MSB                (3)
622 #define BME280_HUMIDITY_CALIB_DIG_H4_LSB                (4)
623 #define BME280_HUMIDITY_CALIB_DIG_H5_MSB                (5)
624 #define BME280_HUMIDITY_CALIB_DIG_H6                    (6)
625 #define BME280_MASK_DIG_H4              (0x0F)
626 /****************************************************/
627 /**\name        CALIBRATION REGISTER ADDRESS DEFINITIONS  */
628 /***************************************************/
629 /*calibration parameters */
630 #define BME280_TEMPERATURE_CALIB_DIG_T1_LSB_REG             (0x88)
631 #define BME280_TEMPERATURE_CALIB_DIG_T1_MSB_REG             (0x89)
632 #define BME280_TEMPERATURE_CALIB_DIG_T2_LSB_REG             (0x8A)
633 #define BME280_TEMPERATURE_CALIB_DIG_T2_MSB_REG             (0x8B)
634 #define BME280_TEMPERATURE_CALIB_DIG_T3_LSB_REG             (0x8C)
635 #define BME280_TEMPERATURE_CALIB_DIG_T3_MSB_REG             (0x8D)
636 #define BME280_PRESSURE_CALIB_DIG_P1_LSB_REG                (0x8E)
637 #define BME280_PRESSURE_CALIB_DIG_P1_MSB_REG                (0x8F)
638 #define BME280_PRESSURE_CALIB_DIG_P2_LSB_REG                (0x90)
639 #define BME280_PRESSURE_CALIB_DIG_P2_MSB_REG                (0x91)
640 #define BME280_PRESSURE_CALIB_DIG_P3_LSB_REG                (0x92)
641 #define BME280_PRESSURE_CALIB_DIG_P3_MSB_REG                (0x93)
642 #define BME280_PRESSURE_CALIB_DIG_P4_LSB_REG                (0x94)
643 #define BME280_PRESSURE_CALIB_DIG_P4_MSB_REG                (0x95)
644 #define BME280_PRESSURE_CALIB_DIG_P5_LSB_REG                (0x96)
645 #define BME280_PRESSURE_CALIB_DIG_P5_MSB_REG                (0x97)
646 #define BME280_PRESSURE_CALIB_DIG_P6_LSB_REG                (0x98)
647 #define BME280_PRESSURE_CALIB_DIG_P6_MSB_REG                (0x99)
648 #define BME280_PRESSURE_CALIB_DIG_P7_LSB_REG                (0x9A)
649 #define BME280_PRESSURE_CALIB_DIG_P7_MSB_REG                (0x9B)
650 #define BME280_PRESSURE_CALIB_DIG_P8_LSB_REG                (0x9C)
651 #define BME280_PRESSURE_CALIB_DIG_P8_MSB_REG                (0x9D)
652 #define BME280_PRESSURE_CALIB_DIG_P9_LSB_REG                (0x9E)
653 #define BME280_PRESSURE_CALIB_DIG_P9_MSB_REG                (0x9F)
654
655 #define BME280_HUMIDITY_CALIB_DIG_H1_REG                    (0xA1)
656
657 #define BME280_HUMIDITY_CALIB_DIG_H2_LSB_REG                (0xE1)
658 #define BME280_HUMIDITY_CALIB_DIG_H2_MSB_REG                (0xE2)
659 #define BME280_HUMIDITY_CALIB_DIG_H3_REG                    (0xE3)
660 #define BME280_HUMIDITY_CALIB_DIG_H4_MSB_REG                (0xE4)
661 #define BME280_HUMIDITY_CALIB_DIG_H4_LSB_REG                (0xE5)
662 #define BME280_HUMIDITY_CALIB_DIG_H5_MSB_REG                (0xE6)
663 #define BME280_HUMIDITY_CALIB_DIG_H6_REG                    (0xE7)
664 /****************************************************/
665 /**\name        REGISTER ADDRESS DEFINITIONS  */
666 /***************************************************/
667 #define BME280_CHIP_ID_REG                   (0xD0)  /*Chip ID Register */
668 #define BME280_RST_REG                       (0xE0)  /*Softreset Register */
669 #define BME280_STAT_REG                      (0xF3)  /*Status Register */
670 #define BME280_CTRL_MEAS_REG                 (0xF4)  /*Ctrl Measure Register */
671 #define BME280_CTRL_HUMIDITY_REG             (0xF2)  /*Ctrl Humidity Register*/
672 #define BME280_CONFIG_REG                    (0xF5)  /*Configuration Register */
673 #define BME280_PRESSURE_MSB_REG              (0xF7)  /*Pressure MSB Register */
674 #define BME280_PRESSURE_LSB_REG              (0xF8)  /*Pressure LSB Register */
675 #define BME280_PRESSURE_XLSB_REG             (0xF9)  /*Pressure XLSB Register */
676 #define BME280_TEMPERATURE_MSB_REG           (0xFA)  /*Temperature MSB Reg */
677 #define BME280_TEMPERATURE_LSB_REG           (0xFB)  /*Temperature LSB Reg */
678 #define BME280_TEMPERATURE_XLSB_REG          (0xFC)  /*Temperature XLSB Reg */
679 #define BME280_HUMIDITY_MSB_REG              (0xFD)  /*Humidity MSB Reg */
680 #define BME280_HUMIDITY_LSB_REG              (0xFE)  /*Humidity LSB Reg */
681 /****************************************************/
682 /**\name        BIT MASK, LENGTH AND POSITION DEFINITIONS  */
683 /***************************************************/
684 /* Status Register */
685 #define BME280_STAT_REG_MEASURING__POS           (3)
686 #define BME280_STAT_REG_MEASURING__MSK           (0x08)
687 #define BME280_STAT_REG_MEASURING__LEN           (1)
688 #define BME280_STAT_REG_MEASURING__REG           (BME280_STAT_REG)
689
690 #define BME280_STAT_REG_IM_UPDATE__POS            (0)
691 #define BME280_STAT_REG_IM_UPDATE__MSK            (0x01)
692 #define BME280_STAT_REG_IM_UPDATE__LEN            (1)
693 #define BME280_STAT_REG_IM_UPDATE__REG            (BME280_STAT_REG)
694 /****************************************************/
695 /**\name        BIT MASK, LENGTH AND POSITION DEFINITIONS
696 FOR TEMPERATURE OVERSAMPLING  */
697 /***************************************************/
698 /* Control Measurement Register */
699 #define BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__POS             (5)
700 #define BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__MSK             (0xE0)
701 #define BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__LEN             (3)
702 #define BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__REG             \
703 (BME280_CTRL_MEAS_REG)
704 /****************************************************/
705 /**\name        BIT MASK, LENGTH AND POSITION DEFINITIONS
706 FOR PRESSURE OVERSAMPLING  */
707 /***************************************************/
708 #define BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__POS             (2)
709 #define BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__MSK             (0x1C)
710 #define BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__LEN             (3)
711 #define BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__REG             \
712 (BME280_CTRL_MEAS_REG)
713 /****************************************************/
714 /**\name        BIT MASK, LENGTH AND POSITION DEFINITIONS
715 FOR POWER MODE  */
716 /***************************************************/
717 #define BME280_CTRL_MEAS_REG_POWER_MODE__POS              (0)
718 #define BME280_CTRL_MEAS_REG_POWER_MODE__MSK              (0x03)
719 #define BME280_CTRL_MEAS_REG_POWER_MODE__LEN              (2)
720 #define BME280_CTRL_MEAS_REG_POWER_MODE__REG              \
721 (BME280_CTRL_MEAS_REG)
722 /****************************************************/
723 /**\name        BIT MASK, LENGTH AND POSITION DEFINITIONS
724 FOR HUMIDITY OVERSAMPLING  */
725 /***************************************************/
726 #define BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY__POS             (0)
727 #define BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY__MSK             (0x07)
728 #define BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY__LEN             (3)
729 #define BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY__REG            \
730 (BME280_CTRL_HUMIDITY_REG)
731 /****************************************************/
732 /**\name        BIT MASK, LENGTH AND POSITION DEFINITIONS
733 FOR STANDBY TIME  */
734 /***************************************************/
735 /* Configuration Register */
736 #define BME280_CONFIG_REG_TSB__POS                 (5)
737 #define BME280_CONFIG_REG_TSB__MSK                 (0xE0)
738 #define BME280_CONFIG_REG_TSB__LEN                 (3)
739 #define BME280_CONFIG_REG_TSB__REG                 (BME280_CONFIG_REG)
740 /****************************************************/
741 /**\name        BIT MASK, LENGTH AND POSITION DEFINITIONS
742 FOR FILTER */
743 /***************************************************/
744 #define BME280_CONFIG_REG_FILTER__POS              (2)
745 #define BME280_CONFIG_REG_FILTER__MSK              (0x1C)
746 #define BME280_CONFIG_REG_FILTER__LEN              (3)
747 #define BME280_CONFIG_REG_FILTER__REG              (BME280_CONFIG_REG)
748 /****************************************************/
749 /**\name        BIT MASK, LENGTH AND POSITION DEFINITIONS
750 FOR SPI ENABLE  */
751 /***************************************************/
752 #define BME280_CONFIG_REG_SPI3_ENABLE__POS             (0)
753 #define BME280_CONFIG_REG_SPI3_ENABLE__MSK             (0x01)
754 #define BME280_CONFIG_REG_SPI3_ENABLE__LEN             (1)
755 #define BME280_CONFIG_REG_SPI3_ENABLE__REG            (BME280_CONFIG_REG)
756 /****************************************************/
757 /**\name        BIT MASK, LENGTH AND POSITION DEFINITIONS
758 FOR PRESSURE AND TEMPERATURE DATA  */
759 /***************************************************/
760 /* Data Register */
761 #define BME280_PRESSURE_XLSB_REG_DATA__POS         (4)
762 #define BME280_PRESSURE_XLSB_REG_DATA__MSK         (0xF0)
763 #define BME280_PRESSURE_XLSB_REG_DATA__LEN         (4)
764 #define BME280_PRESSURE_XLSB_REG_DATA__REG         (BME280_PRESSURE_XLSB_REG)
765
766 #define BME280_TEMPERATURE_XLSB_REG_DATA__POS      (4)
767 #define BME280_TEMPERATURE_XLSB_REG_DATA__MSK      (0xF0)
768 #define BME280_TEMPERATURE_XLSB_REG_DATA__LEN      (4)
769 #define BME280_TEMPERATURE_XLSB_REG_DATA__REG      (BME280_TEMPERATURE_XLSB_REG)
770 /****************************************************/
771 /**\name        BUS READ AND WRITE FUNCTION POINTERS */
772 /***************************************************/
773 #define BME280_WR_FUNC_PTR\
774                 s8 (*bus_write)(u8, u8,\
775                 u8 *, u8)
776
777 #define BME280_RD_FUNC_PTR\
778                 s8 (*bus_read)(u8, u8,\
779                 u8 *, u8)
780
781 #define BME280_MDELAY_DATA_TYPE u16
782
783 #define BME280_3MS_DELAY        3
784 /**************************************************************/
785 /**\name        STRUCTURE DEFINITIONS                         */
786 /**************************************************************/
787 /*!
788  * @brief This structure holds all device specific calibration parameters
789  */
790 struct bme280_calibration_param_t {
791         u16 dig_T1;/**<calibration T1 data*/
792         s16 dig_T2;/**<calibration T2 data*/
793         s16 dig_T3;/**<calibration T3 data*/
794         u16 dig_P1;/**<calibration P1 data*/
795         s16 dig_P2;/**<calibration P2 data*/
796         s16 dig_P3;/**<calibration P3 data*/
797         s16 dig_P4;/**<calibration P4 data*/
798         s16 dig_P5;/**<calibration P5 data*/
799         s16 dig_P6;/**<calibration P6 data*/
800         s16 dig_P7;/**<calibration P7 data*/
801         s16 dig_P8;/**<calibration P8 data*/
802         s16 dig_P9;/**<calibration P9 data*/
803
804         u8  dig_H1;/**<calibration H1 data*/
805         s16 dig_H2;/**<calibration H2 data*/
806         u8  dig_H3;/**<calibration H3 data*/
807         s16 dig_H4;/**<calibration H4 data*/
808         s16 dig_H5;/**<calibration H5 data*/
809         s8  dig_H6;/**<calibration H6 data*/
810
811         s32 t_fine;/**<calibration T_FINE data*/
812 };
813 /*!
814  * @brief This structure holds BME280 initialization parameters
815  */
816 struct bme280_t {
817         struct bme280_calibration_param_t cal_param;
818         /**< calibration parameters*/
819
820         u8 chip_id;/**< chip id of the sensor*/
821         u8 dev_addr;/**< device address of the sensor*/
822
823         u8 oversamp_temperature;/**< temperature over sampling*/
824         u8 oversamp_pressure;/**< pressure over sampling*/
825         u8 oversamp_humidity;/**< humidity over sampling*/
826         u8 ctrl_hum_reg;/**< status of control humidity register*/
827         u8 ctrl_meas_reg;/**< status of control measurement register*/
828         u8 config_reg;/**< status of configuration register*/
829
830         BME280_WR_FUNC_PTR;/**< bus write function pointer*/
831         BME280_RD_FUNC_PTR;/**< bus read function pointer*/
832         void (*delay_msec)(BME280_MDELAY_DATA_TYPE);/**< delay function pointer*/
833 };
834 /**************************************************************/
835 /**\name        FUNCTION DECLARATIONS                         */
836 /**************************************************************/
837 /**************************************************************/
838 /**\name        FUNCTION FOR  INTIALIZATION                       */
839 /**************************************************************/
840 /*!
841  *      @brief This function is used for initialize
842  *      the bus read and bus write functions
843  *  and assign the chip id and I2C address of the BME280 sensor
844  *      chip id is read in the register 0xD0 bit from 0 to 7
845  *
846  *       @param bme280 structure pointer.
847  *
848  *      @note While changing the parameter of the bme280_t
849  *      @note consider the following point:
850  *      Changing the reference value of the parameter
851  *      will changes the local copy or local reference
852  *      make sure your changes will not
853  *      affect the reference value of the parameter
854  *      (Better case don't change the reference value of the parameter)
855  *
856  *
857  *
858  *
859  *      @return results of bus communication function
860  *      @retval 0 -> Success
861  *      @retval -1 -> Error
862  *
863  *
864 */
865 BME280_RETURN_FUNCTION_TYPE bme280_init(struct bme280_t *bme280);
866 /**************************************************************/
867 /**\name        FUNCTION FOR  INTIALIZATION UNCOMPENSATED TEMPERATURE */
868 /**************************************************************/
869 /*!
870  *      @brief This API is used to read uncompensated temperature
871  *      in the registers 0xFA, 0xFB and 0xFC
872  *      @note 0xFA -> MSB -> bit from 0 to 7
873  *      @note 0xFB -> LSB -> bit from 0 to 7
874  *      @note 0xFC -> LSB -> bit from 4 to 7
875  *
876  * @param v_uncomp_temperature_s32 : The value of uncompensated temperature
877  *
878  *
879  *
880  *      @return results of bus communication function
881  *      @retval 0 -> Success
882  *      @retval -1 -> Error
883  *
884  *
885 */
886 BME280_RETURN_FUNCTION_TYPE bme280_read_uncomp_temperature(
887 s32 *v_uncomp_temperature_s32);
888 /**************************************************************/
889 /**\name        FUNCTION FOR  INTIALIZATION TRUE TEMPERATURE */
890 /**************************************************************/
891 /*!
892  * @brief Reads actual temperature from uncompensated temperature
893  * @note Returns the value in 0.01 degree Centigrade
894  * Output value of "5123" equals 51.23 DegC.
895  *
896  *
897  *
898  *  @param  v_uncomp_temperature_s32 : value of uncompensated temperature
899  *
900  *
901  *  @return Returns the actual temperature
902  *
903 */
904 s32 bme280_compensate_temperature_int32(s32 v_uncomp_temperature_s32);
905 /*!
906  * @brief Reads actual temperature from uncompensated temperature
907  * @note Returns the value with 500LSB/DegC centred around 24 DegC
908  * output value of "5123" equals(5123/500)+24 = 34.246DegC
909  *
910  *
911  *  @param v_uncomp_temperature_s32: value of uncompensated temperature
912  *
913  *
914  *
915  *  @return Return the actual temperature as s16 output
916  *
917 */
918 s16 bme280_compensate_temperature_int32_sixteen_bit_output(
919 s32 v_uncomp_temperature_s32);
920 /**************************************************************/
921 /**\name        FUNCTION FOR  INTIALIZATION UNCOMPENSATED PRESSURE */
922 /**************************************************************/
923 /*!
924  *      @brief This API is used to read uncompensated pressure.
925  *      in the registers 0xF7, 0xF8 and 0xF9
926  *      @note 0xF7 -> MSB -> bit from 0 to 7
927  *      @note 0xF8 -> LSB -> bit from 0 to 7
928  *      @note 0xF9 -> LSB -> bit from 4 to 7
929  *
930  *
931  *
932  *      @param v_uncomp_pressure_s32 : The value of uncompensated pressure
933  *
934  *
935  *
936  *      @return results of bus communication function
937  *      @retval 0 -> Success
938  *      @retval -1 -> Error
939  *
940  *
941 */
942 BME280_RETURN_FUNCTION_TYPE bme280_read_uncomp_pressure(
943 s32 *v_uncomp_pressure_s32);
944 /**************************************************************/
945 /**\name        FUNCTION FOR  INTIALIZATION TRUE PRESSURE */
946 /**************************************************************/
947 /*!
948  * @brief Reads actual pressure from uncompensated pressure
949  * @note Returns the value in Pascal(Pa)
950  * Output value of "96386" equals 96386 Pa =
951  * 963.86 hPa = 963.86 millibar
952  *
953  *
954  *
955  *  @param v_uncomp_pressure_s32 : value of uncompensated pressure
956  *
957  *
958  *
959  *  @return Return the actual pressure output as u32
960  *
961 */
962 u32 bme280_compensate_pressure_int32(s32 v_uncomp_pressure_s32);
963 /**************************************************************/
964 /**\name        FUNCTION FOR  INTIALIZATION UNCOMPENSATED HUMIDITY */
965 /**************************************************************/
966 /*!
967  *      @brief This API is used to read uncompensated humidity.
968  *      in the registers 0xF7, 0xF8 and 0xF9
969  *      @note 0xFD -> MSB -> bit from 0 to 7
970  *      @note 0xFE -> LSB -> bit from 0 to 7
971  *
972  *
973  *
974  *      @param v_uncomp_humidity_s32 : The value of uncompensated humidity
975  *
976  *
977  *
978  *      @return results of bus communication function
979  *      @retval 0 -> Success
980  *      @retval -1 -> Error
981  *
982  *
983 */
984 BME280_RETURN_FUNCTION_TYPE bme280_read_uncomp_humidity(
985 s32 *v_uncomp_humidity_s32);
986 /**************************************************************/
987 /**\name        FUNCTION FOR  INTIALIZATION RELATIVE HUMIDITY */
988 /**************************************************************/
989 /*!
990  * @brief Reads actual humidity from uncompensated humidity
991  * @note Returns the value in %rH as unsigned 32bit integer
992  * in Q22.10 format(22 integer 10 fractional bits).
993  * @note An output value of 42313
994  * represents 42313 / 1024 = 41.321 %rH
995  *
996  *
997  *
998  *  @param  v_uncomp_humidity_s32: value of uncompensated humidity
999  *
1000  *  @return Return the actual relative humidity output as u32
1001  *
1002 */
1003 u32 bme280_compensate_humidity_int32(s32 v_uncomp_humidity_s32);
1004 /*!
1005  * @brief Reads actual humidity from uncompensated humidity
1006  * @note Returns the value in %rH as unsigned 16bit integer
1007  * @note An output value of 42313
1008  * represents 42313/512 = 82.643 %rH
1009  *
1010  *
1011  *
1012  *  @param v_uncomp_humidity_s32: value of uncompensated humidity
1013  *
1014  *
1015  *  @return Return the actual relative humidity output as u16
1016  *
1017 */
1018 u16 bme280_compensate_humidity_int32_sixteen_bit_output(
1019 s32 v_uncomp_humidity_s32);
1020 /**************************************************************/
1021 /**\name        FUNCTION FOR  INTIALIZATION UNCOMPENSATED PRESSURE,
1022  TEMPERATURE AND HUMIDITY */
1023 /**************************************************************/
1024 /*!
1025  * @brief This API used to read uncompensated
1026  * pressure,temperature and humidity
1027  *
1028  *
1029  *
1030  *
1031  *  @param  v_uncomp_pressure_s32: The value of uncompensated pressure.
1032  *  @param  v_uncomp_temperature_s32: The value of uncompensated temperature
1033  *  @param  v_uncomp_humidity_s32: The value of uncompensated humidity.
1034  *
1035  *
1036  *
1037  *      @return results of bus communication function
1038  *      @retval 0 -> Success
1039  *      @retval -1 -> Error
1040  *
1041  *
1042 */
1043 BME280_RETURN_FUNCTION_TYPE bme280_read_uncomp_pressure_temperature_humidity(
1044 s32 *v_uncomp_pressure_s32,
1045 s32 *v_uncomp_temperature_s32, s32 *v_uncomp_humidity_s32);
1046 /**************************************************************/
1047 /**\name        FUNCTION FOR TRUE UNCOMPENSATED PRESSURE,
1048  TEMPERATURE AND HUMIDITY */
1049 /**************************************************************/
1050 /*!
1051  * @brief This API used to read true pressure, temperature and humidity
1052  *
1053  *
1054  *
1055  *
1056  *      @param  v_pressure_u32 : The value of compensated pressure.
1057  *      @param  v_temperature_s32 : The value of compensated temperature.
1058  *      @param  v_humidity_u32 : The value of compensated humidity.
1059  *
1060  *
1061  *      @return results of bus communication function
1062  *      @retval 0 -> Success
1063  *      @retval -1 -> Error
1064  *
1065  *
1066 */
1067 BME280_RETURN_FUNCTION_TYPE bme280_read_pressure_temperature_humidity(
1068 u32 *v_pressure_u32, s32 *v_temperature_s32, u32 *v_humidity_u32);
1069 /**************************************************************/
1070 /**\name        FUNCTION FOR CALIBRATION */
1071 /**************************************************************/
1072 /*!
1073  *      @brief This API is used to
1074  *      calibration parameters used for calculation in the registers
1075  *
1076  *  parameter | Register address |   bit
1077  *------------|------------------|----------------
1078  *      dig_T1    |  0x88 and 0x89   | from 0 : 7 to 8: 15
1079  *      dig_T2    |  0x8A and 0x8B   | from 0 : 7 to 8: 15
1080  *      dig_T3    |  0x8C and 0x8D   | from 0 : 7 to 8: 15
1081  *      dig_P1    |  0x8E and 0x8F   | from 0 : 7 to 8: 15
1082  *      dig_P2    |  0x90 and 0x91   | from 0 : 7 to 8: 15
1083  *      dig_P3    |  0x92 and 0x93   | from 0 : 7 to 8: 15
1084  *      dig_P4    |  0x94 and 0x95   | from 0 : 7 to 8: 15
1085  *      dig_P5    |  0x96 and 0x97   | from 0 : 7 to 8: 15
1086  *      dig_P6    |  0x98 and 0x99   | from 0 : 7 to 8: 15
1087  *      dig_P7    |  0x9A and 0x9B   | from 0 : 7 to 8: 15
1088  *      dig_P8    |  0x9C and 0x9D   | from 0 : 7 to 8: 15
1089  *      dig_P9    |  0x9E and 0x9F   | from 0 : 7 to 8: 15
1090  *      dig_H1    |         0xA1     | from 0 to 7
1091  *      dig_H2    |  0xE1 and 0xE2   | from 0 : 7 to 8: 15
1092  *      dig_H3    |         0xE3     | from 0 to 7
1093  *
1094  *      @return results of bus communication function
1095  *      @retval 0 -> Success
1096  *      @retval -1 -> Error
1097  *
1098  *
1099 */
1100 BME280_RETURN_FUNCTION_TYPE bme280_get_calib_param(void);
1101 /**************************************************************/
1102 /**\name        FUNCTION FOR TEMPERATURE OVER SAMPLING */
1103 /**************************************************************/
1104 /*!
1105  *      @brief This API is used to get
1106  *      the temperature oversampling setting in the register 0xF4
1107  *      bits from 5 to 7
1108  *
1109  *      value               |   Temperature oversampling
1110  * ---------------------|---------------------------------
1111  *      0x00                | Skipped
1112  *      0x01                | BME280_OVERSAMP_1X
1113  *      0x02                | BME280_OVERSAMP_2X
1114  *      0x03                | BME280_OVERSAMP_4X
1115  *      0x04                | BME280_OVERSAMP_8X
1116  *      0x05,0x06 and 0x07  | BME280_OVERSAMP_16X
1117  *
1118  *
1119  *  @param v_value_u8 : The value of temperature over sampling
1120  *
1121  *
1122  *
1123  *      @return results of bus communication function
1124  *      @retval 0 -> Success
1125  *      @retval -1 -> Error
1126  *
1127  *
1128 */
1129 BME280_RETURN_FUNCTION_TYPE bme280_get_oversamp_temperature(
1130 u8 *v_value_u8);
1131 /*!
1132  *      @brief This API is used to set
1133  *      the temperature oversampling setting in the register 0xF4
1134  *      bits from 5 to 7
1135  *
1136  *      value               |   Temperature oversampling
1137  * ---------------------|---------------------------------
1138  *      0x00                | Skipped
1139  *      0x01                | BME280_OVERSAMP_1X
1140  *      0x02                | BME280_OVERSAMP_2X
1141  *      0x03                | BME280_OVERSAMP_4X
1142  *      0x04                | BME280_OVERSAMP_8X
1143  *      0x05,0x06 and 0x07  | BME280_OVERSAMP_16X
1144  *
1145  *
1146  *  @param v_value_u8 : The value of temperature over sampling
1147  *
1148  *
1149  *
1150  *      @return results of bus communication function
1151  *      @retval 0 -> Success
1152  *      @retval -1 -> Error
1153  *
1154  *
1155 */
1156 BME280_RETURN_FUNCTION_TYPE bme280_set_oversamp_temperature(
1157 u8 v_value_u8);
1158 /**************************************************************/
1159 /**\name        FUNCTION FOR PRESSURE OVER SAMPLING */
1160 /**************************************************************/
1161 /*!
1162  *      @brief This API is used to get
1163  *      the pressure oversampling setting in the register 0xF4
1164  *      bits from 2 to 4
1165  *
1166  *      value              | Pressure oversampling
1167  * --------------------|--------------------------
1168  *      0x00               | Skipped
1169  *      0x01               | BME280_OVERSAMP_1X
1170  *      0x02               | BME280_OVERSAMP_2X
1171  *      0x03               | BME280_OVERSAMP_4X
1172  *      0x04               | BME280_OVERSAMP_8X
1173  *      0x05,0x06 and 0x07 | BME280_OVERSAMP_16X
1174  *
1175  *
1176  *  @param v_value_u8 : The value of pressure oversampling
1177  *
1178  *
1179  *
1180  *      @return results of bus communication function
1181  *      @retval 0 -> Success
1182  *      @retval -1 -> Error
1183  *
1184  *
1185 */
1186 BME280_RETURN_FUNCTION_TYPE bme280_get_oversamp_pressure(
1187 u8 *v_value_u8);
1188 /*!
1189  *      @brief This API is used to set
1190  *      the pressure oversampling setting in the register 0xF4
1191  *      bits from 2 to 4
1192  *
1193  *      value              | Pressure oversampling
1194  * --------------------|--------------------------
1195  *      0x00               | Skipped
1196  *      0x01               | BME280_OVERSAMP_1X
1197  *      0x02               | BME280_OVERSAMP_2X
1198  *      0x03               | BME280_OVERSAMP_4X
1199  *      0x04               | BME280_OVERSAMP_8X
1200  *      0x05,0x06 and 0x07 | BME280_OVERSAMP_16X
1201  *
1202  *
1203  *  @param v_value_u8 : The value of pressure oversampling
1204  *
1205  *
1206  *
1207  *      @return results of bus communication function
1208  *      @retval 0 -> Success
1209  *      @retval -1 -> Error
1210  *
1211  *
1212 */
1213 BME280_RETURN_FUNCTION_TYPE bme280_set_oversamp_pressure(
1214 u8 v_value_u8);
1215 /**************************************************************/
1216 /**\name        FUNCTION FOR HUMIDITY OVER SAMPLING */
1217 /**************************************************************/
1218 /*!
1219  *      @brief This API is used to get
1220  *      the humidity oversampling setting in the register 0xF2
1221  *      bits from 0 to 2
1222  *
1223  *      value               | Humidity oversampling
1224  * ---------------------|-------------------------
1225  *      0x00                | Skipped
1226  *      0x01                | BME280_OVERSAMP_1X
1227  *      0x02                | BME280_OVERSAMP_2X
1228  *      0x03                | BME280_OVERSAMP_4X
1229  *      0x04                | BME280_OVERSAMP_8X
1230  *      0x05,0x06 and 0x07  | BME280_OVERSAMP_16X
1231  *
1232  *
1233  *  @param  v_value_u8 : The value of humidity over sampling
1234  *
1235  *
1236  *
1237  *      @return results of bus communication function
1238  *      @retval 0 -> Success
1239  *      @retval -1 -> Error
1240  *
1241  *
1242 */
1243 BME280_RETURN_FUNCTION_TYPE bme280_get_oversamp_humidity(u8 *v_value_u8);
1244 /*!
1245  *      @brief This API is used to set
1246  *      the humidity oversampling setting in the register 0xF2
1247  *      bits from 0 to 2
1248  *
1249  *      value               | Humidity oversampling
1250  * ---------------------|-------------------------
1251  *      0x00                | Skipped
1252  *      0x01                | BME280_OVERSAMP_1X
1253  *      0x02                | BME280_OVERSAMP_2X
1254  *      0x03                | BME280_OVERSAMP_4X
1255  *      0x04                | BME280_OVERSAMP_8X
1256  *      0x05,0x06 and 0x07  | BME280_OVERSAMP_16X
1257  *
1258  *
1259  *  @param  v_value_u8 : The value of humidity over sampling
1260  *
1261  *
1262  *
1263  * @note The "BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY"
1264  * register sets the humidity
1265  * data acquisition options of the device.
1266  * @note changes to this registers only become
1267  * effective after a write operation to
1268  * "BME280_CTRL_MEAS_REG" register.
1269  * @note In the code automated reading and writing of
1270  *      "BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY"
1271  * @note register first set the
1272  * "BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY"
1273  *  and then read and write
1274  *  the "BME280_CTRL_MEAS_REG" register in the function.
1275  *
1276  *
1277  *      @return results of bus communication function
1278  *      @retval 0 -> Success
1279  *      @retval -1 -> Error
1280  *
1281  *
1282 */
1283 BME280_RETURN_FUNCTION_TYPE bme280_set_oversamp_humidity(
1284 u8 v_value_u8);
1285 /**************************************************************/
1286 /**\name        FUNCTION FOR POWER MODE*/
1287 /**************************************************************/
1288 /*!
1289  *      @brief This API used to get the
1290  *      Operational Mode from the sensor in the register 0xF4 bit 0 and 1
1291  *
1292  *
1293  *
1294  *      @param v_power_mode_u8 : The value of power mode
1295  *  value           |    mode
1296  * -----------------|------------------
1297  *      0x00            | BME280_SLEEP_MODE
1298  *      0x01 and 0x02   | BME280_FORCED_MODE
1299  *      0x03            | BME280_NORMAL_MODE
1300  *
1301  *      @return results of bus communication function
1302  *      @retval 0 -> Success
1303  *      @retval -1 -> Error
1304  *
1305  *
1306 */
1307 BME280_RETURN_FUNCTION_TYPE bme280_get_power_mode(u8 *v_power_mode_u8);
1308 /*!
1309  *      @brief This API used to set the
1310  *      Operational Mode from the sensor in the register 0xF4 bit 0 and 1
1311  *
1312  *
1313  *
1314  *      @param v_power_mode_u8 : The value of power mode
1315  *  value           |    mode
1316  * -----------------|------------------
1317  *      0x00            | BME280_SLEEP_MODE
1318  *      0x01 and 0x02   | BME280_FORCED_MODE
1319  *      0x03            | BME280_NORMAL_MODE
1320  *
1321  *      @return results of bus communication function
1322  *      @retval 0 -> Success
1323  *      @retval -1 -> Error
1324  *
1325  *
1326 */
1327 BME280_RETURN_FUNCTION_TYPE bme280_set_power_mode(u8 v_power_mode_u8);
1328 /**************************************************************/
1329 /**\name        FUNCTION FOR SOFT RESET*/
1330 /**************************************************************/
1331 /*!
1332  * @brief Used to reset the sensor
1333  * The value 0xB6 is written to the 0xE0
1334  * register the device is reset using the
1335  * complete power-on-reset procedure.
1336  * @note Soft reset can be easily set using bme280_set_softreset().
1337  * @note Usage Hint : bme280_set_softreset()
1338  *
1339  *
1340  *      @return results of bus communication function
1341  *      @retval 0 -> Success
1342  *      @retval -1 -> Error
1343  *
1344  *
1345 */
1346 BME280_RETURN_FUNCTION_TYPE bme280_set_soft_rst(void);
1347 /**************************************************************/
1348 /**\name        FUNCTION FOR SPI ENABLE*/
1349 /**************************************************************/
1350 /*!
1351  *      @brief This API used to get the sensor
1352  *      SPI mode(communication type) in the register 0xF5 bit 0
1353  *
1354  *
1355  *
1356  *      @param v_enable_disable_u8 : The value of SPI enable
1357  *      value  | Description
1358  * --------|--------------
1359  *   0     | Disable
1360  *   1     | Enable
1361  *
1362  *
1363  *
1364  *      @return results of bus communication function
1365  *      @retval 0 -> Success
1366  *      @retval -1 -> Error
1367  *
1368  *
1369 */
1370 BME280_RETURN_FUNCTION_TYPE bme280_get_spi3(u8 *v_enable_disable_u8);
1371 /*!
1372  *      @brief This API used to set the sensor
1373  *      SPI mode(communication type) in the register 0xF5 bit 0
1374  *
1375  *
1376  *
1377  *      @param v_enable_disable_u8 : The value of SPI enable
1378  *      value  | Description
1379  * --------|--------------
1380  *   0     | Disable
1381  *   1     | Enable
1382  *
1383  *
1384  *
1385  *      @return results of bus communication function
1386  *      @retval 0 -> Success
1387  *      @retval -1 -> Error
1388  *
1389  *
1390 */
1391 BME280_RETURN_FUNCTION_TYPE bme280_set_spi3(u8 v_enable_disable_u8);
1392 /**************************************************************/
1393 /**\name        FUNCTION FOR IIR FILTER*/
1394 /**************************************************************/
1395 /*!
1396  *      @brief This API is used to reads filter setting
1397  *      in the register 0xF5 bit 3 and 4
1398  *
1399  *
1400  *
1401  *      @param v_value_u8 : The value of IIR filter coefficient
1402  *
1403  *      value       |   Filter coefficient
1404  * -------------|-------------------------
1405  *      0x00        | BME280_FILTER_COEFF_OFF
1406  *      0x01        | BME280_FILTER_COEFF_2
1407  *      0x02        | BME280_FILTER_COEFF_4
1408  *      0x03        | BME280_FILTER_COEFF_8
1409  *      0x04        | BME280_FILTER_COEFF_16
1410  *
1411  *      @return results of bus communication function
1412  *      @retval 0 -> Success
1413  *      @retval -1 -> Error
1414  *
1415  *
1416 */
1417 BME280_RETURN_FUNCTION_TYPE bme280_get_filter(u8 *v_value_u8);
1418 /*!
1419  *      @brief This API is used to write filter setting
1420  *      in the register 0xF5 bit 3 and 4
1421  *
1422  *
1423  *
1424  *      @param v_value_u8 : The value of IIR filter coefficient
1425  *
1426  *      value       |   Filter coefficient
1427  * -------------|-------------------------
1428  *      0x00        | BME280_FILTER_COEFF_OFF
1429  *      0x01        | BME280_FILTER_COEFF_2
1430  *      0x02        | BME280_FILTER_COEFF_4
1431  *      0x03        | BME280_FILTER_COEFF_8
1432  *      0x04        | BME280_FILTER_COEFF_16
1433  *
1434  *      @return results of bus communication function
1435  *      @retval 0 -> Success
1436  *      @retval -1 -> Error
1437  *
1438  *
1439 */
1440 BME280_RETURN_FUNCTION_TYPE bme280_set_filter(u8 v_value_u8);
1441 /**************************************************************/
1442 /**\name        FUNCTION FOR STANDBY DURATION*/
1443 /**************************************************************/
1444 /*!
1445  *      @brief This API used to Read the
1446  *      standby duration time from the sensor in the register 0xF5 bit 5 to 7
1447  *
1448  *      @param v_standby_durn_u8 : The value of standby duration time value.
1449  *  value       | standby duration
1450  * -------------|-----------------------
1451  *    0x00      | BME280_STANDBY_TIME_1_MS
1452  *    0x01      | BME280_STANDBY_TIME_63_MS
1453  *    0x02      | BME280_STANDBY_TIME_125_MS
1454  *    0x03      | BME280_STANDBY_TIME_250_MS
1455  *    0x04      | BME280_STANDBY_TIME_500_MS
1456  *    0x05      | BME280_STANDBY_TIME_1000_MS
1457  *    0x06      | BME280_STANDBY_TIME_2000_MS
1458  *    0x07      | BME280_STANDBY_TIME_4000_MS
1459  *
1460  *
1461  *      @return results of bus communication function
1462  *      @retval 0 -> Success
1463  *      @retval -1 -> Error
1464  *
1465  *
1466 */
1467 BME280_RETURN_FUNCTION_TYPE bme280_get_standby_durn(u8 *v_standby_durn_u8);
1468 /*!
1469  *      @brief This API used to write the
1470  *      standby duration time from the sensor in the register 0xF5 bit 5 to 7
1471  *
1472  *      @param v_standby_durn_u8 : The value of standby duration time value.
1473  *  value       | standby duration
1474  * -------------|-----------------------
1475  *    0x00      | BME280_STANDBY_TIME_1_MS
1476  *    0x01      | BME280_STANDBY_TIME_63_MS
1477  *    0x02      | BME280_STANDBY_TIME_125_MS
1478  *    0x03      | BME280_STANDBY_TIME_250_MS
1479  *    0x04      | BME280_STANDBY_TIME_500_MS
1480  *    0x05      | BME280_STANDBY_TIME_1000_MS
1481  *    0x06      | BME280_STANDBY_TIME_2000_MS
1482  *    0x07      | BME280_STANDBY_TIME_4000_MS
1483  *
1484  *      @note Normal mode comprises an automated perpetual
1485  *      cycling between an (active)
1486  *      Measurement period and an (inactive) standby period.
1487  *      @note The standby time is determined by
1488  *      the contents of the register t_sb.
1489  *      Standby time can be set using BME280_STANDBY_TIME_125_MS.
1490  *
1491  *      @note Usage Hint : bme280_set_standby_durn(BME280_STANDBY_TIME_125_MS)
1492  *
1493  *
1494  *
1495  *      @return results of bus communication function
1496  *      @retval 0 -> Success
1497  *      @retval -1 -> Error
1498  *
1499  *
1500 */
1501 BME280_RETURN_FUNCTION_TYPE bme280_set_standby_durn(u8 v_standby_durn_u8);
1502 /**************************************************************/
1503 /**\name        FUNCTION FOR WORK MODE*/
1504 /**************************************************************/
1505 /*
1506  * @brief Writes the working mode to the sensor
1507  *
1508  *
1509  *
1510  *
1511  *  @param v_work_mode_u8 : Mode to be set
1512  *  value    | Working mode
1513  * ----------|--------------------
1514  *   0       | BME280_ULTRALOWPOWER_MODE
1515  *   1       | BME280_LOWPOWER_MODE
1516  *   2       | BME280_STANDARDRESOLUTION_MODE
1517  *   3       | BME280_HIGHRESOLUTION_MODE
1518  *   4       | BME280_ULTRAHIGHRESOLUTION_MODE
1519  *
1520  *      @return results of bus communication function
1521  *      @retval 0 -> Success
1522  *      @retval -1 -> Error
1523  *
1524  *
1525 */
1526 /*BME280_RETURN_FUNCTION_TYPE bme280_set_work_mode(u8 v_work_mode_u8);*/
1527 /**************************************************************/
1528 /**\name        FUNCTION FOR FORCE MODE DATA READ*/
1529 /**************************************************************/
1530 /*!
1531  * @brief This API used to read uncompensated
1532  * temperature,pressure and humidity in forced mode
1533  *
1534  *
1535  *      @param v_uncom_pressure_s32: The value of uncompensated pressure
1536  *      @param v_uncom_temperature_s32: The value of uncompensated temperature
1537  *      @param v_uncom_humidity_s32: The value of uncompensated humidity
1538  *
1539  *
1540  *      @return results of bus communication function
1541  *      @retval 0 -> Success
1542  *      @retval -1 -> Error
1543  *
1544  *
1545 */
1546 BME280_RETURN_FUNCTION_TYPE
1547 bme280_get_forced_uncomp_pressure_temperature_humidity(
1548 s32 *v_uncom_pressure_s32,
1549 s32 *v_uncom_temperature_s32, s32 *v_uncom_humidity_s32);
1550 /**************************************************************/
1551 /**\name        FUNCTION FOR COMMON READ AND WRITE */
1552 /**************************************************************/
1553 /*!
1554  * @brief
1555  *      This API write the data to
1556  *      the given register
1557  *
1558  *
1559  *      @param v_addr_u8 -> Address of the register
1560  *      @param v_data_u8 -> The data from the register
1561  *      @param v_len_u8 -> no of bytes to read
1562  *
1563  *
1564  *      @return results of bus communication function
1565  *      @retval 0 -> Success
1566  *      @retval -1 -> Error
1567  *
1568  *
1569  */
1570 BME280_RETURN_FUNCTION_TYPE bme280_write_register(u8 v_addr_u8,
1571 u8 *v_data_u8, u8 v_len_u8);
1572 /*!
1573  * @brief
1574  *      This API reads the data from
1575  *      the given register
1576  *
1577  *
1578  *      @param v_addr_u8 -> Address of the register
1579  *      @param v_data_u8 -> The data from the register
1580  *      @param v_len_u8 -> no of bytes to read
1581  *
1582  *
1583  *      @return results of bus communication function
1584  *      @retval 0 -> Success
1585  *      @retval -1 -> Error
1586  *
1587  *
1588  */
1589 BME280_RETURN_FUNCTION_TYPE bme280_read_register(u8 v_addr_u8,
1590 u8 *v_data_u8, u8 v_len_u8);
1591 /**************************************************************/
1592 /**\name        FUNCTION FOR FLOAT OUTPUT TEMPERATURE*/
1593 /**************************************************************/
1594 #ifdef BME280_ENABLE_FLOAT
1595 /*!
1596  * @brief Reads actual temperature from uncompensated temperature
1597  * @note returns the value in Degree centigrade
1598  * @note Output value of "51.23" equals 51.23 DegC.
1599  *
1600  *
1601  *
1602  *  @param v_uncom_temperature_s32 : value of uncompensated temperature
1603  *
1604  *
1605  *
1606  *  @return  Return the actual temperature in floating point
1607  *
1608 */
1609 double bme280_compensate_temperature_double(
1610 s32 v_uncom_temperature_s32);
1611 /**************************************************************/
1612 /**\name        FUNCTION FOR FLOAT OUTPUT PRESSURE*/
1613 /**************************************************************/
1614 /*!
1615  * @brief Reads actual pressure from uncompensated pressure
1616  * @note Returns pressure in Pa as double.
1617  * @note Output value of "96386.2"
1618  * equals 96386.2 Pa = 963.862 hPa.
1619  *
1620  *
1621  *  @param v_uncom_pressure_s32 : value of uncompensated pressure
1622  *
1623  *
1624  *  @return  Return the actual pressure in floating point
1625  *
1626 */
1627 double bme280_compensate_pressure_double(s32 v_uncom_pressure_s32);
1628 /**************************************************************/
1629 /**\name        FUNCTION FOR FLOAT OUTPUT HUMIDITY*/
1630 /**************************************************************/
1631 /*!
1632  * @brief Reads actual humidity from uncompensated humidity
1633  * @note returns the value in relative humidity (%rH)
1634  * @note Output value of "42.12" equals 42.12 %rH
1635  *
1636  *  @param v_uncom_humidity_s32 : value of uncompensated humidity
1637  *
1638  *
1639  *
1640  *  @return Return the actual humidity in floating point
1641  *
1642 */
1643 double bme280_compensate_humidity_double(s32 v_uncom_humidity_s32);
1644 #endif
1645 /**************************************************************/
1646 /**\name        FUNCTION FOR 64BIT OUTPUT PRESSURE*/
1647 /**************************************************************/
1648 #if defined(BME280_ENABLE_INT64) && defined(BME280_64BITSUPPORT_PRESENT)
1649 /*!
1650  * @brief Reads actual pressure from uncompensated pressure
1651  * @note Returns the value in Pa as unsigned 32 bit
1652  * integer in Q24.8 format (24 integer bits and
1653  * 8 fractional bits).
1654  * @note Output value of "24674867"
1655  * represents 24674867 / 256 = 96386.2 Pa = 963.862 hPa
1656  *
1657  *
1658  *
1659  *  @param  v_uncom_pressure_s32 : value of uncompensated temperature
1660  *
1661  *
1662  *  @return Return the actual pressure in u32
1663  *
1664 */
1665 u32 bme280_compensate_pressure_int64(s32 v_uncom_pressure_s32);
1666 /**************************************************************/
1667 /**\name        FUNCTION FOR 24BIT OUTPUT PRESSURE*/
1668 /**************************************************************/
1669 /*!
1670  * @brief Reads actual pressure from uncompensated pressure
1671  * @note Returns the value in Pa.
1672  * @note Output value of "12337434"
1673  * @note represents 12337434 / 128 = 96386.2 Pa = 963.862 hPa
1674  *
1675  *
1676  *
1677  *  @param v_uncom_pressure_s32 : value of uncompensated pressure
1678  *
1679  *
1680  *  @return the actual pressure in u32
1681  *
1682 */
1683 u32 bme280_compensate_pressure_int64_twentyfour_bit_output(
1684 s32 v_uncom_pressure_s32);
1685 #endif
1686 /**************************************************************/
1687 /**\name        FUNCTION FOR WAIT PERIOD*/
1688 /**************************************************************/
1689 /*!
1690  * @brief Computing waiting time for sensor data read
1691  *
1692  *
1693  *
1694  *
1695  *  @param v_delaytime_u8 : The value of delay time for force mode
1696  *
1697  *
1698  *      @retval 0 -> Success
1699  *
1700  *
1701  */
1702 BME280_RETURN_FUNCTION_TYPE bme280_compute_wait_time(u8
1703 *v_delaytime_u8r);
1704 #endif