bmx280reg.h revision 1.1 1 /* $NetBSD: bmx280reg.h,v 1.1 2022/12/03 01:04:43 brad Exp $ */
2
3 /*
4 * Copyright (c) 2022 Brad Spencer <brad (at) anduin.eldar.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 #ifndef _DEV_IC_BMX280REG_H_
20 #define _DEV_IC_BMX280REG_H_
21
22 #define BMX280_TYPICAL_ADDR_1 0x76
23 #define BMX280_TYPICAL_ADDR_2 0x77
24
25 #define BMX280_REGISTER_DIG_T1 0x88
26 #define BMX280_REGISTER_DIG_T2 0x8A
27 #define BMX280_REGISTER_DIG_T3 0x8C
28 #define BMX280_REGISTER_DIG_P1 0x8E
29 #define BMX280_REGISTER_DIG_P2 0x90
30 #define BMX280_REGISTER_DIG_P3 0x92
31 #define BMX280_REGISTER_DIG_P4 0x94
32 #define BMX280_REGISTER_DIG_P5 0x96
33 #define BMX280_REGISTER_DIG_P6 0x98
34 #define BMX280_REGISTER_DIG_P7 0x9A
35 #define BMX280_REGISTER_DIG_P8 0x9C
36 #define BMX280_REGISTER_DIG_P9 0x9E
37 #define BMX280_REGISTER_DIG_H1 0xA1
38 #define BMX280_REGISTER_DIG_H2 0xE1
39 #define BMX280_REGISTER_DIG_H3 0xE3
40 #define BMX280_REGISTER_DIG_H4 0xE4
41 #define BMX280_REGISTER_DIG_H5 0xE5
42
43 #define BMX280_REGISTER_ID 0xD0
44 #define BMX280_ID_BMP280 0x58
45 #define BMX280_ID_BME280 0x60
46
47 #define BMX280_REGISTER_RESET 0xE0
48 #define BMX280_TRIGGER_RESET 0xB6
49
50 #define BMX280_REGISTER_CTRL_HUM 0xF2
51
52 #define BMX280_REGISTER_STATUS 0xF3
53 #define BMX280_STATUS_MEASURING_MASK 0x08
54 #define BMX280_STATUS_IM_UPDATE_MASK 0x01
55
56 #define BMX280_REGISTER_CTRL_MEAS 0xF4
57 #define BMX280_CTRL_OSRS_T_MASK 0xE0
58 #define BMX280_CTRL_OSRS_P_MASK 0x1C
59 #define BMX280_CTRL_OSRS_T_SHIFT 5
60 #define BMX280_CTRL_OSRS_P_SHIFT 2
61 #define BMX280_OSRS_TP_VALUE_SKIPPED 0x00
62 #define BMX280_OSRS_TP_VALUE_X1 0x01
63 #define BMX280_OSRS_TP_VALUE_X2 0x02
64 #define BMX280_OSRS_TP_VALUE_X4 0x03
65 #define BMX280_OSRS_TP_VALUE_X8 0x04
66 #define BMX280_OSRS_TP_VALUE_X16 0x05
67 #define BMX280_CTRL_MODE_MASK 0x03
68 #define BMX280_MODE_SLEEP 0x00
69 #define BMX280_MODE_FORCED 0x01
70 #define BMX280_MODE_NORMAL 0x03
71
72 #define BMX280_REGISTER_CONFIG 0xF5
73 #define BMX280_CONFIG_T_SB_MASK 0xE0
74 #define BMX280_CONFIG_FILTER_MASK 0x1C
75 #define BMX280_CONFIG_FILTER_SHIFT 2
76 #define BMX280_FILTER_VALUE_OFF 0x00
77 #define BMX280_FILTER_VALUE_2 0x01
78 #define BMX280_FILTER_VALUE_5 0x02
79 #define BMX280_FILTER_VALUE_11 0x04
80 #define BMX280_FILTER_VALUE_22 0x05
81 #define BMX280_CONFIG_SPI3W_EN_MASK 0x01
82
83 #define BMX280_REGISTER_PRESS_MSB 0xF7
84 #define BMX280_REGISTER_PRESS_LSB 0xF8
85 #define BMX280_REGISTER_PRESS_XLSB 0xF9
86
87 #define BMX280_REGISTER_TEMP_MSB 0xFA
88 #define BMX280_REGISTER_TEMP_LSB 0xFB
89 #define BMX280_REGISTER_TEMP_XLSB 0xFC
90
91 #define BMX280_TEMPPRES_XLSB_MASK 0xF0
92
93 #define BMX280_REGISTER_HUM_MSB 0xFD
94 #define BMX280_REGISTER_HUM_LSB 0xFE
95
96 #endif
97