upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
bmpx8x_defs.h
1 /*
2  * Author: Jon Trulson <jtrulson@ics.com>
3  * Copyright (c) 2017 Intel Corporation.
4  *
5  * This driver was rewritten based on the original driver written by:
6  * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
7  *
8  * The MIT License
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining
11  * a copy of this software and associated documentation files (the
12  * "Software"), to deal in the Software without restriction, including
13  * without limitation the rights to use, copy, modify, merge, publish,
14  * distribute, sublicense, and/or sell copies of the Software, and to
15  * permit persons to whom the Software is furnished to do so, subject to
16  * the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be
19  * included in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28  */
29 #pragma once
30 
31 #define BMPX8X_DEFAULT_I2C_BUS 0
32 #define BMPX8X_DEFAULT_I2C_ADDR 0x77
33 #define BMPX8X_DEFAULT_CHIPID 0x55
34 // special reset byte
35 #define BMPX8X_RESET_BYTE 0xb6
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
44  typedef enum {
45  BMPX8X_CAL_AC1 = 0xaa, // Calibration data (16
46  // bits, msb/lsb)
47  BMPX8X_CAL_AC2 = 0xac,
48  BMPX8X_CAL_AC3 = 0xae,
49  BMPX8X_CAL_AC4 = 0xb0,
50  BMPX8X_CAL_AC5 = 0xb2,
51  BMPX8X_CAL_AC6 = 0xb4,
52  BMPX8X_CAL_B1 = 0xb6,
53  BMPX8X_CAL_B2 = 0xb8,
54  BMPX8X_CAL_MB = 0xba,
55  BMPX8X_CAL_MC = 0xbc,
56  BMPX8X_CAL_MD = 0xbe,
57 
58  BMPX8X_CTRL_MEAS = 0xf4, // command reg
59 
60  BMPX8X_OUTDATA_MSB = 0xf6,
61  BMPX8X_OUTDATA_LSB = 0xf7,
62  BMPX8X_OUTDATA_XLSB = 0xf8,
63 
64  BMPX8X_RESET = 0xe0,
65 
66  BMPX8X_CHIP_ID = 0xd0
67  } BMPX8X_REGS_T;
68 
72  typedef enum {
73  BMPX8X_CTRL_MEAS_CMD0 = 0x01, // measurement command
74  BMPX8X_CTRL_MEAS_CMD1 = 0x02,
75  BMPX8X_CTRL_MEAS_CMD2 = 0x04,
76  BMPX8X_CTRL_MEAS_CMD3 = 0x08,
77  BMPX8X_CTRL_MEAS_CMD4 = 0x10,
78  _BMPX8X_CTRL_MEAS_CMD_MASK = 31,
79  _BMPX8X_CTRL_MEAS_CMD_SHIFT = 0,
80 
81  BMPX8X_CTRL_MEAS_SCO = 0x20, // start conversion status
82 
83  BMPX8X_CTRL_MEAS_OSS0 = 0x40, // oversampling (precision)
84  BMPX8X_CTRL_MEAS_OSS1 = 0x80,
85  _BMPX8X_CTRL_MEAS_OSS_MASK = 3,
86  _BMPX8X_CTRL_MEAS_OSS_SHIFT = 6,
87  } BMPX8X_CTRL_MEAS_BITS_T;
88 
92  typedef enum {
93  BMPX8X_CMD_READ_TEMP = 0x2e,
94  BMPX8X_CMD_READ_PRESSURE = 0x34
95  } BMPX8X_CMD_T;
96 
100  typedef enum {
101  BMPX8X_OSS_ULTRALOWPOWER = 0,
102  BMPX8X_OSS_STANDARD = 1,
103  BMPX8X_OSS_HIGHRES = 2,
104  BMPX8X_OSS_ULTRAHIGHRES = 3
105  } BMPX8X_OSS_T;
106 
107 
108 #ifdef __cplusplus
109 }
110 #endif